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
Cannot combine within, should, and contains commands as expected #5183
Comments
I can recreate this - this is not the documented behavior of these commands. This seems possibly related to these 2 issues about incorrect scope: #4757 #4921 <!DOCTYPE html>
<html>
<body>
<article class='post'>
<h1>My Blog Post</h1>
</article>
<span>Hello World!</span>
</body>
</html> it('scope', () => {
cy.visit('index.html')
cy.get('article').within(() => {
cy.get('h1')
})
.should('have.text', '\n My Blog Post\n ');
cy.contains('Hello World!').should('be.visible');
}) |
The code for this is done in cypress-io/cypress#8699, 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:
Taken this example:
The first assertion passes but the second assertion fails. This is because it looks for
article span
instead ofspan
.Desired behavior:
Taken this example:
I expect that it looks for
span
instead ofarticle span
and I expect both assertions to pass.Steps to reproduce: (app code and test code)
Versions
Cypress: 3.4.1
OS: MacOS Mojave 10.14.5
Browser: Electron 61 + Chrome 77
The text was updated successfully, but these errors were encountered: