-
Notifications
You must be signed in to change notification settings - Fork 72
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 various Cypress race conditions in Privacy Center #5040
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Passing run #8636 ↗︎
Details:
Review all test suite changes for PR #5040 ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good - just some clarifying questions
env: { | ||
// race condition sometimes picks up env variable *after* the override, so let's be double sure | ||
FIDES_PRIVACY_CENTER__IS_OVERLAY_ENABLED: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? I can't really find any references for the it()
function...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it
has 3 parameters, the 2nd one is for options. env
is one of the options allowed for setting an environment variable for this test only.
see https://docs.cypress.io/guides/guides/environment-variables#Option-5-Test-Configuration
cy.window(); | ||
cy.window().then((win) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the double .window()
intentional to make this less flakey?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be a copy/pasta issue. I'll double check 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed! Good catch.
// Consent reporting intercept | ||
cy.intercept( | ||
"PATCH", | ||
`${API_URL}/consent-request/consent-request-id/notices-served`, | ||
{ fixture: "consent/notices_served.json" } | ||
).as("patchNoticesServed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
7afa1ce
to
801123b
Compare
Passing run #8637 ↗︎
Details:
Review all test suite changes for PR #5040 ↗︎ |
Description Of Changes
Running Cypress locally has caused some level of developer frustration. Some tests require messing with environment variables to get them to behave like the CI tests, others fail randomly due to race conditions. These fixes help make everything more consistent, and thereby help give more confidence in the tests as we work.
Code Changes
patchNoticesServed
intercept forconsent-i18n.cy.ts
in to thebeforeEach
section to make sure it's ready prior to the test running at all. This was one that was randomly failing.isOverlayEnabled
to be false on a particular consent test that was previously requiring developers to set tofalse
manually before running. No longer need to update.env
to run tests!isOverlayEnabled
to be true on a test that would then fail when trying to update.env
to make the previous test work. This one would also randomly fail without any.env
adjustments due to the runner picking up env variable after the override sometimes.Steps to Confirm
Pre-Merge Checklist
CHANGELOG.md