From 94edd88e650f8407d122db312b07636cbe75f585 Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Mon, 30 Jan 2023 15:19:10 +0100 Subject: [PATCH 1/8] Use our own cloud.cypress.io, maybe it will be useful --- cypress.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress.config.ts b/cypress.config.ts index 51a63721f..2cc3dae53 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -37,7 +37,7 @@ getVar('E2E_TEST_USER_HOMESERVER_SHORT'); export default defineConfig({ watchForFileChanges : false, videoUploadOnPasses: false, - projectId: 'ppvnzg', + projectId: 'x8og2r', experimentalInteractiveRunEvents: true, defaultCommandTimeout: 10000, chromeWebSecurity: false, From 85501910c74a1632138c6a504cc2a76505f0709b Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Mon, 30 Jan 2023 15:24:39 +0100 Subject: [PATCH 2/8] Record CI jobs in cloud.cypress.io (attempt!) --- .github/workflows/cypress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index d58d12494..21480a63f 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -42,7 +42,7 @@ jobs: wait-on: 'http://localhost:8080' # wait for 3min, the build is long wait-on-timeout: 180 - # record: true # todo record to dashboard, see action's doc + record: true command: 'yarn test:cypress' env: E2E_TEST_USER_EMAIL: ${{ secrets.E2E_TEST_USER_EMAIL }} @@ -51,6 +51,6 @@ jobs: E2E_TEST_USER_HOMESERVER_URL: 'https://matrix.agent1.tchap.incubateur.net' E2E_TEST_USER_HOMESERVER_SHORT: 'agent1.tchap.incubateur.net' # todo pass the Dashboard record key as an environment variable - # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} From 819ea3d355f984674b475d922c8c95d9800d38cc Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Tue, 31 Jan 2023 09:54:28 +0100 Subject: [PATCH 3/8] Try again connecting CI runs to cypress cloud --- .github/workflows/cypress.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 21480a63f..2ed99e11d 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -50,7 +50,9 @@ jobs: E2E_TEST_USER_SECURITY_KEY: ${{ secrets.E2E_TEST_USER_SECURITY_KEY }} E2E_TEST_USER_HOMESERVER_URL: 'https://matrix.agent1.tchap.incubateur.net' E2E_TEST_USER_HOMESERVER_SHORT: 'agent1.tchap.incubateur.net' - # todo pass the Dashboard record key as an environment variable + # pass the Dashboard record key as an environment variable CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - - + # pass GitHub token to allow accurately detecting a build vs a re-run build + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # pass the project ID + CYPRESS_PROJECT_ID: 'x8og2r' From 337958eb47eeb2f3a05ba6c59c87ffffa8962721 Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Tue, 31 Jan 2023 10:31:24 +0100 Subject: [PATCH 4/8] upgrade github actions, just in case --- .github/workflows/cypress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 2ed99e11d..043d495b2 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Yarn cache uses: actions/setup-node@v3 @@ -31,7 +31,7 @@ jobs: run: "./scripts/install-yarn-linked-repositories.sh" - name: Run Cypress tests - uses: cypress-io/github-action@v4.1.1 + uses: cypress-io/github-action@v5 with: # The built-in Electron runner seems to grind to a halt trying # to run the tests, so use chrome. From dcadd4a832e88f258c2ffceb018e4f7662acfbc4 Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Tue, 31 Jan 2023 10:39:11 +0100 Subject: [PATCH 5/8] Use the --record flag (stull trying to connect to cypress cloud) --- .github/workflows/cypress.yaml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 043d495b2..1df1d35a3 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -43,7 +43,7 @@ jobs: # wait for 3min, the build is long wait-on-timeout: 180 record: true - command: 'yarn test:cypress' + command: 'yarn test:cypress:record' env: E2E_TEST_USER_EMAIL: ${{ secrets.E2E_TEST_USER_EMAIL }} E2E_TEST_USER_PASSWORD: ${{ secrets.E2E_TEST_USER_PASSWORD }} diff --git a/package.json b/package.json index 647a6fe0c..aa8c5732b 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "test": "jest", "test:cypress": "cypress run", "test:cypress:open": "cypress open", + "test:cypress:record": "cypress run --record", "coverage": "yarn test --coverage", "analyse:unused-exports": "node ./scripts/analyse_unused_exports.js", "postinstall": "./scripts/apply_patches.sh", From ae5ba3b189535af71f43c3f5855502436f408320 Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Tue, 31 Jan 2023 11:05:53 +0100 Subject: [PATCH 6/8] Run cypress on pushes. All pushes belong to a pull request in the end anyway. --- .github/workflows/cypress.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 1df1d35a3..b1748ff7b 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -2,12 +2,7 @@ # Todo : reuse a build from another action, instead of rebuilding for nothing. # tchap modification : use "./scripts/install-yarn-linked-repositories.sh" instead of "./scripts/layered.sh" name: Cypress End to End Tests -on: - pull_request: { } - push: - branches: [ develop_tchap, master_tchap ] - #repository_dispatch: # :TCHAP: we don't use this - # types: [ element-web-notify ] +on: [push] env: # :TCHAP: not needed for fetchdep.with.version.sh but leaving them otherwise it breaks. # These must be set for fetchdep.sh to get the right branch From f6bbbf05043f6478ba46a31bf03a6554709989c7 Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Tue, 31 Jan 2023 11:06:55 +0100 Subject: [PATCH 7/8] Try storing artifacts in the github actions, for another way to access the video logs --- .github/workflows/cypress.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index b1748ff7b..72bc17a6a 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -51,3 +51,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # pass the project ID CYPRESS_PROJECT_ID: 'x8og2r' + - name: Upload Artifact + if: failure() + uses: actions/upload-artifact@v3 + with: + name: cypress-results + path: | + cypress/screenshots + cypress/videos + cypress/synapselogs From 9db3925d59331021242aa40a8a042decf8bd3837 Mon Sep 17 00:00:00 2001 From: Estelle Comment Date: Mon, 30 Jan 2023 11:14:28 +0100 Subject: [PATCH 8/8] Remove import that is now obsolete and breaks the build --- cypress/support/bot.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/cypress/support/bot.ts b/cypress/support/bot.ts index f724d6b3d..ba0d8b8a2 100644 --- a/cypress/support/bot.ts +++ b/cypress/support/bot.ts @@ -16,8 +16,6 @@ limitations under the License. /// -import request from "browser-request"; - import type { ISendEventResponse, MatrixClient, Room } from "matrix-js-sdk/src/matrix"; import { SynapseInstance } from "../plugins/synapsedocker"; import Chainable = Cypress.Chainable; @@ -86,7 +84,6 @@ Cypress.Commands.add("getBot", (synapse: SynapseInstance, opts: CreateBotOpts): userId: credentials.userId, deviceId: credentials.deviceId, accessToken: credentials.accessToken, - request, store: new win.matrixcs.MemoryStore(), scheduler: new win.matrixcs.MatrixScheduler(), cryptoStore: new win.matrixcs.MemoryCryptoStore(),