Skip to content
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

cy.origin test hangs when visiting inside a cy.origin block #21453

Closed
mjhenkes opened this issue May 12, 2022 · 4 comments
Closed

cy.origin test hangs when visiting inside a cy.origin block #21453

mjhenkes opened this issue May 12, 2022 · 4 comments
Assignees
Labels
topic: cy.origin Problems or enhancements related to cy.origin command type: bug

Comments

@mjhenkes
Copy link
Member

Current behavior

A simple test to visit cypress.io in a cypress.io cy.origin block hangs.

Desired behavior

The test should not hang.

Test code to reproduce

it('navigates', () => {
  cy.origin('https://www.cypress.io/', () => {
    cy.visit('https://www.cypress.io/')
    cy.url().should('eq', 'https://www.cypress.io/')
  })
})

Cypress Version

9.6.1

Other

No response

@mjhenkes mjhenkes added topic: cy.origin Problems or enhancements related to cy.origin command experiment: origin labels May 12, 2022
@mjhenkes mjhenkes self-assigned this May 13, 2022
@AtofStryker
Copy link
Contributor

It looks like tests inside of https://www.google.com also hang, but looks related to accessing a cross origin parent frame referencing window.top. Setting chromeWebSecurity to false seems to fix the issue.

sample test looks something like this:

  it('go to google', () => {
    cy.visit('/fixtures/primary-origin.html')
    cy.get('a[data-cy="request-link-to-google"]').click()
    cy.origin('https://www.google.com', () => {
      cy.url().should('eq', 'https://www.google.com/')
    })
  })

@mjhenkes mjhenkes assigned mjhenkes and unassigned mjhenkes Jul 21, 2022
@etavenerInmarsat
Copy link

I've got a similar case of using 'origin' and it hangs. No errors, just doesn't proceed. I use this for a login page, which sometimes works and sometimes hangs.

Any update?

@AtofStryker
Copy link
Contributor

@etavenerInmarsat are you using Google Chrome to visit google.com inside cy.origin? That currently doesn't work for a different reason related to #22987

@mschile mschile added triage and removed triage labels Aug 18, 2022
@mjhenkes
Copy link
Member Author

This test works except for the uncaught exception thrown by the cypress.io webpage. Handling that exception allows the test to pass without hanging:

it('navigates', () => {
  cy.origin('https://www.cypress.io/', () => {
    Cypress.on('uncaught:exception', () => {
      return false
    })

    cy.visit('https://www.cypress.io/')
    cy.url().should('eq', 'https://www.cypress.io/')
  })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cy.origin Problems or enhancements related to cy.origin command type: bug
Projects
None yet
Development

No branches or pull requests

4 participants