Cypress: Cypress.io 3.1.3 breaks by legacy jQuery library

Created on 11 Dec 2018  Â·  21Comments  Â·  Source: cypress-io/cypress

When testing a web page with old version jQuery, Cypress.io 3.1.3 breaks, and complain a TypeError as below.

cypress-error

The trackingstack is here.

cypress_runner.js:160760 TypeError: item.first is not a function
    at Object.unwrapFirst (http://localhost:9090/__cypress/runner/cypress_runner.js:62996:19)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:58725:29
From previous event:
    at runCommand (http://localhost:9090/__cypress/runner/cypress_runner.js:58722:8)
    at next (http://localhost:9090/__cypress/runner/cypress_runner.js:58767:14)
From previous event:
    at http://localhost:9090/__cypress/runner/cypress_runner.js:58786:37
From previous event:
    at run (http://localhost:9090/__cypress/runner/cypress_runner.js:58784:15)
    at Object.cy.(anonymous function) [as visit] (http://localhost:9090/__cypress/runner/cypress_runner.js:59012:11)
    at Context.runnable.fn (http://localhost:9090/__cypress/runner/cypress_runner.js:59142:20)
    at callFn (http://localhost:9090/__cypress/runner/cypress_runner.js:27558:21)
    at Test.Runnable.run (http://localhost:9090/__cypress/runner/cypress_runner.js:27551:7)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:62062:28
From previous event:
    at Object.onRunnableRun (http://localhost:9090/__cypress/runner/cypress_runner.js:62057:20)
    at $Cypress.action (http://localhost:9090/__cypress/runner/cypress_runner.js:57439:51)
    at Test.Runnable.run (http://localhost:9090/__cypress/runner/cypress_runner.js:61123:20)
    at Runner.runTest (http://localhost:9090/__cypress/runner/cypress_runner.js:28021:10)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:28127:12
    at next (http://localhost:9090/__cypress/runner/cypress_runner.js:27941:14)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:27951:7
    at next (http://localhost:9090/__cypress/runner/cypress_runner.js:27883:14)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:27914:7
    at next (http://localhost:9090/__cypress/runner/cypress_runner.js:62027:16)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:62039:11
From previous event:
    at onNext (http://localhost:9090/__cypress/runner/cypress_runner.js:62038:57)
    at done (http://localhost:9090/__cypress/runner/cypress_runner.js:27519:5)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:27563:11
From previous event:
    at callFn (http://localhost:9090/__cypress/runner/cypress_runner.js:27562:10)
    at Hook.Runnable.run (http://localhost:9090/__cypress/runner/cypress_runner.js:27551:7)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:62062:28
From previous event:
    at Object.onRunnableRun (http://localhost:9090/__cypress/runner/cypress_runner.js:62057:20)
    at $Cypress.action (http://localhost:9090/__cypress/runner/cypress_runner.js:57439:51)
    at Hook.Runnable.run (http://localhost:9090/__cypress/runner/cypress_runner.js:61123:20)
    at next (http://localhost:9090/__cypress/runner/cypress_runner.js:27897:10)
    at http://localhost:9090/__cypress/runner/cypress_runner.js:27919:5
    at timeslice (http://localhost:9090/__cypress/runner/cypress_runner.js:23160:27)
logError @ cypress_runner.js:160760
(anonymous) @ cypress_runner.js:160430
emitOne @ cypress_runner.js:126682
emit @ cypress_runner.js:126760
(anonymous) @ cypress_runner.js:116982
emitOne @ cypress_runner.js:126682
emit @ cypress_runner.js:126760
emit @ cypress_runner.js:117011
Test._this._onErrorClick @ cypress_runner.js:118787
(anonymous) @ cypress_runner.js:117133
executeAction @ cypress_runner.js:128987
res @ cypress_runner.js:128978
callCallback @ cypress_runner.js:133056
invokeGuardedCallbackDev @ cypress_runner.js:133106
invokeGuardedCallback @ cypress_runner.js:133159
invokeGuardedCallbackAndCatchFirstError @ cypress_runner.js:133173
executeDispatch @ cypress_runner.js:133504
executeDispatchesInOrder @ cypress_runner.js:133523
executeDispatchesAndRelease @ cypress_runner.js:133624
executeDispatchesAndReleaseTopLevel @ cypress_runner.js:133635
forEachAccumulated @ cypress_runner.js:133605
runEventsInBatch @ cypress_runner.js:133766
runExtractedEventsInBatch @ cypress_runner.js:133775
handleTopLevel @ cypress_runner.js:137768
batchedUpdates$1 @ cypress_runner.js:150409
batchedUpdates @ cypress_runner.js:135100
dispatchEvent @ cypress_runner.js:137847
interactiveUpdates$1 @ cypress_runner.js:150464
interactiveUpdates @ cypress_runner.js:135119
dispatchInteractiveEvent @ cypress_runner.js:137824

But, when I downgrade to version 3.1.2, and all tests work properly with no issues at all.

Could someone please help to have a look at this issue? Thanks

regression

Most helpful comment

Thanks @jennifer-shehane
When will it be released?

All 21 comments

@kdeng What version of jQuery is the page using?

Could you provide a reproducible example for us to run locally?

@jennifer-shehane I have created a demo to reproduce the issue locally. Please checkout the demo from https://github.com/kdeng/cypress-bug-demo. Cheers.

The repo errors for me during npm run build

 npm run build

> [email protected] build /Users/jennifer/Dev/cypress-bug-demo
> rollup --config rollup.config.js

[!] TypeError: eslint is not a function
TypeError: eslint is not a function
    at Object.<anonymous> (/Users/jennifer/Dev/cypress-bug-demo/rollup.config.js:20:3)
    at Module._compile (module.js:573:30)
    at Object.require.extensions..js (/Users/jennifer/Dev/cypress-bug-demo/node_modules/rollup/bin/rollup:1271:24)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at /Users/jennifer/Dev/cypress-bug-demo/node_modules/rollup/bin/rollup:1278:32
    at <anonymous>

@jennifer-shehane Sorry, please try to checkout again. I just fix the issue. Thanks for your time.

I opened a PR against your example to help simplify the problem. There is now just a script including a static JS file.

If I replace the contents of the static header.js file with standard jquery 2.2.4, the test passes - so I'm assuming it is something extra in that file that is causing the test to error.

Yes, the original frontend developer was using rollup to compile js resource (jQuery) with commonjs. So, the static head.min.js is not only containing jQuery, but also common.js module.

I have created another branch develop to include static header.min.js file, which might make more sense to you.

Cheers

The interesting thing is the test works properly if I downgrade to cypress 3.1.2.

Same problem here with 3.1.3

I've opened a PR to hopefully fix this issue if anyone wants to check against this local branch. Needs tests. https://github.com/cypress-io/cypress/pull/3084

@jennifer-shehane How can I properly install your changes on my local environment? I have tried to install by using git+ssh, and hammered with lots of errors during post-install phase. Cheers.

do we have any updates on this?

Have you tried 3.1.5?

Sent from my iPhone

On Feb 13, 2019, at 08:49, Farzad Soltani notifications@github.com wrote:

do we have any updates on this?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

I am still getting this error on 3.1.5

@bahmutov Yes, I installed the latest version initially and ran into this error. Downgrading to 3.1.2 prevented the error from happening

Also, downgrading to 3.1.2 causes my localhost to run into 404 errors when testing, as I have a dynamic route for http://localhost:3000/ANYTHING. using 3.1.5 doesn't have such issues

This issue should be fixed in 3.1.6

Thanks @jennifer-shehane
When will it be released?

I am experiencing this error as well, anxious to get to 3.1.6 @jennifer-shehane

Does the team have a definite release date for 3.1.6?

The code for this is done in cypress-io/cypress#3084, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Released in 3.2.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tahayk picture tahayk  Â·  3Comments

igorpavlov picture igorpavlov  Â·  3Comments

weskor picture weskor  Â·  3Comments

stormherz picture stormherz  Â·  3Comments

EirikBirkeland picture EirikBirkeland  Â·  3Comments