Update room-directory.spec.ts - use Cypress Testing Library (#10596)
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>pull/28217/head
parent
dc4bb237d4
commit
013b7204d3
|
@ -48,15 +48,15 @@ describe("Room Directory", () => {
|
|||
|
||||
// First add a local address `gaming`
|
||||
cy.contains(".mx_SettingsFieldset", "Local Addresses").within(() => {
|
||||
cy.get(".mx_Field input").type("gaming");
|
||||
cy.contains(".mx_AccessibleButton", "Add").click();
|
||||
cy.get(".mx_EditableItem_item").should("contain", "#gaming:localhost");
|
||||
cy.findByRole("textbox").type("gaming");
|
||||
cy.findByRole("button", { name: "Add" }).click();
|
||||
cy.findByText("#gaming:localhost").should("have.class", "mx_EditableItem_item").should("exist");
|
||||
});
|
||||
|
||||
// Publish into the public rooms directory
|
||||
cy.contains(".mx_SettingsFieldset", "Published Addresses").within(() => {
|
||||
cy.get("#canonicalAlias").find(":selected").should("contain", "#gaming:localhost");
|
||||
cy.get(`[aria-label="Publish this room to the public in localhost's room directory?"]`)
|
||||
cy.get("#canonicalAlias").find(":selected").findByText("#gaming:localhost");
|
||||
cy.findByLabelText("Publish this room to the public in localhost's room directory?")
|
||||
.click()
|
||||
.should("have.attr", "aria-checked", "true");
|
||||
});
|
||||
|
@ -81,20 +81,25 @@ describe("Room Directory", () => {
|
|||
});
|
||||
});
|
||||
|
||||
cy.get('[role="button"][aria-label="Explore rooms"]').click();
|
||||
cy.findByRole("button", { name: "Explore rooms" }).click();
|
||||
|
||||
cy.get('.mx_SpotlightDialog [aria-label="Search"]').type("Unknown Room");
|
||||
cy.get(".mx_SpotlightDialog .mx_SpotlightDialog_otherSearches_messageSearchText").should(
|
||||
"contain",
|
||||
"can't find the room you're looking for",
|
||||
);
|
||||
cy.get(".mx_SpotlightDialog").within(() => {
|
||||
cy.findByRole("textbox", { name: "Search" }).type("Unknown Room");
|
||||
cy.findByText("If you can't find the room you're looking for, ask for an invite or create a new room.")
|
||||
.should("have.class", "mx_SpotlightDialog_otherSearches_messageSearchText")
|
||||
.should("exist");
|
||||
});
|
||||
cy.get(".mx_SpotlightDialog_wrapper").percySnapshotElement("Room Directory - filtered no results");
|
||||
|
||||
cy.get('.mx_SpotlightDialog [aria-label="Search"]').type("{selectAll}{backspace}test1234");
|
||||
cy.contains(".mx_SpotlightDialog .mx_SpotlightDialog_result_publicRoomName", name).should("exist");
|
||||
cy.get(".mx_SpotlightDialog").within(() => {
|
||||
cy.findByRole("textbox", { name: "Search" }).type("{selectAll}{backspace}test1234");
|
||||
cy.findByText(name).should("have.class", "mx_SpotlightDialog_result_publicRoomName").should("exist");
|
||||
});
|
||||
|
||||
// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24881
|
||||
//cy.get(".mx_SpotlightDialog_wrapper").percySnapshotElement("Room Directory - filtered one result");
|
||||
cy.get(".mx_SpotlightDialog .mx_SpotlightDialog_option").find(".mx_AccessibleButton").contains("Join").click();
|
||||
|
||||
cy.get(".mx_SpotlightDialog .mx_SpotlightDialog_option").findByRole("button", { name: "Join" }).click();
|
||||
|
||||
cy.url().should("contain", `/#/room/#test1234:localhost`);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue