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.visit fails inside cy.origin for certain sites #22459

Open
mrkjdy opened this issue Jun 22, 2022 · 6 comments
Open

cy.visit fails inside cy.origin for certain sites #22459

mrkjdy opened this issue Jun 22, 2022 · 6 comments
Labels
E2E Issue related to end-to-end testing topic: auth Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug

Comments

@mrkjdy
Copy link

mrkjdy commented Jun 22, 2022

Current behavior

Currently, when I visit certain sites (like login.ibm.com) within a cy.origin(), Cypress fails saying that the page never fired its load event:
image

However, when I do the same visit outside of a cy.origin() it works without issue:
image

Desired behavior

In this situation, Cypress should visit the url and continue working as expected

Test code to reproduce

The test code is available at https://github.com/mrkjdy/cypress-test-tiny/tree/bug/page-load-within-origin. See spec.cy.js

/// <reference types="cypress" />
describe('page', () => {
  // This test is fine
  it('visits successfully', () => {
    const username = 'myusername@ibm.com';
    cy.visit('https://login.ibm.com/')
      .get('#username')
      .type(username)
      .should('have.value', username);
  });

  // But this test is broken
  it('should also visit successfully but doesn\'t', () => {
    const args = { username: 'myusername@ibm.com' };
    cy.origin('login.ibm.com', { args }, ({ username }) => {
      cy.visit('https://login.ibm.com/') // Fails saying page never loaded
        .get('#username')
        .type(username)
        .should('have.value', username);
    });
  });
})

Cypress Version

10.2.0

Other

No response

@cypress-bot cypress-bot bot added the stage: investigating Someone from Cypress is looking into this label Jun 22, 2022
@chrisbreiding
Copy link
Contributor

I can reproduce this with the given code or with other sites too:

it('visit cypress.io', () => {
  cy.origin('cypress.io', () => {
    cy.visit('https://cypress.io') // page load times out
  })
})

In certain circumstances, I saw login.ibm.com hang even outside cy.origin(). It would always hang with experimentalSessionAndOrigin: true. If I turned that off, it would result in a cross-origin error unless I set the baseUrl to https://login.ibm.com.

@chrisbreiding chrisbreiding added stage: needs investigating Someone from Cypress needs to look at this and removed stage: investigating Someone from Cypress is looking into this labels Jun 29, 2022
@cypress-bot cypress-bot bot added stage: routed to e2e-auth and removed stage: needs investigating Someone from Cypress needs to look at this labels Jun 29, 2022
@chrisbreiding chrisbreiding removed their assignment Jul 13, 2022
@mschile mschile added triage and removed triage labels Aug 18, 2022
@mrkjdy
Copy link
Author

mrkjdy commented Sep 28, 2022

On Cypress 10.9 this is failing with a different error now:
image

Also, I updated the example repo. I'll be so happy once this is fixed :)

@thisismydesign
Copy link

I could revert to 10.1.0 to make this work

@colinstantos
Copy link

This is also happening to me on v10.10.0

@Marcelinna
Copy link

I have the same problem v10.10.0

@mrkjdy mrkjdy changed the title Page load never fires inside cy.origin cy.visit fails inside cy.origin for certain sites Oct 31, 2022
@nagash77 nagash77 added E2E Issue related to end-to-end testing topic: auth and removed E2E-auth labels Nov 8, 2022
@mrkjdy
Copy link
Author

mrkjdy commented Nov 9, 2022

Just checked on Cypress 11:
image

Maybe it has something to do with the "new url" events? I also updated the example repo, needed to switch the file preprocessor to @bahmutov/cypress-esbuild-preprocessor as the default webpack preprocessor is not working (#24611)

@nagash77 nagash77 added Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing topic: auth Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug
Projects
None yet
Development

No branches or pull requests

9 participants