Update tests related to user onboarding - use Cypress Testing Library (#10728)

* Update user-onboarding-old.spec.ts - use Cypress Testing Library

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Update user-onboarding-new.spec.ts - use Cypress Testing Library

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

---------

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
Suguru Hirahara 2023-04-27 17:12:05 +00:00 committed by GitHub
parent 569ef31f9d
commit d1a1506572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -40,7 +40,7 @@ describe("User Onboarding (new user)", () => {
bot1 = _bot1; bot1 = _bot1;
}); });
cy.get(".mx_UserOnboardingPage").should("exist"); cy.get(".mx_UserOnboardingPage").should("exist");
cy.get(".mx_UserOnboardingButton").should("exist"); cy.findByRole("button", { name: "Welcome" }).should("exist");
cy.get(".mx_UserOnboardingList") cy.get(".mx_UserOnboardingList")
.should("exist") .should("exist")
.should(($list) => { .should(($list) => {
@ -57,12 +57,12 @@ describe("User Onboarding (new user)", () => {
it("page is shown and preference exists", () => { it("page is shown and preference exists", () => {
cy.get(".mx_UserOnboardingPage").percySnapshotElement("User onboarding page"); cy.get(".mx_UserOnboardingPage").percySnapshotElement("User onboarding page");
cy.openUserSettings("Preferences"); cy.openUserSettings("Preferences");
cy.contains("Show shortcut to welcome checklist above the room list").should("exist"); cy.findByText("Show shortcut to welcome checklist above the room list").should("exist");
}); });
it("app download dialog", () => { it("app download dialog", () => {
cy.contains(".mx_UserOnboardingTask_action", "Download apps").click(); cy.findByRole("button", { name: "Download apps" }).click();
cy.get("[role=dialog]").contains("#mx_BaseDialog_title", "Download Element").should("exist"); cy.get("[role=dialog]").get("#mx_BaseDialog_title").findByText("Download Element").should("exist");
cy.get("[role=dialog]").percySnapshotElement("App download dialog", { cy.get("[role=dialog]").percySnapshotElement("App download dialog", {
widths: [640], widths: [640],
}); });
@ -72,18 +72,18 @@ describe("User Onboarding (new user)", () => {
cy.get(".mx_ProgressBar") cy.get(".mx_ProgressBar")
.invoke("val") .invoke("val")
.then((oldProgress) => { .then((oldProgress) => {
const findPeopleAction = cy.contains(".mx_UserOnboardingTask_action", "Find friends"); const findPeopleAction = cy.findByRole("button", { name: "Find friends" });
expect(findPeopleAction).to.exist; expect(findPeopleAction).to.exist;
findPeopleAction.click(); findPeopleAction.click();
cy.get(".mx_InviteDialog_editor input").type(bot1.getUserId()); cy.get(".mx_InviteDialog_editor").findByRole("textbox").type(bot1.getUserId());
cy.get(".mx_InviteDialog_buttonAndSpinner").click(); cy.findByRole("button", { name: "Go" }).click();
cy.get(".mx_InviteDialog_buttonAndSpinner").should("not.exist"); cy.get(".mx_InviteDialog_buttonAndSpinner").should("not.exist");
const message = "Hi!"; const message = "Hi!";
cy.get(".mx_SendMessageComposer").type(`${message}!{enter}`); cy.findByRole("textbox", { name: "Send a message…" }).type(`${message}{enter}`);
cy.contains(".mx_MTextBody.mx_EventTile_content", message); cy.get(".mx_MTextBody.mx_EventTile_content").findByText(message);
cy.visit("/#/home"); cy.visit("/#/home");
cy.get(".mx_UserOnboardingPage").should("exist"); cy.get(".mx_UserOnboardingPage").should("exist");
cy.get(".mx_UserOnboardingButton").should("exist"); cy.findByRole("button", { name: "Welcome" }).should("exist");
cy.get(".mx_UserOnboardingList") cy.get(".mx_UserOnboardingList")
.should("exist") .should("exist")
.should(($list) => { .should(($list) => {

View File

@ -44,6 +44,6 @@ describe("User Onboarding (old user)", () => {
cy.get(".mx_UserOnboardingPage").should("not.exist"); cy.get(".mx_UserOnboardingPage").should("not.exist");
cy.get(".mx_UserOnboardingButton").should("not.exist"); cy.get(".mx_UserOnboardingButton").should("not.exist");
cy.openUserSettings("Preferences"); cy.openUserSettings("Preferences");
cy.contains("Show shortcut to welcome page above the room list").should("not.exist"); cy.findByText(/Show shortcut to welcome page above the room list/).should("not.exist");
}); });
}); });