AUT navigates to Cypress runner upon page navigation.
See original GitHub issueUse Cypress version 4.5.0 to reproduce. Later versions are currently blocked by(https://github.com/cypress-io/cypress/issues/7518)
This simple tests consists of:
- Logging in
- Visiting specific page with a form
- Filing out required fields and submitting
Upon submission of the form, a page redirect happens and a series of uncaught errors fire. However, when the form is cancelled, the page redirect still happens, but without the errors.
Here’s the code for both scenarios. The one where the error happens by submitting the form, and the one where everything is ok when canceling the form
it('Example With Errors',() => {
cy.request('POST', '/Auth/Login', { username: 'cydemoadmin', password: 'Test1@#$%' })
cy.visit('/#/Settings/business-units/Add')
cy.get('[type=submit]').should('be.visible')
cy.get('[name=Name]').type('TestBU8') //Change value after one use. You can just increase number
cy.get('[name=OfficialName]').type('TestBU8') //Change value after one use. You can just increase number
cy.get('[name=Email]').type('asdf2sdfsdf@ggmaill.com')
cy.get('[name=PhoneNumber]').type('8185556767')
cy.get('[type=submit]').click()
})
it('Example Without Errors',() => {
cy.request('POST', '/Auth/Login', { username: 'cydemoadmin', password: 'Test1@#$%' })
cy.visit('/#/Settings/business-units/Add')
cy.get('[type=submit]').should('be.visible')
cy.get('.btn-link.muted').click()
})
Here’s the stack trace
There seems to be a weird URL mutation happening for the scenario where the exceptions happen
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
When Can The Test Navigate? - Cypress
The test runner still has the reference to the "Users" navigation <a> element - but that element is no longer in the current...
Read more >How to detach Cypress test runner from a page?
I'm trying to use Cypress with a site that redirects users to a third-party site for authentication. Once a user logs in, they're...
Read more >Implementing navigation requests | End-to-End Web Testing ...
We use cy.visit() in Cypress to navigate to a remote page of the application under test. By using this command, we can also...
Read more >How to perform Cypress Test Automation | BrowserStack
A step-by-step tutorial on setting up and running automated Cypress test ... Navigate to cypress/integration/specs > create a file with name ...
Read more >Cypress Tips and Tricks - Gleb Bahmutov
Read the docs Run Cypress on your own CI Record success and. ... Getting the pathname after the page navigation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jennifer-shehane I think it’s because you ran both tests. There’s no
after
You just need to run only the it() with the error. If you run both it()'s it’ll move on the second test before the first one has finished loading the page and therefore the errors.Nevertheless, I tried
"experimentalSourceRewriting": true
on4.7.0
and got a different error. The page was never able to launch so the test never reached itJust make sure to it.only() the
Example With Errors
test and change values ofTestBU{##}
to some random name that hasn’t been used like test43823. You should see the URL mutation happen in anafter()
even though there is none specified in the spec fileThis is no longer reproducible from the given repro.
Since this issue hasn’t had activity in a while, we’ll close the issue until we can confirm this is still happening. Please comment if there is new information to provide concerning the original issue and we’d be happy to reopen.