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

fix: empty state urls in navigation #20948

Merged
merged 3 commits into from
Apr 8, 2022
Merged

fix: empty state urls in navigation #20948

merged 3 commits into from
Apr 8, 2022

Conversation

mr-short
Copy link
Contributor

@mr-short mr-short commented Apr 6, 2022

User facing changelog

n/a

Additional details

This issue occurs during url state changes and Cypress attempts to test the current url, but the state is empty.

How has the user experience changed?

Cypress stops randomly throwing this error and failing tests:
TypeError: Cannot read properties of undefined (reading 'undefined')

PR Tasks

  • Have tests been added/updated?
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@mr-short mr-short requested a review from a team as a code owner April 6, 2022 21:19
@mr-short mr-short requested review from jennifer-shehane and removed request for a team April 6, 2022 21:19
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 6, 2022

Thanks for taking the time to open a PR!

@CLAassistant
Copy link

CLAassistant commented Apr 6, 2022

CLA assistant check
All committers have signed the CLA.

emilyrohrbough
emilyrohrbough previously approved these changes Apr 6, 2022
Copy link
Member

@emilyrohrbough emilyrohrbough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you for the contribution!

@davidmunechika davidmunechika requested a review from tbiethman April 7, 2022 15:36
@@ -25,6 +26,11 @@ export const historyNavigationTriggeredHashChange = (state): boolean => {
}

const urls = state('urls')

if (_.isEmpty(urls)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's explicitly check for a urlPosition value here too before continuing on. Your second spec asserts that it doesn't throw without a value, but the logic that follows isn't very meaningful without one.

@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
None yet
Projects
None yet
5 participants