From aa9f8eac5290efdc33dd33ad023a0a4db2c813da Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 13 Oct 2022 13:50:38 +0100 Subject: [PATCH] Fix flakiness of kick.spec.ts due to `cy.get(...).contains(...).should(...);` anti-pattern (#9411) * Update kick.spec.ts * Update kick.spec.ts --- cypress/e2e/integration-manager/kick.spec.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index 6901cd376b..f31c4032fd 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -84,15 +84,10 @@ function sendActionFromIntegrationManager(integrationManagerUrl: string, targetR function expectKickedMessage(shouldExist: boolean) { // Expand any event summaries - cy.get(".mx_RoomView_MessageList").within(roomView => { - if (roomView.find(".mx_GenericEventListSummary_toggle[aria-expanded=false]").length > 0) { - cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click({ multiple: true }); - } - }); + cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click({ multiple: true }); // Check for the event message (or lack thereof) - cy.get(".mx_EventTile_line") - .contains(`${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`) + cy.contains(".mx_EventTile_line", `${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`) .should(shouldExist ? "exist" : "not.exist"); }