thisdot / open-source

Repository for open source packages
MIT License
34 stars 11 forks source link

An uncaught error was detected outside of a test #156

Closed pfpoujol closed 1 year ago

pfpoujol commented 1 year ago

What package and version are you using?

cypress-indexeddb@1.1.3

What browser are you using?

Chrome

What operating system are you using?

Windows

Actual Behavior

I installed cypress-indexeddb in my project and followed "Installation" step of the README. When I try to run my e2e tests, this is what happens:

Capture d’écran 2023-03-03 104845

CypressError: The following error originated from your test code, not from Cypress.

  > Cannot overwite the `as` query. Queries can only be overwritten with `Cypress.Commands.overwriteQuery()`.

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.
    at setupIDBHelpers (webpack:///./node_modules/@this-dot/cypress-indexeddb/src/lib/cypress-indexeddb.js:10:0)
    at ./node_modules/@this-dot/cypress-indexeddb/src/lib/cypress-indexeddb.js (webpack:///./node_modules/@this-dot/cypress-indexeddb/src/lib/cypress-indexeddb.js:24:0)
    at __webpack_require__ (webpack:///webpack/bootstrap:19:0)
    at ./node_modules/@this-dot/cypress-indexeddb/src/index.js (webpack:///./node_modules/@this-dot/cypress-indexeddb/src/index.js:4:21)
    at __webpack_require__ (webpack:///webpack/bootstrap:19:0)
    at ./cypress/support/commands.ts (webpack:///./cypress/support/commands.ts:1:0)
    at __webpack_require__ (webpack:///webpack/bootstrap:19:0)
    at ./cypress/support/e2e.ts (webpack:///./cypress/support/e2e.ts:17:0)
    at __webpack_require__ (webpack:///webpack/bootstrap:19:0)
    at 0 (http://localhost:8100/__cypress/tests?p=cypress\support\e2e.ts:1277:18)
From previous event:
    at evalScripts (http://localhost:8100/__cypress/runner/cypress_runner.js:158861:58)
    at <unknown> (http://localhost:8100/__cypress/runner/cypress_runner.js:158870:152)
From previous event:
    at runScriptsFromUrls (http://localhost:8100/__cypress/runner/cypress_runner.js:158870:136)
    at Object.runScripts (http://localhost:8100/__cypress/runner/cypress_runner.js:158884:12)
    at $Cypress.onSpecWindow (http://localhost:8100/__cypress/runner/cypress_runner.js:147480:75)

From Cypress Internals:
      at internalError (http://localhost:8100/__cypress/runner/cypress_runner.js:150306:99)
      at Object.overwrite (http://localhost:8100/__cypress/runner/cypress_runner.js:150390:11)
      at <unknown> (http://localhost:8100/__cypress/runner/cypress_runner.js:158866:23)
      at tryCatcher (http://localhost:8100/__cypress/runner/cypress_runner.js:8914:23)
      at Object.gotValue (http://localhost:8100/__cypress/runner/cypress_runner.js:8056:18)
      at Object.gotAccum (http://localhost:8100/__cypress/runner/cypress_runner.js:8045:25)
      at Object.tryCatcher (http://localhost:8100/__cypress/runner/cypress_runner.js:8914:23)
      at Promise._settlePromiseFromHandler (http://localhost:8100/__cypress/runner/cypress_runner.js:6849:31)
      at Promise._settlePromise (http://localhost:8100/__cypress/runner/cypress_runner.js:6906:18)
      at Promise._settlePromiseCtx (http://localhost:8100/__cypress/runner/cypress_runner.js:6943:10)
      at <unknown> (http://localhost:8100/__cypress/runner/cypress_runner.js:3596:20)
logError @ index-857c938c.js:104125
(anonymous) @ index-857c938c.js:110192
emit @ index-857c938c.js:109778
(anonymous) @ cypress_runner.js:178152
emit @ cypress_runner.js:18373
emit @ cypress_runner.js:178214
onPrint @ cypress_runner.js:177059
_onPrintClick @ cypress_runner.js:177063
(anonymous) @ cypress_runner.js:178335
executeAction @ cypress_runner.js:45275
n @ cypress_runner.js:45275
ca @ cypress_runner.js:55921
ja @ cypress_runner.js:55922
ka @ cypress_runner.js:55922
wa @ cypress_runner.js:55924
Aa @ cypress_runner.js:55925
ya @ cypress_runner.js:55925
Da @ cypress_runner.js:55928
Ad @ cypress_runner.js:55991
Gi @ cypress_runner.js:56157
Kb @ cypress_runner.js:55946
Dd @ cypress_runner.js:55993
(anonymous) @ cypress_runner.js:56158
../../node_modules/scheduler/cjs/scheduler.production.min.js.exports.unstable_runWithPriority @ cypress_runner.js:59684
Ii @ cypress_runner.js:56158
Cd @ cypress_runner.js:55992

Expected Behavior

I should see the results of my tests.

Reproduction

Additional Information

No response

TapaiBalazs commented 1 year ago

Thank you for the report @pfpoujol, we will look into it.

Could you please provide more information on what cypress version do you use? Can you reproduce the issue if you install an earlier cypress version?

Thanks in advance

pfpoujol commented 1 year ago

Hello @TapaiBalazs i use the latest version of cypress (v12.7.0).

I just tried with v11.2.0, no issue with this version.

TapaiBalazs commented 1 year ago

@pfpoujol thank you for confirming. I believe there was a breaking change in the latest cypress version that no longer allows to overwrite the .as() method.

We will look into this more when we will have some capacity. During that time you might be able to use the package with an older version of cypress as a workaround.

TapaiBalazs commented 1 year ago

Yes, as it seems our package got broken with v12.0.0, and they introduced a method to fix it in 12.6.0: https://docs.cypress.io/guides/references/changelog#12-6-0

Now, we cannot override .as() with .override, but we need to change our implementation to .overwriteQuery().

dominics commented 1 year ago

Just for clarity: the package was actually broken earlier, at v12.0.0 (you have to go back to v11.x atm) - it just can't be fixed until v12.6.0

Edit: but, haha, we knew that already, and the docs update is underway (nice!, that's what I was looking for): https://github.com/thisdot/open-source/pull/155/commits/38e83dc9911bc1243251a90a95127583f722490b#diff-7931dcd2c0a27342acc41de5028b415b1c9bec6171915165abc39c36e2cdc3f7R40

Thank you for the fix!

TapaiBalazs commented 1 year ago

Dear @pfpoujol, @dominics,

Thank you for your patience, @this-dot/cypress-indexeddb@2.0.0 is now released and it should work with cypress versions 12.6.0 or above.

This issue will be closed automatically soon.