Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cypress cloud to see videos of cypress runs on CI #401

Draft
wants to merge 10 commits into
base: develop_tchap
Choose a base branch
from
Draft
34 changes: 20 additions & 14 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,7 +14,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
Expand All @@ -31,7 +26,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.
Expand All @@ -42,15 +37,26 @@ 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
command: 'yarn test:cypress'
record: true
command: 'yarn test:cypress:record'
env:
E2E_TEST_USER_EMAIL: ${{ secrets.E2E_TEST_USER_EMAIL }}
E2E_TEST_USER_PASSWORD: ${{ secrets.E2E_TEST_USER_PASSWORD }}
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
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}


# 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'
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v3
with:
name: cypress-results
path: |
cypress/screenshots
cypress/videos
cypress/synapselogs
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions cypress/support/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ limitations under the License.

/// <reference types="cypress" />

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;
Expand Down Expand Up @@ -86,7 +84,6 @@ Cypress.Commands.add("getBot", (synapse: SynapseInstance, opts: CreateBotOpts):
userId: credentials.userId,
deviceId: credentials.deviceId,
accessToken: credentials.accessToken,
request,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that fix is for just unbreaking the tests, otherwise we don't see the runs in cypress cloud. But fixing the tests will be done in other PRs.

store: new win.matrixcs.MemoryStore(),
scheduler: new win.matrixcs.MatrixScheduler(),
cryptoStore: new win.matrixcs.MemoryCryptoStore(),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down