diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index ee57bbe4c8..d114217f5c 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 }} diff --git a/cypress.config.ts b/cypress.config.ts index 253857e375..dfa17ab32c 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: { diff --git a/cypress/e2e/integration-manager/kick.spec.ts b/cypress/e2e/integration-manager/kick.spec.ts index 2cd66fa51b..79e1db1ef9 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( diff --git a/package.json b/package.json index 0ddf1182bf..8ecd753077 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 a265249bbc..9b87b97b59 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"