-
Notifications
You must be signed in to change notification settings - Fork 16
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
add ui test coverage for the survey banner #1648
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5a1c1d2
fix survey banner and sharing explainer
Tbaut 8f54864
fix case where localstore is empty
Tbaut ae56b97
fix conflicts and merge dev
Tbaut bf0efa3
add init for the 404
Tbaut 2a7eea0
Merge branch 'dev' into fix/tbaut-localStore-1617
Tbaut e3ae74a
Add new identifiers for survey banner
asnaith 5a935b7
add survey banner tests (wip)
asnaith 41ec529
refine survey banner tests to cater for all scenarios
asnaith 8fd2144
Merge branch 'dev' into mnt/add-tests-for-survey-banner
asnaith 4722547
move test data to test fixture
asnaith 113c02f
Merge branch 'dev' into mnt/add-tests-for-survey-banner
FSM1 4ec7804
lingui extract
actions-user df1e629
minor update to test name
asnaith ce4b3a4
Merge branch 'dev' into mnt/add-tests-for-survey-banner
FSM1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const folderName = "Group" | ||
export const folderPath = `/${folderName}` | ||
export const folderPath = `/${folderName}` | ||
export const profileCreatedDate = "2021-05-20T21:26:36.598924Z" |
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,72 @@ | ||
import { profileCreatedDate } from "../fixtures/filesTestData" | ||
import { homePage } from "../support/page-objects/homePage" | ||
|
||
describe("Survey Banner", () => { | ||
|
||
context("desktop", () => { | ||
|
||
it("User can view and dismiss the survey banner", () => { | ||
// intercept and stub the account creation date to be > 7 days | ||
cy.intercept("GET", "https://stage.imploy.site/api/v1/user/profile", (req) => { | ||
req.on("response", (res) => { | ||
res.body.created_at = profileCreatedDate | ||
}) | ||
}) | ||
|
||
// intercept and stub the response to ensure the banner is displayed | ||
cy.intercept("GET", "https://stage.imploy.site/api/v1/user/store", { | ||
body: [{ "csf.dismissedSurveyBannerV3": "false" }] | ||
}) | ||
|
||
cy.web3Login() | ||
homePage.surveyBanner().should("be.visible") | ||
|
||
// set up a spy for the POST response | ||
cy.intercept("POST", "https://stage.imploy.site/api/v1/user/store").as("storePost").then(() => { | ||
|
||
// dismiss the survey banner | ||
homePage.closeBannerButton().click() | ||
homePage.surveyBanner().should("not.exist") | ||
|
||
// intercept POST to ensure the key was updated after the banner is dismissed | ||
cy.wait("@storePost").its("request.body").should("contain", { | ||
"csf.dismissedSurveyBannerV3": "true" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, this will break as soon as we change the version. We should find a way to assert that |
||
}) | ||
}) | ||
}) | ||
|
||
it("User should not see the survey banner if previously dismissed", () => { | ||
cy.intercept("GET", "https://stage.imploy.site/api/v1/user/store", { | ||
body: [{ "csf.dismissedSurveyBannerV3": "true" }] | ||
}) | ||
|
||
cy.web3Login() | ||
homePage.surveyBanner().should("not.exist") | ||
}) | ||
|
||
it("User should see banner if account age is greater than 7 days and api response is empty", () => { | ||
cy.intercept("GET", "https://stage.imploy.site/api/v1/user/store", { | ||
body: [{}] | ||
}) | ||
|
||
cy.web3Login() | ||
homePage.surveyBanner().should("be.visible") | ||
}) | ||
|
||
it("User should not see banner if account age is less than 7 days and api response is empty", () => { | ||
// intercept and stub the account creation date to make it less than 7 days | ||
cy.intercept("GET", "https://stage.imploy.site/api/v1/user/profile", (req) => { | ||
req.on("response", (res) => { | ||
res.body.created_at = res.body.updated_at | ||
}) | ||
}) | ||
|
||
cy.intercept("GET", "https://stage.imploy.site/api/v1/user/store", { | ||
body: [{}] | ||
}) | ||
|
||
cy.web3Login() | ||
homePage.surveyBanner().should("not.exist") | ||
}) | ||
}) | ||
}) |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is not future-proof unfortunately (because of the version). I think we should make sure it answers nothing, an empty object.