From 7fd412dfa2ad696cebf53c0dd3f44fa2fd768c3b Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Mon, 22 Aug 2022 14:27:14 -0400 Subject: [PATCH 01/14] Add kick action to Scalar Messaging API --- src/ScalarMessaging.ts | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index d2d11c71cfa..1cc1ee5e4a9 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -73,6 +73,29 @@ Example: } } +kick +------ +Kicks a user from a room. The request will no-op if the user is not in the room. + +Request: + - room_id is the room to invite the user into. + - user_id is the user ID to invite. + - reason is an optional string for the kick reason +Response: +{ + success: true +} +Example: +{ + action: "kick", + room_id: "!foo:bar", + user_id: "@invitee:bar", + reason: "Removed from room", + response: { + success: true + } +} + set_bot_options --------------- Set the m.room.bot.options state event for a bot user. @@ -266,6 +289,7 @@ enum Action { CanSendEvent = "can_send_event", MembershipState = "membership_state", invite = "invite", + Kick = "kick", BotOptions = "bot_options", SetBotOptions = "set_bot_options", SetBotPower = "set_bot_power", @@ -322,6 +346,35 @@ function inviteUser(event: MessageEvent, roomId: string, userId: string): v }); } +function kickUser(event: MessageEvent, roomId: string, userId: string): void { + logger.log(`Received request to kick ${userId} from room ${roomId}`); + const client = MatrixClientPeg.get(); + if (!client) { + sendError(event, _t('You need to be logged in.')); + return; + } + const room = client.getRoom(roomId); + if (room) { + // if they are already not in the room we can resolve immediately. + const member = room.getMember(userId); + if (!member || (member && member.membership === "leave")) { + sendResponse(event, { + success: true, + }); + return; + } + } + + const reason = event.data.reason; + client.kick(roomId, userId, reason).then(function() { + sendResponse(event, { + success: true, + }); + }, function(err) { + sendError(event, _t('You need to be able to kick users to do that.'), err); + }); +} + function setWidget(event: MessageEvent, roomId: string): void { const widgetId = event.data.widget_id; let widgetType = event.data.type; @@ -710,6 +763,9 @@ const onMessage = function(event: MessageEvent): void { case Action.invite: inviteUser(event, roomId, userId); break; + case Action.Kick: + kickUser(event, roomId, userId); + break; case Action.BotOptions: botOptions(event, roomId, userId); break; From 6b2ba457bc362f0bf533c8c9c109557524694b3e Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Tue, 23 Aug 2022 15:47:15 -0400 Subject: [PATCH 02/14] Fix docs --- src/ScalarMessaging.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index 1cc1ee5e4a9..8751da83f85 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -78,8 +78,8 @@ kick Kicks a user from a room. The request will no-op if the user is not in the room. Request: - - room_id is the room to invite the user into. - - user_id is the user ID to invite. + - room_id is the room to kick the user from. + - user_id is the user ID to kick. - reason is an optional string for the kick reason Response: { @@ -89,7 +89,7 @@ Example: { action: "kick", room_id: "!foo:bar", - user_id: "@invitee:bar", + user_id: "@target:example.org", reason: "Removed from room", response: { success: true From 67e2dc856baab5311cd89df2788624c3caaf0fd5 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Tue, 23 Aug 2022 15:49:09 -0400 Subject: [PATCH 03/14] Fix membership check --- src/ScalarMessaging.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index 8751da83f85..f7af72ddc05 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -277,6 +277,7 @@ import { _t } from './languageHandler'; import { IntegrationManagers } from "./integrations/IntegrationManagers"; import { WidgetType } from "./widgets/WidgetType"; import { objectClone } from "./utils/objects"; +import { EffectiveMembership, getEffectiveMembership } from './utils/membership'; enum Action { CloseScalar = "close_scalar", @@ -357,7 +358,7 @@ function kickUser(event: MessageEvent, roomId: string, userId: string): voi if (room) { // if they are already not in the room we can resolve immediately. const member = room.getMember(userId); - if (!member || (member && member.membership === "leave")) { + if (!member || getEffectiveMembership(member.membership) === EffectiveMembership.Leave) { sendResponse(event, { success: true, }); From 872f5ac36361fa3ae30cf98acca69983b70f9510 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Tue, 23 Aug 2022 15:58:40 -0400 Subject: [PATCH 04/14] Update style --- src/ScalarMessaging.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index f7af72ddc05..67b5748855c 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -351,7 +351,7 @@ function kickUser(event: MessageEvent, roomId: string, userId: string): voi logger.log(`Received request to kick ${userId} from room ${roomId}`); const client = MatrixClientPeg.get(); if (!client) { - sendError(event, _t('You need to be logged in.')); + sendError(event, _t("You need to be logged in.")); return; } const room = client.getRoom(roomId); @@ -367,12 +367,12 @@ function kickUser(event: MessageEvent, roomId: string, userId: string): voi } const reason = event.data.reason; - client.kick(roomId, userId, reason).then(function() { + client.kick(roomId, userId, reason).then(() => { sendResponse(event, { success: true, }); - }, function(err) { - sendError(event, _t('You need to be able to kick users to do that.'), err); + }).catch((err) => { + sendError(event, _t("You need to be able to kick users to do that."), err); }); } From fa4d0741f19141e9ec6780ef5e6d8f6e1c225520 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Tue, 23 Aug 2022 15:58:47 -0400 Subject: [PATCH 05/14] Update i18n --- src/i18n/strings/en_EN.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4a00a99540c..0cb95adfecb 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -368,6 +368,7 @@ "Some invites couldn't be sent": "Some invites couldn't be sent", "You need to be logged in.": "You need to be logged in.", "You need to be able to invite users to do that.": "You need to be able to invite users to do that.", + "You need to be able to kick users to do that.": "You need to be able to kick users to do that.", "Unable to create widget.": "Unable to create widget.", "Missing roomId.": "Missing roomId.", "Failed to send request.": "Failed to send request.", From 552e98eb21a43daa9e2e73200d42e9f7eddc44bb Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Thu, 25 Aug 2022 13:10:46 -0400 Subject: [PATCH 06/14] Add e2e tests --- cypress/e2e/integration-manager/kick.spec.ts | 236 +++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 cypress/e2e/integration-manager/kick.spec.ts diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts new file mode 100644 index 00000000000..61153215526 --- /dev/null +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -0,0 +1,236 @@ +/* +Copyright 2022 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/// + +import { SynapseInstance } from "../../plugins/synapsedocker"; +import { MatrixClient } from "../../global"; +import { UserCredentials } from "../../support/login"; + +const ROOM_NAME = "Integration Manager Test"; + +const INTEGRATION_MANAGER_TOKEN = "Sr_oU-B-Cir_Tx573Ugr"; +const INTEGRATION_MANAGER_HTML = ` + + + Fake Integration Manager + + + + + + + + +`; + +function openIntegrationManager() { + cy.get(".mx_RightPanel_roomSummaryButton").click(); + cy.get(".mx_RoomSummaryCard_appsGroup").within(() => { + cy.contains("Add widgets, bridges & bots").click(); + }); +} + +function sendActionFromIntegrationManager(integrationManagerUrl: string, targetRoomId: string, targetUserId: string) { + cy.accessIframe(`iframe[src*="${integrationManagerUrl}"]`).within(() => { + cy.get("#target-room-id").should("exist").type(targetRoomId); + cy.get("#target-user-id").should("exist").type(targetUserId); + cy.get("#send-action").should("exist").click(); + }); + // Wait for the message to be handled + return cy.wait(100); +} + +describe("Kick", () => { + let testUser: UserCredentials; + let synapse: SynapseInstance; + let integrationManagerUrl: string; + + beforeEach(() => { + cy.serveHtmlFile(INTEGRATION_MANAGER_HTML).then(url => { + integrationManagerUrl = url; + }); + cy.startSynapse("default").then(data => { + synapse = data; + + cy.initTestUser(synapse, "Alice", () => { + cy.window().then(win => { + win.localStorage.setItem("mx_scalar_token", INTEGRATION_MANAGER_TOKEN); + win.localStorage.setItem(`mx_scalar_token_at_${integrationManagerUrl}`, INTEGRATION_MANAGER_TOKEN); + }); + }).then(user => { + testUser = user; + }); + + cy.setAccountData("m.widgets", { + "m.integration_manager": { + content: { + type: "m.integration_manager", + name: "Integration Manager", + url: integrationManagerUrl, + data: { + api_url: integrationManagerUrl, + }, + }, + id: "integration-manager", + }, + }).as("integrationManager"); + + // Succeed when checking the token is valid + cy.intercept(`${integrationManagerUrl}/account?scalar_token=${INTEGRATION_MANAGER_TOKEN}*`, req => { + req.continue(res => { + return res.send(200, { + user_id: testUser.userId, + }); + }); + }); + + cy.createRoom({ + name: ROOM_NAME, + }).as("roomId"); + + cy.getBot(synapse, { displayName: "Bob", autoAcceptInvites: true }).as("bob"); + }); + }); + + afterEach(() => { + cy.stopSynapse(synapse); + cy.stopWebServers(); + }); + + it("should kick the target", () => { + cy.all([ + cy.get("@bob"), + cy.get("@roomId"), + cy.get<{}>("@integrationManager"), + ]).then(([targetUser, roomId]) => { + const targetUserId = targetUser.getUserId(); + cy.viewRoomByName(ROOM_NAME); + cy.inviteUser(roomId, targetUserId); + + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); + + cy.getClient().then(client => { + expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.true; + }); + }); + }); + + it("should not kick the target if lacking permissions", () => { + cy.all([ + cy.get("@bob"), + cy.get("@roomId"), + cy.get<{}>("@integrationManager"), + ]).then(([targetUser, roomId]) => { + const targetUserId = targetUser.getUserId(); + cy.viewRoomByName(ROOM_NAME); + cy.inviteUser(roomId, targetUserId).as("targetJoined"); + cy.getClient().then(async client => { + await client.sendStateEvent(roomId, 'm.room.power_levels', { + kick: 50, + users: { + [testUser.userId]: 0, + }, + }); + }); + + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); + + cy.getClient().then(client => { + expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.false; + }); + }); + }); + + it("should no-op if the target already left", () => { + cy.all([ + cy.get("@bob"), + cy.get("@roomId"), + cy.get<{}>("@integrationManager"), + ]).then(([targetUser, roomId]) => { + const targetUserId = targetUser.getUserId(); + cy.viewRoomByName(ROOM_NAME); + cy.inviteUser(roomId, targetUserId); + // Wait for target to join + cy.wait(100).then(async () => { + await targetUser.leave(roomId); + }); + + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); + + cy.getClient().then(client => { + expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.false; + }); + }); + }); + + it("should no-op if the target was banned", () => { + cy.all([ + cy.get("@bob"), + cy.get("@roomId"), + cy.get<{}>("@integrationManager"), + ]).then(([targetUser, roomId]) => { + const targetUserId = targetUser.getUserId(); + cy.viewRoomByName(ROOM_NAME); + cy.inviteUser(roomId, targetUserId); + // Wait for target to join + cy.wait(100); + cy.getClient().then(async client => { + await client.ban(roomId, targetUserId); + }); + + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); + + cy.getClient().then(async client => { + expect(client.getRoom(roomId).getMember(targetUserId).membership).to.eq('ban'); + }); + }); + }); + + it("should no-op if the target was never a room member", () => { + cy.all([ + cy.get("@bob"), + cy.get("@roomId"), + cy.get<{}>("@integrationManager"), + ]).then(([targetUser, roomId]) => { + const targetUserId = targetUser.getUserId(); + cy.viewRoomByName(ROOM_NAME); + + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); + + cy.getClient().then(async client => { + expect(client.getRoom(roomId).getMember(targetUserId)).to.be.null; + }); + }); + }); +}); From ab519f33b7593e5b3cfc996688a55f6fb6e51923 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Thu, 25 Aug 2022 13:15:16 -0400 Subject: [PATCH 07/14] Fix test flakiness --- cypress/e2e/integration-manager/kick.spec.ts | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index 61153215526..d7442e8af8f 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -150,7 +150,7 @@ describe("Kick", () => { ]).then(([targetUser, roomId]) => { const targetUserId = targetUser.getUserId(); cy.viewRoomByName(ROOM_NAME); - cy.inviteUser(roomId, targetUserId).as("targetJoined"); + cy.inviteUser(roomId, targetUserId); cy.getClient().then(async client => { await client.sendStateEvent(roomId, 'm.room.power_levels', { kick: 50, @@ -158,13 +158,13 @@ describe("Kick", () => { [testUser.userId]: 0, }, }); - }); - - openIntegrationManager(); - sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); + }).then(() => { + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); - cy.getClient().then(client => { - expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.false; + cy.getClient().then(client => { + expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.false; + }); }); }); }); @@ -181,13 +181,13 @@ describe("Kick", () => { // Wait for target to join cy.wait(100).then(async () => { await targetUser.leave(roomId); - }); + }).then(() => { + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); - openIntegrationManager(); - sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); - - cy.getClient().then(client => { - expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.false; + cy.getClient().then(client => { + expect(client.getRoom(roomId).getMember(targetUserId).isKicked()).to.be.false; + }); }); }); }); @@ -205,13 +205,13 @@ describe("Kick", () => { cy.wait(100); cy.getClient().then(async client => { await client.ban(roomId, targetUserId); - }); + }).then(() => { + openIntegrationManager(); + sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); - openIntegrationManager(); - sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); - - cy.getClient().then(async client => { - expect(client.getRoom(roomId).getMember(targetUserId).membership).to.eq('ban'); + cy.getClient().then(async client => { + expect(client.getRoom(roomId).getMember(targetUserId).membership).to.eq('ban'); + }); }); }); }); From b1b5d6a5c41199f857f383aa8d28f639fe9d953f Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Thu, 25 Aug 2022 13:26:27 -0400 Subject: [PATCH 08/14] Fix variable type --- src/ScalarMessaging.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index 67b5748855c..c511d291ce2 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -786,7 +786,7 @@ const onMessage = function(event: MessageEvent): void { }; let listenerCount = 0; -let openManagerUrl: string = null; +let openManagerUrl: string | null = null; export function startListening(): void { if (listenerCount === 0) { From 586027b88404ba6b04d2bb6a2e2be26da4b99449 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Fri, 26 Aug 2022 12:21:48 -0400 Subject: [PATCH 09/14] Check for when bot has joined --- cypress/e2e/integration-manager/kick.spec.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index d7442e8af8f..c04720e2a0b 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -21,6 +21,7 @@ import { MatrixClient } from "../../global"; import { UserCredentials } from "../../support/login"; const ROOM_NAME = "Integration Manager Test"; +const BOT_DISPLAY_NAME = "Bob" const INTEGRATION_MANAGER_TOKEN = "Sr_oU-B-Cir_Tx573Ugr"; const INTEGRATION_MANAGER_HTML = ` @@ -114,7 +115,7 @@ describe("Kick", () => { name: ROOM_NAME, }).as("roomId"); - cy.getBot(synapse, { displayName: "Bob", autoAcceptInvites: true }).as("bob"); + cy.getBot(synapse, { displayName: BOT_DISPLAY_NAME, autoAcceptInvites: true }).as("bob"); }); }); @@ -132,6 +133,7 @@ describe("Kick", () => { const targetUserId = targetUser.getUserId(); cy.viewRoomByName(ROOM_NAME); cy.inviteUser(roomId, targetUserId); + cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should('exist'); openIntegrationManager(); sendActionFromIntegrationManager(integrationManagerUrl, roomId, targetUserId); @@ -151,6 +153,7 @@ describe("Kick", () => { const targetUserId = targetUser.getUserId(); cy.viewRoomByName(ROOM_NAME); cy.inviteUser(roomId, targetUserId); + cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should('exist'); cy.getClient().then(async client => { await client.sendStateEvent(roomId, 'm.room.power_levels', { kick: 50, @@ -178,8 +181,7 @@ describe("Kick", () => { const targetUserId = targetUser.getUserId(); cy.viewRoomByName(ROOM_NAME); cy.inviteUser(roomId, targetUserId); - // Wait for target to join - cy.wait(100).then(async () => { + cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should('exist').then(async () => { await targetUser.leave(roomId); }).then(() => { openIntegrationManager(); @@ -201,8 +203,7 @@ describe("Kick", () => { const targetUserId = targetUser.getUserId(); cy.viewRoomByName(ROOM_NAME); cy.inviteUser(roomId, targetUserId); - // Wait for target to join - cy.wait(100); + cy.contains(`${BOT_DISPLAY_NAME} joined the room`).should('exist'); cy.getClient().then(async client => { await client.ban(roomId, targetUserId); }).then(() => { From 7b9361a1b26c543ae32ebb7925aa6b8e663ae3f4 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Fri, 26 Aug 2022 13:36:05 -0400 Subject: [PATCH 10/14] Add missing semicolon --- cypress/e2e/integration-manager/kick.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index c04720e2a0b..50daf45a77d 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -21,7 +21,7 @@ import { MatrixClient } from "../../global"; import { UserCredentials } from "../../support/login"; const ROOM_NAME = "Integration Manager Test"; -const BOT_DISPLAY_NAME = "Bob" +const BOT_DISPLAY_NAME = "Bob"; const INTEGRATION_MANAGER_TOKEN = "Sr_oU-B-Cir_Tx573Ugr"; const INTEGRATION_MANAGER_HTML = ` From 7a60b59c3add1aa2643e129d07936835c819572a Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Fri, 26 Aug 2022 16:15:33 -0400 Subject: [PATCH 11/14] Not a real token Co-authored-by: Travis Ralston --- cypress/e2e/integration-manager/kick.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index 50daf45a77d..80ee202988d 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -23,7 +23,7 @@ import { UserCredentials } from "../../support/login"; const ROOM_NAME = "Integration Manager Test"; const BOT_DISPLAY_NAME = "Bob"; -const INTEGRATION_MANAGER_TOKEN = "Sr_oU-B-Cir_Tx573Ugr"; +const INTEGRATION_MANAGER_TOKEN = "DefinitelySecret_DoNotUseThisForReal"; const INTEGRATION_MANAGER_HTML = ` From 8dc37cfd99cb0908ce8f108ac7d66f42a439866b Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Fri, 26 Aug 2022 16:22:14 -0400 Subject: [PATCH 12/14] Improve test description Co-authored-by: Travis Ralston --- cypress/e2e/integration-manager/kick.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index 80ee202988d..ea2588f56c3 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -67,7 +67,7 @@ function sendActionFromIntegrationManager(integrationManagerUrl: string, targetR return cy.wait(100); } -describe("Kick", () => { +describe("Integration Manager: Kick", () => { let testUser: UserCredentials; let synapse: SynapseInstance; let integrationManagerUrl: string; From 026df28e26606f0306b3dcae6790736af558e2f9 Mon Sep 17 00:00:00 2001 From: Justin Carlson Date: Tue, 6 Sep 2022 11:54:34 -0400 Subject: [PATCH 13/14] Look for room kick message instead of checking room state --- cypress/e2e/integration-manager/kick.spec.ts | 60 ++++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index ea2588f56c3..f7ecfc7ba77 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -21,7 +21,9 @@ import { MatrixClient } from "../../global"; import { UserCredentials } from "../../support/login"; const ROOM_NAME = "Integration Manager Test"; +const USER_DISPLAY_NAME = "Alice"; const BOT_DISPLAY_NAME = "Bob"; +const KICK_REASON = "Goodbye"; const INTEGRATION_MANAGER_TOKEN = "DefinitelySecret_DoNotUseThisForReal"; const INTEGRATION_MANAGER_HTML = ` @@ -33,6 +35,7 @@ const INTEGRATION_MANAGER_HTML = ` +