From 4afe4a10a0716e7a2842af1321e049a106a9f4b8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Jan 2023 14:47:58 +0000 Subject: [PATCH 1/4] Update dependency cypress to v12 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0ddf1182bf6..8ecd7530777 100644 --- a/package.json +++ b/package.json @@ -177,7 +177,7 @@ "babel-jest": "^29.0.0", "blob-polyfill": "^7.0.0", "chokidar": "^3.5.1", - "cypress": "^11.0.0", + "cypress": "^12.0.0", "cypress-axe": "^1.0.0", "cypress-multi-reporters": "^1.6.1", "cypress-real-events": "^1.7.1", diff --git a/yarn.lock b/yarn.lock index a265249bbcd..9b87b97b594 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3555,10 +3555,10 @@ cypress-real-events@^1.7.1: resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.7.4.tgz#87780ee0f6669ee30ce52016c4bfc94d094a6e3d" integrity sha512-bAlIf3w6uJa72hcbLFpQIl/hBoNGYnSVzFMgohefWcooyZz2WbFZdFAEDOl5qOPATtAU01o92sWvc2QW9eT8aA== -cypress@^11.0.0: - version "11.2.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-11.2.0.tgz#63edef8c387b687066c5493f6f0ad7b9ced4b2b7" - integrity sha512-u61UGwtu7lpsNWLUma/FKNOsrjcI6wleNmda/TyKHe0dOBcVjbCPlp1N6uwFZ0doXev7f/91YDpU9bqDCFeBLA== +cypress@^12.0.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.3.0.tgz#ae3fb0540aef4b5eab1ef2bcd0760caf2992b8bf" + integrity sha512-ZQNebibi6NBt51TRxRMYKeFvIiQZ01t50HSy7z/JMgRVqBUey3cdjog5MYEbzG6Ktti5ckDt1tfcC47lmFwXkw== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" From b68dbeff675182b5eb5a9952141751224e7eaec2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 12 Jan 2023 17:21:49 +0000 Subject: [PATCH 2/4] Remove redundant option --- cypress.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress.config.ts b/cypress.config.ts index 253857e3755..dfa17ab32cf 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -27,7 +27,6 @@ export default defineConfig({ return require("./cypress/plugins/index.ts").default(on, config); }, baseUrl: "http://localhost:8080", - experimentalSessionAndOrigin: true, specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}", }, env: { From 2acf78a9e4bab91cd39dc2670953e44257747d04 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 13 Jan 2023 10:25:50 +0000 Subject: [PATCH 3/4] Fix unstable cypress test --- cypress/e2e/integration-manager/kick.spec.ts | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index 2cd66fa51b2..79e1db1ef93 100644 --- a/cypress/e2e/integration-manager/kick.spec.ts +++ b/cypress/e2e/integration-manager/kick.spec.ts @@ -82,9 +82,27 @@ function sendActionFromIntegrationManager(integrationManagerUrl: string, targetR }); } +function clickUntilGone(selector: string, attempt = 0) { + if (attempt === 11) { + throw new Error("clickUntilGone attempt count exceeded"); + } + + cy.get(selector) + .last() + .click() + .then(($button) => { + const exists = Cypress.$(selector).length > 0; + if (exists) { + clickUntilGone(selector, ++attempt); + } + }); +} + function expectKickedMessage(shouldExist: boolean) { - // Expand any event summaries - cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click({ multiple: true }); + // Expand any event summaries, we can't use a click multiple here because clicking one might de-render others + // This is quite horrible but seems the most stable way of clicking 0-N buttons, + // one at a time with a full re-evaluation after each click + clickUntilGone(".mx_GenericEventListSummary_toggle[aria-expanded=false]"); // Check for the event message (or lack thereof) cy.contains(".mx_EventTile_line", `${USER_DISPLAY_NAME} removed ${BOT_DISPLAY_NAME}: ${KICK_REASON}`).should( From 683b0928f34e5a6cc80ca758671ca6a049e931db Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 13 Jan 2023 10:35:45 +0000 Subject: [PATCH 4/4] Pass PR details to Cypress --- .github/workflows/cypress.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index ee57bbe4c8e..d114217f5c2 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -151,6 +151,8 @@ jobs: COMMIT_INFO_MESSAGE: ${{ needs.prepare.outputs.commit_message }} COMMIT_INFO_AUTHOR: ${{ needs.prepare.outputs.commit_author }} COMMIT_INFO_EMAIL: ${{ needs.prepare.outputs.commit_email }} + CYPRESS_PULL_REQUEST_ID: ${{ needs.prepare.outputs.pr_id }} + CYPRESS_PULL_REQUEST_URL: /~https://github.com/${{ github.repository }}/pull/${{ needs.prepare.outputs.pr_id }} # pass the Percy token as an environment variable PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}