cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.69k stars 3.16k forks source link

Cypress is stalling in particular test endlessly in npx cypress run mode, I can't get any report or time out issue #30097

Open aayazsin opened 3 weeks ago

aayazsin commented 3 weeks ago

Current behavior

When I run the tests in npx cypress run mode, it hangs in the second test case and never terminates the execution. I reproduced the issue on both Jenkins and my PC. The codes are fine, I don't know what is causing the problem. I noticed the address bar was blank too.

image

Desired behavior

It should complete the test execution.

Test code to reproduce

   loginAthena(email, password){
        cy.visit(Cypress.env('host'));
        Wait.waitForPageLoad();
        this.txtEmail.type(email);
        this.txtPassword.type(password);
        this.btnLogin.click();
        Wait.waitForPageLoadBySec(30);
        cy.get('div').then($el => {
            if($el.find('.loginBtn').length > 0) {
                cy.log("===> Retrying...")
                this.btnLogin.click();
            }
        })
        HomePage.captionCarousel.should('exist')
        cy.log("===> Successfully logged in")
        Wait.waitForPageLoadBySec(30);
        cy.wait(3000)
    }

Cypress Version

13.13.1

Node version

14.21.3

Operating System

win 11, jenkins linux 5.3.0

Debug Logs

No response

Other

I reproduced the issue in Cypress open mode on the first try but I overcame the problem by clicking the rerun button. I don't have this option in headless mode.

jennifer-shehane commented 3 weeks ago

@aayazsin Is this a new test you've never run before? Or is this a test that was working and is now hanging? If so, what changed since the time it was working?

aayazsin commented 3 weeks ago

In cypress open mode, the tests are passing, we started to run tests recently on Jenkins so this problem has been present since the first time we ran particular tests in Jenkins.

MikeMcC399 commented 3 weeks ago

@aayazsin You should also make sure that you are running a supported version of Node.js, which means a minimum of 18.x and preferably the LTS version 20.x.

aayazsin commented 3 weeks ago

ok thanks for the info let me try and get back to you...

aayazsin commented 3 weeks ago

@MikeMcC399, @jennifer-shehane, I installed node version v20.17.0 but the issue is still present.

aayazsin commented 2 weeks ago

Hi again, this issue is a blocker for our company, and it isn't feasible to continue with Cypress this way. It would be great if you could suggest a solution to this problem.

jennifer-shehane commented 1 week ago

@aayazsin Can you provide a reproducible example? Also ensure you are meeting our recommended machine/memory requirements to get optimal performance: https://docs.cypress.io/guides/getting-started/installing-cypress#Hardware

aayazsin commented 1 week ago

@jennifer-shehane I don't think so, my pc has an i7 2.20ghz CPU with 64GB memory and Jenkins is running on c5.2xlarge server. Here is a video related to the issue: cypress.zip

jennifer-shehane commented 1 week ago

@aayazsin This is super weird. Could you run Cypress in debug mode mode and print the entire set of logs here?

Ideally having the code to run on our side would allow us to track down what is causing this to get stuck.

aayazsin commented 1 week ago

@jennifer-shehane, here is what I found in the log: image develop-auto-nonprod.com-1725539315338.log