question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Revert changes to query*s and add deprecation warning

See original GitHub issue

As noted in #108, we accidentally broke the query* queries. We should restore those to the original behavior and add a deprecation warning. Let’s try to make it subtle enough to not be really annoying, but present enough to be noticed 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
NicholasBollcommented, Feb 12, 2020

I know why this is happening now. I changed query* to use verifyUpcomingAssertions which will put an implicit should('exist') after the command. That works if you follow the command with an assertion - the explicit assertion changes the implicit one. If you disconnect the chain with a .then and a .wrap, the implicit assertion is in place and it doesn’t get to the .wrap. That’s true for built-in Cypress commands as well.

 // always worked
cy.queryByText('Never Exists').should('not.exist')

// Broke on the `queryByText` command since using `verifyUpcomingAssertions`
cy.queryByText('Never Exists').then(val => {
  cy.wrap(val).should('not.exist')
})

The reason the wrap worked before is because query used to return null and not fail like other commands that return DOM. This functionality might have been intentional since find* commands didn’t always retry properly. (I think that happened in 5.0).

I’m very sorry for the inconvenience. I’m glad the Cypress Testing Library find* commands work more like native Cypress commands. It makes it more natural to use in the Cypress context.

I’ll leave this issue open a bit more. Perhaps it is still safer to revert the query* line of queries. There’s a higher chance the upgrade breaks people that haven’t updated yet. Your code should be fine. The code can warn about the deprecation of query* and suggest an upgrade path

1reaction
NicholasBollcommented, Feb 12, 2020

That must be what I was missing. It seems to be working with eventually not existing, but failing on does not exist now. I can reproduce again! Thank you!

There is a risk that reverting the change will break those relying on how 5.2 works now… 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix a Hibernate query with deprecation warnings?
As the message says, use named parameters instead. List users = sessionFactory.getCurrentSession() .createQuery( "from User where username = :username" ) .
Read more >
Adding deprecation messages - GitLab Docs
Adding deprecation messages. We store a list of deprecations associated with it in the list method of Gitlab::Deprecations class If a configuration has...
Read more >
T218994 Deprecation warning on elasticsearch 6
Description · T209859 Setting a negative [weight] in Function Score Query is deprecated and will throw an error in the next major version...
Read more >
GraphQL API deprecation process - Totara Help
If you rename schema items this will be a breaking change - consider it the same as adding one item and removing another....
Read more >
Deprecations, additions, and compatibility - Cypher Manual
all of the features that have been removed, deprecated, added, or extended in ... Changes to the visibility of databases hosted on offline...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found