-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1529 from IntersectMBO/feat/user-snap
Feat/user-snap
- Loading branch information
Showing
3 changed files
with
160 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { | ||
DELEGATION_DOC_URL, | ||
DIRECT_VOTER_DOC_URL, | ||
REGISTER_DREP_DOC_URL, | ||
GOVERNANCE_ACTION_DOC_URL, | ||
PROPOSE_GOVERNANCE_ACTION_DOC_URL, | ||
FAQS_DOC_URL, | ||
GUIDES_DOC_URL, | ||
HELP_DOC_URL, | ||
PRIVACY_POLICY, | ||
REGISTER_DREP_DOC_URL, | ||
TERMS_AND_CONDITIONS, | ||
} from "@constants/docsUrl"; | ||
import { faker } from "@faker-js/faker"; | ||
import { test } from "@fixtures/walletExtension"; | ||
import { setAllureEpic } from "@helpers/allure"; | ||
import { isMobile, openDrawer } from "@helpers/mobile"; | ||
|
@@ -77,3 +79,155 @@ test("6D. Should open Sanchonet docs in a new tab when clicking `Learn More` on | |
]); | ||
await expect(directVoterLearnMorepage).toHaveURL(DIRECT_VOTER_DOC_URL); | ||
}); | ||
|
||
test("6M. Should navigate between footer links", async ({ page, context }) => { | ||
await page.goto("/"); | ||
|
||
const [privacyPolicy] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
page.getByTestId("privacy-policy-footer-link").click(), | ||
]); | ||
await expect(privacyPolicy).toHaveURL(PRIVACY_POLICY); | ||
|
||
const [termsAndConditions] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
page.getByTestId("term-of-service-footer-link").click(), | ||
]); | ||
await expect(termsAndConditions).toHaveURL(TERMS_AND_CONDITIONS); | ||
|
||
const [helpUrl] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
page.getByTestId("help-footer-button").click(), | ||
]); | ||
await expect(helpUrl).toHaveURL(HELP_DOC_URL); | ||
}); | ||
|
||
test.describe("User Snap", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
await page.waitForTimeout(2_000); // wait until page load properly | ||
|
||
await page.getByTestId("feedback-footer-button").click(); | ||
}); | ||
|
||
test("6N. Should open feedback modal", async ({ page }) => { | ||
await expect(page.getByLabel("Usersnap widget")).toBeVisible(); | ||
await expect( | ||
page.getByRole("button", { | ||
name: "Report an issue Something", | ||
}) | ||
).toBeVisible(); | ||
await expect( | ||
page.getByRole("button", { | ||
name: "Idea or new feature Let us", | ||
}) | ||
).toBeVisible(); | ||
}); | ||
|
||
test("6O. Should verify a bug report form", async ({ page }) => { | ||
await page | ||
.getByRole("button", { | ||
name: "Report an issue Something", | ||
}) | ||
.click(); | ||
|
||
await expect( | ||
page.getByRole("heading", { name: "Report a bug" }) | ||
).toBeVisible(); | ||
await expect(page.getByPlaceholder("Your feedback")).toBeVisible(); | ||
await expect(page.getByText("Drag & drop or Browse")).toBeVisible(); | ||
await expect(page.getByPlaceholder("[email protected]")).toBeVisible(); | ||
await expect(page.getByLabel("Take screenshot")).toBeVisible(); | ||
await expect(page.getByLabel("Record")).toBeVisible(); | ||
await expect(page.getByRole("button", { name: "Submit" })).toBeVisible(); | ||
}); | ||
|
||
test("6P. Should verify feature form", async ({ page }) => { | ||
await page | ||
.getByRole("button", { | ||
name: "Idea or new feature Let us", | ||
}) | ||
.click(); | ||
|
||
await expect( | ||
page.getByRole("heading", { name: "Idea or new feature" }) | ||
).toBeVisible(); | ||
await expect( | ||
page.getByPlaceholder("Example: New navigation") | ||
).toBeVisible(); | ||
await expect(page.getByLabel("Any additional details")).toBeVisible(); | ||
await expect(page.getByLabel("Any additional details")).toBeVisible(); | ||
await expect(page.getByText("Drag & drop or Browse")).toBeVisible(); | ||
await expect(page.getByPlaceholder("[email protected]")).toBeVisible(); | ||
await expect(page.getByLabel("Take screenshot")).toBeVisible(); | ||
await expect(page.getByLabel("Record")).toBeVisible(); | ||
await expect(page.getByRole("button", { name: "Submit" })).toBeVisible(); | ||
}); | ||
|
||
test.describe("Feedback Tests", () => { | ||
const attachmentInputSelector = "input[type=file]"; | ||
const feedbackApiUrl = | ||
"https://widget.usersnap.com/api/widget/xhrrpc?submit_feedback"; | ||
const mockAttachmentPath = "./lib/_mock/mockAttachment.png"; | ||
|
||
test("6Q. Should report an issue", async ({ page }) => { | ||
// Intercept Usersnap submit API | ||
await page.route(feedbackApiUrl, async (route) => | ||
route.fulfill({ | ||
status: 200, | ||
}) | ||
); | ||
|
||
await page | ||
.getByRole("button", { | ||
name: "Report an issue Something", | ||
}) | ||
.click(); | ||
|
||
await page | ||
.getByPlaceholder("Your feedback") | ||
.fill(faker.lorem.paragraph(2)); | ||
await page.setInputFiles(attachmentInputSelector, [mockAttachmentPath]); | ||
await page | ||
.getByPlaceholder("[email protected]") | ||
.fill(faker.internet.email()); | ||
|
||
await page.getByRole("button", { name: "Submit" }).click(); | ||
|
||
await expect(page.getByText("Feedback was not submitted,")).toBeVisible(); | ||
}); | ||
|
||
test("6R. Should submit an idea or new feature", async ({ page }) => { | ||
// Intercept Usersnap submit API | ||
await page.route(feedbackApiUrl, async (route) => | ||
route.fulfill({ | ||
status: 200, | ||
}) | ||
); | ||
|
||
await page | ||
.getByRole("button", { | ||
name: "Idea or new feature Let us", | ||
}) | ||
.click(); | ||
|
||
await page | ||
.getByPlaceholder("Example: New navigation") | ||
.fill(faker.lorem.words(4)); | ||
await page | ||
.getByLabel("Please summarize your idea or") | ||
.fill(faker.lorem.paragraph(2)); | ||
await page | ||
.getByLabel("Any additional details") | ||
.fill(faker.lorem.paragraph(2)); | ||
await page.setInputFiles(attachmentInputSelector, [mockAttachmentPath]); | ||
await page | ||
.getByPlaceholder("[email protected]") | ||
.fill(faker.internet.email()); | ||
|
||
await page.getByRole("button", { name: "Submit" }).click(); | ||
|
||
await expect(page.getByText("Feedback was not submitted,")).toBeVisible(); | ||
}); | ||
}); | ||
}); |