Skip to content

chore: update win.cookie calls to win.document.cookie call in test #31527

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

Merged
merged 1 commit into from
Apr 18, 2025

Conversation

jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Apr 16, 2025

Additional details

Remove ts-expect-error where we were calling win.cookie instead of win.document.cookie.

win.cookie does not exist, but the test was calling and testing this. I updated it to win.document.cookie

Steps to test

  • driver tests - sessions.cy.ts

How has the user experience changed?

N/A

PR Tasks

@jennifer-shehane jennifer-shehane self-assigned this Apr 16, 2025
Copy link

cypress bot commented Apr 16, 2025

cypress    Run #61692

Run Properties:  status check passed Passed #61692  •  git commit 38274e8809: chore: update win.cookie calls to win.document.cookie call in test
Project cypress
Branch Review fix-win-cookie-in-tests
Run status status check passed Passed #61692
Run duration 18m 24s
Commit git commit 38274e8809: chore: update win.cookie calls to win.document.cookie call in test
Committer Jennifer Shehane
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 77
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 5624
View all changes introduced in this branch ↗︎

Warning

No Report: Something went wrong and we could not generate a report for the Application Quality products.

return !cookie || cookie === '__cypress.initial=true'
})

win.document.cookie = 'key=value'
Copy link
Member Author

@jennifer-shehane jennifer-shehane Apr 17, 2025

Choose a reason for hiding this comment

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

This test doesn't pass if you pass the SameSite=Strict; Secure; Path=/fixtures to this cookie. I'm not sure if this is some kind of bug, but that's the only way to get it to pass atm.

Copy link
Contributor

Choose a reason for hiding this comment

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

something like this though I think fundamentally changes the test. I can look at it tomorrow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it wasn’t really testing anything to begin with. :/

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah win.cookie really isn't anything 😂 . Even if it was document.cookie that wouldn't even be set in the first place because its not even at that path, so it will not set it and no-op. I think this change is fine.

return !cookie || cookie === '__cypress.initial=true'
})

win.document.cookie = 'key=value'
Copy link
Contributor

Choose a reason for hiding this comment

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

something like this though I think fundamentally changes the test. I can look at it tomorrow?

return !cookie || cookie === '__cypress.initial=true'
})

win.document.cookie = 'key=value'
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah win.cookie really isn't anything 😂 . Even if it was document.cookie that wouldn't even be set in the first place because its not even at that path, so it will not set it and no-op. I think this change is fine.

@jennifer-shehane jennifer-shehane merged commit 9f9b665 into develop Apr 18, 2025
93 of 95 checks passed
@jennifer-shehane jennifer-shehane deleted the fix-win-cookie-in-tests branch April 18, 2025 16:46
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 22, 2025

Released in 14.3.2.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants