Update kick.spec.ts - use Cypress Testing Library (#10587)
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
parent
605ef084ec
commit
72fe394e4c
1 changed files with 9 additions and 11 deletions
|
@ -62,15 +62,13 @@ const INTEGRATION_MANAGER_HTML = `
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function openIntegrationManager() {
|
function openIntegrationManager() {
|
||||||
cy.get(".mx_RightPanel_roomSummaryButton").click();
|
cy.findByRole("tab", { name: "Room info" }).click();
|
||||||
cy.get(".mx_RoomSummaryCard_appsGroup").within(() => {
|
cy.findByRole("button", { name: "Add widgets, bridges & bots" }).click();
|
||||||
cy.contains("Add widgets, bridges & bots").click();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeIntegrationManager(integrationManagerUrl: string) {
|
function closeIntegrationManager(integrationManagerUrl: string) {
|
||||||
cy.accessIframe(`iframe[src*="${integrationManagerUrl}"]`).within(() => {
|
cy.accessIframe(`iframe[src*="${integrationManagerUrl}"]`).within(() => {
|
||||||
cy.get("#close").should("exist").click();
|
cy.findByRole("button", { name: "Press to close" }).should("exist").click();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +76,7 @@ function sendActionFromIntegrationManager(integrationManagerUrl: string, targetR
|
||||||
cy.accessIframe(`iframe[src*="${integrationManagerUrl}"]`).within(() => {
|
cy.accessIframe(`iframe[src*="${integrationManagerUrl}"]`).within(() => {
|
||||||
cy.get("#target-room-id").should("exist").type(targetRoomId);
|
cy.get("#target-room-id").should("exist").type(targetRoomId);
|
||||||
cy.get("#target-user-id").should("exist").type(targetUserId);
|
cy.get("#target-user-id").should("exist").type(targetUserId);
|
||||||
cy.get("#send-action").should("exist").click();
|
cy.findByRole("button", { name: "Press to send action" }).should("exist").click();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +103,7 @@ function expectKickedMessage(shouldExist: boolean) {
|
||||||
clickUntilGone(".mx_GenericEventListSummary_toggle[aria-expanded=false]");
|
clickUntilGone(".mx_GenericEventListSummary_toggle[aria-expanded=false]");
|
||||||
|
|
||||||
// Check for the event message (or lack thereof)
|
// Check for the event message (or lack thereof)
|
||||||
cy.contains(".mx_EventTile_line", `${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`).should(
|
cy.findByText(`${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`).should(
|
||||||
shouldExist ? "exist" : "not.exist",
|
shouldExist ? "exist" : "not.exist",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +171,7 @@ describe("Integration Manager: Kick", () => {
|
||||||
const targetUserId = targetUser.getUserId();
|
const targetUserId = targetUser.getUserId();
|
||||||
cy.viewRoomByName(ROOM_NAME);
|
cy.viewRoomByName(ROOM_NAME);
|
||||||
cy.inviteUser(roomId, targetUserId);
|
cy.inviteUser(roomId, targetUserId);
|
||||||
cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should("exist");
|
cy.findByText(`${BOT_DISPLAY_NAME} joined the room`).should("exist");
|
||||||
|
|
||||||
openIntegrationManager();
|
openIntegrationManager();
|
||||||
sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId);
|
sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId);
|
||||||
|
@ -189,7 +187,7 @@ describe("Integration Manager: Kick", () => {
|
||||||
const targetUserId = targetUser.getUserId();
|
const targetUserId = targetUser.getUserId();
|
||||||
cy.viewRoomByName(ROOM_NAME);
|
cy.viewRoomByName(ROOM_NAME);
|
||||||
cy.inviteUser(roomId, targetUserId);
|
cy.inviteUser(roomId, targetUserId);
|
||||||
cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should("exist");
|
cy.findByText(`${BOT_DISPLAY_NAME} joined the room`).should("exist");
|
||||||
cy.getClient()
|
cy.getClient()
|
||||||
.then(async (client) => {
|
.then(async (client) => {
|
||||||
await client.sendStateEvent(roomId, "m.room.power_levels", {
|
await client.sendStateEvent(roomId, "m.room.power_levels", {
|
||||||
|
@ -215,7 +213,7 @@ describe("Integration Manager: Kick", () => {
|
||||||
const targetUserId = targetUser.getUserId();
|
const targetUserId = targetUser.getUserId();
|
||||||
cy.viewRoomByName(ROOM_NAME);
|
cy.viewRoomByName(ROOM_NAME);
|
||||||
cy.inviteUser(roomId, targetUserId);
|
cy.inviteUser(roomId, targetUserId);
|
||||||
cy.contains(`${BOT_DISPLAY_NAME} joined the room`)
|
cy.findByText(`${BOT_DISPLAY_NAME} joined the room`)
|
||||||
.should("exist")
|
.should("exist")
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await targetUser.leave(roomId);
|
await targetUser.leave(roomId);
|
||||||
|
@ -236,7 +234,7 @@ describe("Integration Manager: Kick", () => {
|
||||||
const targetUserId = targetUser.getUserId();
|
const targetUserId = targetUser.getUserId();
|
||||||
cy.viewRoomByName(ROOM_NAME);
|
cy.viewRoomByName(ROOM_NAME);
|
||||||
cy.inviteUser(roomId, targetUserId);
|
cy.inviteUser(roomId, targetUserId);
|
||||||
cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should("exist");
|
cy.findByText(`${BOT_DISPLAY_NAME} joined the room`).should("exist");
|
||||||
cy.getClient()
|
cy.getClient()
|
||||||
.then(async (client) => {
|
.then(async (client) => {
|
||||||
await client.ban(roomId, targetUserId);
|
await client.ban(roomId, targetUserId);
|
||||||
|
|
Loading…
Reference in a new issue