Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 256c359

Browse files
authored
Update login.spec.ts - use Cypress Testing Library (#10597)
Signed-off-by: Suguru Hirahara <[email protected]>
1 parent bdd6d8d commit 256c359

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cypress/e2e/login/login.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ describe("Login", () => {
4444
it("logs in with an existing account and lands on the home screen", () => {
4545
cy.injectAxe();
4646

47-
cy.get("#mx_LoginForm_username", { timeout: 15000 }).should("be.visible");
47+
cy.findByRole("textbox", { name: "Username", timeout: 15000 }).should("be.visible");
4848
// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24688
4949
//cy.percySnapshot("Login");
5050
cy.checkA11y();
5151

52-
cy.get(".mx_ServerPicker_change").click();
53-
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(homeserver.baseUrl);
54-
cy.get(".mx_ServerPickerDialog_continue").click();
52+
cy.findByRole("button", { name: "Edit" }).click();
53+
cy.findByRole("textbox", { name: "Other homeserver" }).type(homeserver.baseUrl);
54+
cy.findByRole("button", { name: "Continue" }).click();
5555
// wait for the dialog to go away
5656
cy.get(".mx_ServerPickerDialog").should("not.exist");
5757

58-
cy.get("#mx_LoginForm_username").type(username);
59-
cy.get("#mx_LoginForm_password").type(password);
60-
cy.get(".mx_Login_submit").click();
58+
cy.findByRole("textbox", { name: "Username" }).type(username);
59+
cy.findByPlaceholderText("Password").type(password);
60+
cy.findByRole("button", { name: "Sign in" }).click();
6161

6262
cy.url().should("contain", "/#/home", { timeout: 30000 });
6363
});
@@ -72,13 +72,13 @@ describe("Login", () => {
7272
});
7373

7474
it("should go to login page on logout", () => {
75-
cy.get('[aria-label="User menu"]').click();
75+
cy.findByRole("button", { name: "User menu" }).click();
7676

7777
// give a change for the outstanding requests queue to settle before logging out
7878
cy.wait(2000);
7979

8080
cy.get(".mx_UserMenu_contextMenu").within(() => {
81-
cy.get(".mx_UserMenu_iconSignOut").click();
81+
cy.findByRole("menuitem", { name: "Sign out" }).click();
8282
});
8383

8484
cy.url().should("contain", "/#/login");
@@ -94,13 +94,13 @@ describe("Login", () => {
9494
logout_redirect_url: "/decoder-ring/",
9595
});
9696

97-
cy.get('[aria-label="User menu"]').click();
97+
cy.findByRole("button", { name: "User menu" }).click();
9898

9999
// give a change for the outstanding requests queue to settle before logging out
100100
cy.wait(2000);
101101

102102
cy.get(".mx_UserMenu_contextMenu").within(() => {
103-
cy.get(".mx_UserMenu_iconSignOut").click();
103+
cy.findByRole("menuitem", { name: "Sign out" }).click();
104104
});
105105

106106
cy.url().should("contains", "decoder-ring");

0 commit comments

Comments
 (0)