-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Privacy Center - configure email xor phone to match fulfillm…
…ent functionality (#2539) Co-authored-by: eastandwestwind <[email protected]> Co-authored-by: Neville Samuell <[email protected]>
- Loading branch information
1 parent
370414d
commit 73559d6
Showing
11 changed files
with
82 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,7 @@ describe("Smoke test", () => { | |
cy.visit(PRIVACY_CENTER_URL); | ||
cy.getByTestId("card").contains("Access your data").click(); | ||
cy.getByTestId("privacy-request-form").within(() => { | ||
cy.get("input#name").type("Jenny"); | ||
cy.get("input#email").type("[email protected]"); | ||
|
||
cy.get("input#phone").type("555 867 5309"); | ||
cy.get("button").contains("Continue").click(); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,58 +13,24 @@ describe("Privacy request", () => { | |
).as("postPrivacyRequestVerify"); | ||
}); | ||
|
||
it("can verify phone and navigate to form", () => { | ||
cy.visit("/"); | ||
cy.getByTestId("card").contains("Access your data").click(); | ||
|
||
cy.getByTestId("privacy-request-form").within(() => { | ||
cy.get("input#name").type("Jenny"); | ||
cy.get("input#email").type("[email protected]"); | ||
|
||
cy.get("input#phone").type("555 867 5309"); | ||
cy.get("select[name=phoneCountry]").should("have.value", "US"); | ||
cy.get("input#phone").clear().type("+44 55 8675 3090"); | ||
cy.get("select[name=phoneCountry]").should("have.value", "GB"); | ||
|
||
cy.get("button").contains("Continue").click(); | ||
}); | ||
cy.wait("@postPrivacyRequest").then((interception) => { | ||
expect(interception.request.body[0].identity).to.eql({ | ||
email: "[email protected]", | ||
phone_number: "+445586753090", | ||
}); | ||
}); | ||
|
||
cy.getByTestId("verification-form").within(() => { | ||
cy.get("input").type("112358"); | ||
cy.get("button").contains("Submit code").click(); | ||
}); | ||
cy.wait("@postPrivacyRequestVerify"); | ||
|
||
cy.getByTestId("request-submitted"); | ||
}); | ||
|
||
it("requires valid inputs", () => { | ||
cy.visit("/"); | ||
cy.getByTestId("card").contains("Access your data").click(); | ||
|
||
cy.getByTestId("privacy-request-form").within(() => { | ||
// This block uses `.root()` to keep queries within the form. This is necessary because of | ||
// `.blur()` which triggers input validation. | ||
cy.root().get("input#email").type("invalid email"); | ||
cy.root().get("input#phone").type("123 456 7890 1234567").blur(); | ||
|
||
// test email being typed, continue becoming disabled due to invalid email | ||
cy.root().get("input#email").type("invalid email").blur(); | ||
cy.root().should("contain", "Email is invalid"); | ||
cy.root().should("contain", "Phone is invalid"); | ||
cy.root().get("button").contains("Continue").should("be.disabled"); | ||
cy.root().get("input#email").clear().blur(); | ||
|
||
cy.root().get("input#email").type("[email protected]"); | ||
cy.root().get("input#phone").clear().type("123 456 7890").blur(); | ||
cy.root().get("button").contains("Continue").should("be.enabled"); | ||
|
||
// The phone input is optional (in the default config) so it can be left blank. | ||
cy.root().get("input#phone").clear().blur(); | ||
// test valid email, continue becoming enabled due to valid email | ||
cy.root().get("input#email").type("[email protected]").blur(); | ||
cy.root().get("button").contains("Continue").should("be.enabled"); | ||
cy.root().get("input#email").clear().blur(); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.