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/5] 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 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" From 3874314e13e2337727d035f14c0fa6d15fd2571c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 12 Jan 2023 15:16:05 +0000 Subject: [PATCH 2/5] Parallelise Cypress runs once more (#9902) --- .github/workflows/cypress.yaml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 641a4a0a41..ee57bbe4c8 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -84,14 +84,16 @@ jobs: actions: read issues: read pull-requests: read - environment: - Cypress - #strategy: - # fail-fast: false - # matrix: - # # Run 4 instances in Parallel - # runner: [1, 2, 3, 4] + environment: Cypress + strategy: + fail-fast: false + matrix: + # Run 4 instances in Parallel + runner: [1, 2, 3, 4] steps: + - uses: browser-actions/setup-chrome@latest + - run: echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV + - uses: tecolicom/actions-use-apt-tools@v1 with: # Our test suite includes some screenshot tests with unusual diacritics, which are @@ -121,14 +123,12 @@ jobs: with: # The built-in Electron runner seems to grind to a halt trying # to run the tests, so use chrome. - browser: chrome + browser: "${{ env.BROWSER_PATH }}" start: npx serve -p 8080 webapp wait-on: "http://localhost:8080" - record: - true - #parallel: true - #command-prefix: 'yarn percy exec --parallel --' - command-prefix: "yarn percy exec --" + record: true + parallel: true + command-prefix: "yarn percy exec --parallel --" config: '{"reporter":"cypress-multi-reporters", "reporterOptions": { "configFile": "cypress-ci-reporter-config.json" } }' ci-build-id: ${{ needs.prepare.outputs.uuid }} env: @@ -159,9 +159,8 @@ jobs: # tell Percy more details about the context of this run PERCY_BRANCH: ${{ github.event.workflow_run.head_branch }} PERCY_COMMIT: ${{ github.event.workflow_run.head_sha }} - PERCY_PULL_REQUEST: - ${{ needs.prepare.outputs.pr_id }} - #PERCY_PARALLEL_TOTAL: ${{ strategy.job-total }} + PERCY_PULL_REQUEST: ${{ needs.prepare.outputs.pr_id }} + PERCY_PARALLEL_TOTAL: ${{ strategy.job-total }} PERCY_PARALLEL_NONCE: ${{ needs.prepare.outputs.uuid }} - name: Upload Artifact 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 3/5] Remove redundant option --- cypress.config.ts | 1 - 1 file changed, 1 deletion(-) 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: { 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 4/5] 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 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( 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 5/5] 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 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 }}