-
Notifications
You must be signed in to change notification settings - Fork 3.3k
.each
changes scope for next dual-command (like cy.contains()
)
#4921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@dwelle thanks for reporting this. I can confirm I am seeing the same issue (as per my SO post) |
Reproducible example from #5163 it('FAILS with contains after each', () => {
cy.visit('https://www.google.com/')
cy.contains('About')
cy.get('input[type="submit"]').each(() => {})
cy.contains('About')
})
it('passes with contains after then', () => {
cy.visit('https://www.google.com/')
cy.contains('About')
cy.get('input[type="submit"]').then(() => { })
cy.contains('About')
})
it('passes with contains after should', () => {
cy.visit('https://www.google.com/')
cy.contains('About')
cy.get('input[type="submit"]').should(() => { })
cy.contains('About')
}) |
.each
changes scope for next cy.contains
command.each
changes scope for next dual-command (like cy.contains()
)
Interesting to note that this seems to happen with custom dual-commands also (aside from just |
Another example from #6791 it('BUG? - breaks a following contains command', () => {
cy.visit('https://example.cypress.io/commands/connectors')
cy.get('.connectors-each-ul>li').each(() => {})
cy.contains('Chai', { timeout: 10 })
}) |
The code for this is done in cypress-io/cypress#8712, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
When you call
.each()
, e.g. on acy.get()
command, it changes the scope for nextcy.contains()
command.Possibly affects other commands, and possibly calls other than
.each()
change the scope, too.Originally reported here.
Steps to reproduce: (app code and test code)
Versions
cypress
3.4.1
The text was updated successfully, but these errors were encountered: