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

Cypress.io 3.1.3 breaks by legacy jQuery library #2927

Closed
kdeng opened this issue Dec 11, 2018 · 21 comments
Closed

Cypress.io 3.1.3 breaks by legacy jQuery library #2927

kdeng opened this issue Dec 11, 2018 · 21 comments
Assignees

Comments

@kdeng
Copy link

@kdeng kdeng commented Dec 11, 2018

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

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Dec 11, 2018

@kdeng What version of jQuery is the page using?

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

@kdeng
Copy link
Author

@kdeng kdeng commented Dec 11, 2018

@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.

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Dec 12, 2018

The repo errors for me during npm run build

 npm run build

> cypress-bug@1.0.0 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>
@kdeng
Copy link
Author

@kdeng kdeng commented Dec 12, 2018

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

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Dec 12, 2018

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.

@kdeng
Copy link
Author

@kdeng kdeng commented Dec 13, 2018

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

@kdeng
Copy link
Author

@kdeng kdeng commented Dec 13, 2018

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

@DimitrK
Copy link

@DimitrK DimitrK commented Dec 18, 2018

Same problem here with 3.1.3

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Jan 8, 2019

I've opened a PR to hopefully fix this issue if anyone wants to check against this local branch. Needs tests. #3084

@kdeng
Copy link
Author

@kdeng kdeng commented Jan 9, 2019

@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.

@farzadso
Copy link

@farzadso farzadso commented Feb 13, 2019

do we have any updates on this?

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Feb 13, 2019

@DimitrK
Copy link

@DimitrK DimitrK commented Feb 13, 2019

I am still getting this error on 3.1.5

@farzadso
Copy link

@farzadso farzadso commented Feb 14, 2019

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

@farzadso
Copy link

@farzadso farzadso commented Feb 14, 2019

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

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Feb 14, 2019

This issue should be fixed in 3.1.6

@farzadso
Copy link

@farzadso farzadso commented Feb 14, 2019

Thanks @jennifer-shehane
When will it be released?

@nelsonomuto
Copy link

@nelsonomuto nelsonomuto commented Feb 25, 2019

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

@farzadso
Copy link

@farzadso farzadso commented Feb 26, 2019

Does the team have a definite release date for 3.1.6?

@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented Mar 15, 2019

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.

@cypress-bot
Copy link

@cypress-bot cypress-bot bot commented Mar 15, 2019

Released in 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants