-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ui test coverage for the sharing explainer (#1659)
* update nav identifiers * add header button identifiers * add identifiers for sharing explainer * fix mistake in identifiers * add spec file for sharing explainer tests * Apply suggestions from code review Co-authored-by: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> * Update test spec after pr feedback * lingui extract Co-authored-by: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Co-authored-by: GitHub Actions <actions@github.com>
- Loading branch information
1 parent
9e06503
commit ea9cc10
Showing
7 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/files-ui/cypress/support/page-objects/modals/sharingExplainerModal.ts
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const sharingExplainerModal = { | ||
body: () => cy.get("[data-testId=modal-container-sharing-explainer]"), | ||
gotItButton: () => cy.get("[data-cy=button-got-it]"), | ||
nextButton: () => cy.get("[data-cy=button-next]") | ||
} |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { navigationMenu } from "../support/page-objects/navigationMenu" | ||
import { sharingExplainerModal } from "../support/page-objects/modals/sharingExplainerModal" | ||
|
||
describe("Sharing Explainer", () => { | ||
|
||
context("desktop", () => { | ||
|
||
const sharingKey = "csf.dismissedSharingExplainer" | ||
|
||
it("User can view and dismiss the sharing explainer", () => { | ||
// intercept and stub the response to ensure the explainer is displayed | ||
cy.intercept("GET", "**/user/store", { | ||
body: { [sharingKey]: "false" } | ||
}) | ||
|
||
cy.web3Login() | ||
navigationMenu.sharedNavButton().click() | ||
sharingExplainerModal.body().should("be.visible") | ||
|
||
// set up a spy for the POST response | ||
cy.intercept("POST", "**/user/store").as("storePost").then(() => { | ||
|
||
// dismiss the sharing explainer | ||
sharingExplainerModal.nextButton().click() | ||
sharingExplainerModal.nextButton().click() | ||
sharingExplainerModal.gotItButton().click() | ||
sharingExplainerModal.body().should("not.exist") | ||
|
||
// intercept POST to ensure the key was updated after the explainer is dismissed | ||
cy.wait("@storePost").its("request.body").should("contain", { | ||
[sharingKey]: "true" | ||
}) | ||
}) | ||
}) | ||
|
||
it("User should not see sharing explainer if previously dismissed", () => { | ||
cy.intercept("GET", "**/user/store", { | ||
body: { [sharingKey]: "true" } | ||
}) | ||
|
||
cy.web3Login() | ||
|
||
navigationMenu.sharedNavButton().click() | ||
sharingExplainerModal.body().should("not.exist") | ||
}) | ||
|
||
it("User should see the sharing explainer if api response is empty", () => { | ||
cy.intercept("GET", "**/user/store", { | ||
body: {} | ||
}) | ||
|
||
cy.web3Login() | ||
navigationMenu.sharedNavButton().click() | ||
sharingExplainerModal.body().should("be.visible") | ||
}) | ||
}) | ||
}) |
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