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

Added FidesUpdating event #4816

Merged
merged 11 commits into from
Apr 21, 2024
Merged

Added FidesUpdating event #4816

merged 11 commits into from
Apr 21, 2024

Conversation

guncha
Copy link
Contributor

@guncha guncha commented Apr 19, 2024

Closes https://ethyca.atlassian.net/browse/PROD-1965

Description Of Changes

Adds a new FidesUpdating even that fires (almost) immediately after the user has updated their consent. This allows page code to react to the change sooner than FidesUpdated as that will potentially make a network request to save the preferences before firing.

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Update CHANGELOG.md

Copy link

vercel bot commented Apr 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Apr 21, 2024 8:05pm

@guncha guncha requested a review from NevilleS April 19, 2024 17:25
Copy link

cypress bot commented Apr 19, 2024

Passing run #7360 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge 6b56d54 into cf3d5fe...
Project: fides Commit: 7b799370af ℹ️
Status: Passed Duration: 00:34 💡
Started: Apr 21, 2024 6:00 PM Ended: Apr 21, 2024 6:00 PM

Review all test suite changes for PR #4816 ↗︎

Copy link
Contributor

@NevilleS NevilleS left a comment

Choose a reason for hiding this comment

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

This looks good, thanks. I tested this out and updated some Cypress tests as well, so I'm pretty confident this is ready to ship.

clients/fides-js/src/lib/preferences.ts Show resolved Hide resolved
Comment on lines +2896 to +2904
// Both FidesUpdating & FidesUpdated should include the fides_string
cy.get("@FidesUpdating")
.should("have.been.calledOnce")
.its("lastCall.args.0.detail.fides_string")
.then((fidesString) => {
const parts = fidesString.split(",");
expect(parts.length).to.eql(2);
expect(parts[1]).to.eql(acceptAllAcString);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I added this test to be sure 👍

Comment on lines +1668 to +1676
cy.get("@FidesUpdating")
// Updating event, when the user rejects all
.should("have.been.calledOnce")
.its("firstCall.args.0.detail.consent")
.should("deep.equal", {
[PRIVACY_NOTICE_KEY_1]: false,
[PRIVACY_NOTICE_KEY_2]: true,
[PRIVACY_NOTICE_KEY_3]: false,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I updated this test (and others) to confirm this event does what we expect

Comment on lines +1744 to +1748
// Toggle the notice, but don't save yet
cy.getByTestId("toggle-Advertising").click();
cy.get("@FidesUIChanged").should("have.been.calledOnce");
cy.get("@FidesUpdating").should("not.have.been.called");
cy.get("@FidesUpdated").should("not.have.been.called");
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this change, but I made this test a bit better.

Copy link
Contributor Author

@guncha guncha left a comment

Choose a reason for hiding this comment

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

Thanks for getting the tests in place 👍

@NevilleS NevilleS merged commit 0d30590 into main Apr 21, 2024
12 checks passed
@NevilleS NevilleS deleted the ga-fides-updating-evt branch April 21, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants