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

Component tests occasionally fail with error "Cannot read properties of undefined" #27101

Closed
marcelwgn opened this issue Jun 21, 2023 · 6 comments

Comments

@marcelwgn
Copy link

Current behavior

Our component tests occasionally fail with the following two stacktraces:

An uncaught error was detected outside of a test:
     TypeError: Cannot read properties of undefined (reading 'prevAttempts')
      at replacePreviousAttemptWith (http://localhost:3002/__cypress/runner/cypress_runner.js:170126:40)
      at Object.onRunnableRun (http://localhost:3002/__cypress/runner/cypress_runner.js:170265:11)
      at $Cypress.action (http://localhost:3002/__cypress/runner/cypress_runner.js:159665:28)
      at Runnable.run (http://localhost:3002/__cypress/runner/cypress_runner.js:168425:13)
      at ../driver/node_modules/mocha/lib/runner.js.Runner.runTest (http://localhost:3002/__cypress/runner/cypress_runner.js:117650:10)
      at http://localhost:3002/__cypress/runner/cypress_runner.js:117776:12
      at next (http://localhost:3002/__cypress/runner/cypress_runner.js:117559:14)
      at http://localhost:3002/__cypress/runner/cypress_runner.js:117569:7
      at next (http://localhost:3002/__cypress/runner/cypress_runner.js:117471:14)
      at http://localhost:3002/__cypress/runner/cypress_runner.js:117537:5
      at timeslice (http://localhost:3002/__cypress/runner/cypress_runner.js:111463:27)

and

Cannot read properties of undefined (reading 'get')
at isElement (http://localhost:3002/__cypress/runner/cypress_runner.js:164045:38) at validateType (http://localhost:3002/__cypress/runner/cypress_runner.js:163889:14) at Object.isType (http://localhost:3002/__cypress/runner/cypress_runner.js:163920:7) at $Cy.pushSubject (http://localhost:3002/__cypress/runner/cypress_runner.js:163628:22) at wrapped (http://localhost:3002/__cypress/runner/cypress_runner.js:163214:19) at <unknown> (http://localhost:3002/__cypress/runner/cypress_runner.js:162041:15) at tryCatcher (http://localhost:3002/__cypress/runner/cypress_runner.js:20941:23) at Promise._settlePromiseFromHandler (http://localhost:3002/__cypress/runner/cypress_runner.js:18876:31) at Promise._settlePromise (http://localhost:3002/__cypress/runner/cypress_runner.js:18933:18) at Promise._settlePromiseCtx (http://localhost:3002/__cypress/runner/cypress_runner.js:18970:10) at _drainQueueStep (http://localhost:3002/__cypress/runner/cypress_runner.js:15652:12) at _drainQueue (http://localhost:3002/__cypress/runner/cypress_runner.js:15641:9) at ../../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://localhost:3002/__cypress/runner/cypress_runner.js:15657:5) at Async.drainQueues (http://localhost:3002/__cypress/runner/cypress_runner.js:15527:14)

Desired behavior

Tests should not occasionally crash due to outside of tests that doen't seem to originate from our code (at least looking at the stacktrace).

Test code to reproduce

So far we haven't found a reliable way to reproduce this, locally test runs are mostly fine. Running in GitHub Actions, error rate seems to be around 50%.

Cypress Version

12.15.0

Node version

20.2.0 locally, v16.16.0 in GitHub Actions

Operating System

10.0.22621.1848 locally, 22.04.2 in GitHub Actions

Debug Logs

No response

Other

This issue seemed to be fixed by downgrading our vite version from 4.3.9 to 4.1.1 seemed to have fixed this issue for us.

@mike-plummer mike-plummer self-assigned this Jun 21, 2023
@mike-plummer
Copy link
Contributor

Hi @chingucoding , sorry to hear you're having issues. Are you able to provide us with Debug Logs of a failing run so we can try to diagnose what's going on?

@mike-plummer
Copy link
Contributor

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

@mike-plummer mike-plummer closed this as not planned Won't fix, can't repro, duplicate, stale Jun 30, 2023
@caseycling caseycling reopened this Oct 2, 2023
@marcelwgn
Copy link
Author

Sorry for the completely late reply. It seems our issue somehow didn't occur anymore, however I am able to reproduce this with upgrading cypress to any version after 13.0. The issue only occurs on first runs, the second, third ... run work just fine. The vite version does not seem to matter. I would be able to provide you debug logs, however we would prefer not sharing that publicly depending on the loggers you want to see.

@muratkeremozcan
Copy link

We can consistently reproduce this in our CI.
Locally, all is well.
We are working with the Cy team towards a resolution so Vite works well in CI.

@jennifer-shehane
Copy link
Member

@muratkeremozcan This has the same stack trace in v13? Can someone provide a way to reproduce?

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue CT Issue related to component testing labels Dec 19, 2023
@mike-plummer mike-plummer removed their assignment Feb 26, 2024
@jennifer-shehane
Copy link
Member

We'll have to close this issue since there's no information to reproduce this.

@jennifer-shehane jennifer-shehane closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
@jennifer-shehane jennifer-shehane removed stage: needs information Not enough info to reproduce the issue CT Issue related to component testing labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants