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

undefined (reading 'undefined') on cypress_runner.js #19749

Closed
thedoublejay opened this issue Jan 19, 2022 · 11 comments · Fixed by #20948
Closed

undefined (reading 'undefined') on cypress_runner.js #19749

thedoublejay opened this issue Jan 19, 2022 · 11 comments · Fixed by #20948
Labels
type: bug type: regression A bug that didn't appear until a specific Cy version release

Comments

@thedoublejay
Copy link

Current behavior

When running on cypress@9.3.1, there is an issue on cypress_runner.js - Cannot read properties of undefined (reading 'undefined'). It happens on

const currentUrl = $Location.create(urls[urlPosition])

image

This error usually happens on cy.go('back'). Failing tests on Cypress dashboard - https://dashboard.cypress.io/projects/oqk3fk/runs/4680/overview

Desired behavior

No undefined error messages

Test code to reproduce

it('should return to previous page', function () {
cy.go('back')
})

Cypress Version

9.3.1

Other

No response

@jennifer-shehane
Copy link
Member

@thedoublejay

  • What version of Chrome are you using?
  • Does this work in Cypress 9.1.1?

I do see some changes around this code that was released in 9.2.0: ec84f66

@jennifer-shehane jennifer-shehane added stage: awaiting response Potential fix was proposed; awaiting response stage: needs information Not enough info to reproduce the issue labels Jan 19, 2022
@tbiethman
Copy link
Contributor

@jennifer-shehane I am able to reproduce this back to 9.2.0 in both Electron and Chrome. 9.1.1 does not show this specific issue.

Still investigating, but we either need more checks around this logic or need to be more selective on when we execute it.

@tbiethman tbiethman added stage: investigating Someone from Cypress is looking into this and removed stage: needs information Not enough info to reproduce the issue stage: awaiting response Potential fix was proposed; awaiting response labels Jan 19, 2022
@thedoublejay
Copy link
Author

@jennifer-shehane Yes it was working with 9.1.1. It was also working for 9.2.0 for us (Chrome 96). Our current Chrome version is Chrome 97.

@tbiethman tbiethman added stage: ready for work The issue is reproducible and in scope type: bug and removed stage: investigating Someone from Cypress is looking into this labels Jan 28, 2022
@Hypercubed
Copy link

@thedoublejay Thank you for posting this... helped me narrow down an issue that was really bothering us. For Cypress team I'd like to point out that this error includes the message "The following error originated from your application code, not from Cypress." which really lead us astray!!

@raulfdm
Copy link

raulfdm commented Jan 31, 2022

For the record, I'm having the exact same issue with cy.go('back') after upgrading from 9.1.1 to 9.3.1.

We have a test that navigate between 2 pages and we assert about keeping some query params in the URL after cy.go('back').

After upgrade cypress this test stoped working. go back seems not working well, sometimes it throws this error, sometimes it does not go back, and rarely it works as it should.

My workaround would be navigating back twice (cy.go('back'); cy.go('back');) to ensure that at least we can navigate back and suppress this exact error message.

@crappylime
Copy link

We also have the same issue with cy.go('back') in versions 9.2.0 - 9.4.1.
It works in 9.1.1 (Chrome 98) and older versions.

@sKavanaghV
Copy link

Seeing the same at Cypress 9.2.0 w/ Chrome 98

@sainthkh
Copy link
Contributor

I tried to reproduce the problem with the code below, but failed:

it('should return to previous page', function () {
  cy.visit('https://example.cypress.io')
  cy.contains('Querying').click({ force: true })
  cy.go('back')
})

@emilyrohrbough
Copy link
Member

emilyrohrbough commented Apr 6, 2022

We have a test that navigate between 2 pages and we assert about keeping some query params in the URL after cy.go('back').

After upgrade cypress this test stoped working. go back seems not working well, sometimes it throws this error, sometimes it does not go back, and rarely it works as it should.

It sounds like the behavior you are describing is a bit unrelated to the original issue. @mr-short put #20948 out to fix the error reported. If this change doesn't resolve your issues, can you open a new issue with a reproducible example we can use to narrow down the issue you are seeing?

@cypress-bot cypress-bot bot added stage: pending release and removed stage: ready for work The issue is reproducible and in scope labels Apr 8, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 8, 2022

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

@emilyrohrbough emilyrohrbough added the type: regression A bug that didn't appear until a specific Cy version release label Apr 11, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 11, 2022

Released in 9.5.4.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.5.4, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug type: regression A bug that didn't appear until a specific Cy version release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants