Some Calls to cy.visit() Fail with a Parse Error when experimentalNetworkStubbing is Turned On
See original GitHub issueCurrent behavior:
Some (but not all) of my calls cy.visit
are failing with a generic Parse Error
when I have experimentalNetworkStubbing
turned on. One such failing call is in the provided below.
Desired behavior:
Calls to cy.visit
succeed regardless of whether or not experimentalNetworkStubbing
is on.
Test code to reproduce:
it('Issue with cy.visit when experimentalNetworkStubbing is On', function () {
// This test will pass when experimentalNetworkStubbing is off, but will fail when it is on.
cy.visit('https://secure.vidyard.com/user/sign_in')
})
Versions:
Cypress version 5.1.0 on macOS 10.14.6 using Chrome 85.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Error Messages
cy.visit() failed because you are attempting to visit a different origin domain. Note. This error only pertains to Cypress version v11.0.0 ...
Read more >Cypress - cy.visit() failed trying to load
Maybe someone had the same issue we were facing which is that the cypress.json file was not in the root. We had it...
Read more >1000 Foot Overview of Writing Cypress Tests #frontend ...
To see if an element contains or does not contain some text, ... An example of making a cy.request() call is demonstrated here....
Read more >cypress: Versions
Previously the command would incorrectly fail with a syntax error. ... When experimentalNetworkStubbing is enabled, using cy.visit() to URLs that redirect ...
Read more >Cypress cy.intercept Problems
Thus, it makes the call right at the end of cy.visit command. ... cy.intercept happens in the Command Log was a user experience...
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
I ran into this issue as well. Building on the workaround from @alim16, I added the following to
cypress/support/commands.js
. This should “fix” the built-invisit
command to work around the issue so you don’t have to change any of your tests.Caveats:
visit
calls, so it may slow things down a bit and/or have unintended side effects on tests that don’t experience the redirect issue at allvisit
commandin case anyone is looking for a temporary workaround, here is mine I use cy.request to find the redirect url and then cy.visit
//my function looks like this
//and my test would look like this
@todd-m-kemp I needed an example url and can’t use mine, I hope you don’t mind
my experience with cypress is limited so if anyone has better/easier way, please let me know