-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Cross-origin error happening on same domain after click event adds same page anchor #7402
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
I can recreate this with the code below. I tried the it('visit', () => {
cy.visit('http://automationpractice.com/index.php?controller=authentication&back=my-account')
cy.get('#email_create').type('faketest_1@faketestexample.com')
cy.get('#create-account_form').submit()
cy.get('.uniform-id_gender1').click()
}) |
This is due to calling it('visit', () => {
cy.visit('https://example.cypress.io')
cy.document().then((doc) => {
doc.location = '#account-creation'
})
}) Added the hash specifically seems to render Cypress within itself. Setting a normal string to it('visit', () => {
cy.visit('https://example.cypress.io')
cy.document().then((doc) => {
doc.location = 'account-creation'
})
}) |
Missed @jennifer-shehane however, #7418 won't fix the examples you've posted, as it doesn't rewrite test code, only AUT code |
The code for this is done in cypress-io/cypress#7418, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
This fix is available starting in {
"experimentalSourceRewriting": true
} The fix is experimental, so there may be some situations where the this is not fixed. If you're still this issue while setting the |
Can we set this config option in one spec file and how? |
@shevara84 You can see any config option via it('test', () => {
console.log(Cypress.config('experimentalSourceRewriting'))
}) |
Current behavior:
Is not possible to continue with the test execution after getting error message:
This is happening when I click the create account button with a valid email (non-registered) in the email address field after visiting the site http://automationpractice.com/index.php?controller=authentication&back=my-account.
This event is not redirecting user to any new domain, actually it doesn't seem any redirection is made instead it looks like a page anchor from the same page is added to the url, loading new content in the same page and showing/hiding a few elements from the page layout.
If
chromeWebSecurity: false
is added to the thecypress.json
file the issue continues. No error message is displayed but instead after the same event is triggered a blank page is loaded instead blocking the test entirely.Desired behavior:
Cypress should be able to continue with the following step without showing the cross-origin error for this particular case.
Test code to reproduce
npx cypress open
Versions
Attachments
The text was updated successfully, but these errors were encountered: