cypress icon indicating copy to clipboard operation
cypress copied to clipboard

cy.origin not working

Open sufian1985 opened this issue 1 year ago • 12 comments

Current behavior

Timed out after waiting 60000ms for your remote page to load.

Your page did not fire its load event within 60000ms.

You can try increasing the pageLoadTimeout value in cypress.config.ts to wait longer.

Browsers will not fire the load event until all stylesheets and scripts are done downloading.

When this load event occurs, Cypress will continue running commands.

Because this error occurred during a before each hook we are skipping the remaining tests in the current suite: Agent List
export const login = (isAdminUser: boolean = false) => {
    cy.visit('http://localhost:4200/');
    cy.origin('https://login.example.com', () => {

Desired behavior

cy.origin should redirect to the url

Test code to reproduce

export const login = (isAdminUser: boolean = false) => {
    cy.visit('http://localhost:4200/');
    cy.origin('https://login.example.com', () => {

Cypress Version

13.5.1

Node version

16.20.2

Operating System

macOS 14.1.1

Debug Logs

No response

Other

There is no debug log to share as there is no error that is being seen. The only thing in my environment that changed is that macOS got updated

sufian1985 avatar Nov 22 '23 04:11 sufian1985

I have noticed the same behavior on our CI.

The difference between success and fail is an update from chrome 118 to 119. After installing Chrome 119 local I was able to reproduce this behavior. For now I'm going to just downgrade my CI's chrome to 118.

Probably new Chrome version is producing different load event behavior or something :thinking:

chris-tier4 avatar Nov 23 '23 03:11 chris-tier4

On my end issue seems to be occurring for electron as well. Electron Version 106

sufian1985 avatar Nov 23 '23 04:11 sufian1985

It worked after I downgraded to chrome 118. Maybe you would need to look into downgrading your electron :eyes:

I'm not sure if this is a bug for Cypress or Chrome/Chromium but hopefully there will be a fix :pray:

chris-tier4 avatar Nov 23 '23 05:11 chris-tier4

It seems that cypress is removing the origin from the request and even putting it back with intercept no longer works in Chrome 119. People in managed corporate environments can't control their Chrome version.

Amy-B-Tradition avatar Dec 05 '23 19:12 Amy-B-Tradition

We'll need a piece of code we can run in order to investigate. Otherwise we can't look into what is going wrong in this situation. Can anyone provide an example we can fully run?

jennifer-shehane avatar Dec 29 '23 18:12 jennifer-shehane

export const login = () => {
  cy.visit('http://localhost:4200/');
  cy.origin('https://qa-login.example.com', () => {
    cy.get('#email').type(Cypress.env('APP_LOGIN_USER'));
    cy.get('#password').type(Cypress.env('APP_LOGIN_PASS'));
    cy.get('#submit-button').click();
  });
};

This is the shared login function we have which fails to call cy.origin

sufian1985 avatar Dec 30 '23 12:12 sufian1985

@sufian1985 I wonder if visiting an https url on the visit might help? We've been having some issues crop up with http -> https upgrades since Chrome changed their logic around upgrade in more recent versions.

jennifer-shehane avatar Jan 05 '24 14:01 jennifer-shehane

Did try it. It does not help.

sufian1985 avatar Jan 10 '24 08:01 sufian1985

Hey, Did you mange to solved this?

idanElitzur avatar Mar 25 '24 20:03 idanElitzur

Nope...still facing this issue

sufian1985 avatar Mar 25 '24 21:03 sufian1985

I'm having the same issue. The test runs fine locally but in GitHub's CI, the page waits for Page Load then errors out after clicking "Next" in Google Authenticator after inputting the email address. image image

harryeastwood avatar May 09 '24 14:05 harryeastwood

For me issue was macOS Private relay. Disabling it in my iCloud settings seems to have resolved my issues. Coincidently I found the fox by accident yesterday

sufian1985 avatar May 09 '24 15:05 sufian1985