Update user-menu.spec.ts - use Cypress Testing Library (#10578)
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
parent
287a3fd0cf
commit
c9599a3ef2
1 changed files with 12 additions and 4 deletions
|
@ -23,11 +23,13 @@ describe("User Menu", () => {
|
||||||
let homeserver: HomeserverInstance;
|
let homeserver: HomeserverInstance;
|
||||||
let user: UserCredentials;
|
let user: UserCredentials;
|
||||||
|
|
||||||
|
const USER_NAME = "Jeff";
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.startHomeserver("default").then((data) => {
|
cy.startHomeserver("default").then((data) => {
|
||||||
homeserver = data;
|
homeserver = data;
|
||||||
|
|
||||||
cy.initTestUser(homeserver, "Jeff").then((credentials) => {
|
cy.initTestUser(homeserver, USER_NAME).then((credentials) => {
|
||||||
user = credentials;
|
user = credentials;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -38,10 +40,16 @@ describe("User Menu", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should contain our name & userId", () => {
|
it("should contain our name & userId", () => {
|
||||||
cy.get('[aria-label="User menu"]').click();
|
cy.findByRole("button", { name: "User menu" }).click();
|
||||||
|
|
||||||
cy.get(".mx_UserMenu_contextMenu").within(() => {
|
cy.get(".mx_UserMenu_contextMenu").within(() => {
|
||||||
cy.get(".mx_UserMenu_contextMenu_displayName").should("contain", "Jeff");
|
cy.get(".mx_UserMenu_contextMenu_displayName").within(() => {
|
||||||
cy.get(".mx_UserMenu_contextMenu_userId").should("contain", user.userId);
|
cy.findByText(USER_NAME).should("exist");
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(".mx_UserMenu_contextMenu_userId").within(() => {
|
||||||
|
cy.findByText(user.userId).should("exist");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue