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:
Suguru Hirahara 2023-04-12 12:56:34 +00:00 committed by GitHub
parent 287a3fd0cf
commit c9599a3ef2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,11 +23,13 @@ describe("User Menu", () => {
let homeserver: HomeserverInstance;
let user: UserCredentials;
const USER_NAME = "Jeff";
beforeEach(() => {
cy.startHomeserver("default").then((data) => {
homeserver = data;
cy.initTestUser(homeserver, "Jeff").then((credentials) => {
cy.initTestUser(homeserver, USER_NAME).then((credentials) => {
user = credentials;
});
});
@ -38,10 +40,16 @@ describe("User Menu", () => {
});
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_displayName").should("contain", "Jeff");
cy.get(".mx_UserMenu_contextMenu_userId").should("contain", user.userId);
cy.get(".mx_UserMenu_contextMenu_displayName").within(() => {
cy.findByText(USER_NAME).should("exist");
});
cy.get(".mx_UserMenu_contextMenu_userId").within(() => {
cy.findByText(user.userId).should("exist");
});
});
});
});