Skip to content

Commit 70c2dfb

Browse files
committed
enable Cypress video recording with Chrome browser
1 parent 09d4111 commit 70c2dfb

File tree

6 files changed

+34
-28
lines changed

6 files changed

+34
-28
lines changed

.github/workflows/manual-test-matrix-workflow.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@ jobs:
1111
matrix:
1212
specs:
1313
[
14-
"datasource",
15-
"interface",
16-
"path",
1714
"batch-jberet",
1815
"core-management",
16+
"datasource",
1917
"deployment-scanner",
2018
"distributable-web",
2119
"ee",
2220
"ejb",
2321
"elytron",
2422
"elytron-oidc-client",
2523
"health",
24+
"homepage",
25+
"interface",
2626
"io",
2727
"jmx",
2828
"jpa",
2929
"jsf",
3030
"mail",
31-
"microprofile",
3231
"metrics",
32+
"microprofile",
33+
"path",
3334
"runtime",
3435
"security-manager",
36+
"smoke",
3537
"system-property",
3638
"transaction",
37-
"weld",
38-
"homepage",
39-
"smoke",
40-
"update-manager",
4139
"undertow",
40+
"update-manager",
41+
"weld",
4242
]
4343
exclude:
4444
- specs: "update-manager"
@@ -71,15 +71,15 @@ jobs:
7171
- name: "Run compile"
7272
run: "npm run compile"
7373
- name: "Run test(s)"
74-
run: "npm run test:compiled -- --browser=firefox --specs=packages/testsuite/cypress/e2e/${{ matrix.specs }}"
74+
run: "npm run test:compiled -- --browser=chrome --specs=packages/testsuite/cypress/e2e/${{ matrix.specs }}"
7575
- name: "Archive test report(s) and video(s)"
7676
if: ${{ !cancelled() }}
7777
uses: actions/upload-artifact@v4
7878
with:
7979
name: "${{ github.run_id}}-${{ strategy.job-index }}-artifacts"
8080
path: |
81-
packages/testsuite/results
82-
packages/testsuite/cypress/videos
81+
results
82+
cypress/videos
8383
process_report:
8484
name: "Collect results & deploy GH pages"
8585
needs: test_matrix
@@ -97,7 +97,7 @@ jobs:
9797
- name: "Generate Mochawesome Report"
9898
run: mochawesome-merge "./*-artifacts/results/packages/testsuite/cypress/e2e/*.json" > mochawesome.json
9999
- name: "Copy video assets"
100-
run: copyfiles -u 3 "./*-artifacts/packages/testsuite/cypress/videos/*.mp4" mochawesome-report/assets/videos
100+
run: copyfiles -u 2 "./*-artifacts/cypress/videos/*.mp4" mochawesome-report/assets/videos
101101
- name: "Create GH Pages content"
102102
run: marge mochawesome.json -f index.html
103103
- name: "Get time info"

.github/workflows/scheduled-run-all-tests-workflow.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,34 @@ jobs:
1212
matrix:
1313
specs:
1414
[
15-
"datasource",
16-
"interface",
17-
"path",
1815
"batch-jberet",
1916
"core-management",
17+
"datasource",
2018
"deployment-scanner",
2119
"distributable-web",
2220
"ee",
2321
"ejb",
2422
"elytron",
2523
"elytron-oidc-client",
2624
"health",
25+
"homepage",
26+
"interface",
2727
"io",
2828
"jmx",
2929
"jpa",
3030
"jsf",
3131
"mail",
3232
"metrics",
33+
"microprofile",
34+
"path",
3335
"runtime",
3436
"security-manager",
37+
"smoke",
3538
"system-property",
3639
"transaction",
37-
"weld",
38-
"homepage",
39-
"smoke",
40-
"update-manager",
4140
"undertow",
41+
"update-manager",
42+
"weld",
4243
]
4344
exclude:
4445
- specs: "update-manager"
@@ -78,8 +79,8 @@ jobs:
7879
with:
7980
name: "${{ github.run_id}}-${{ strategy.job-index }}-artifacts"
8081
path: |
81-
packages/testsuite/results
82-
packages/testsuite/cypress/videos
82+
results
83+
cypress/videos
8384
process_report:
8485
name: "Collect results & deploy GH pages"
8586
if: ${{ !cancelled() }}
@@ -97,7 +98,7 @@ jobs:
9798
- name: "Generate Mochawesome Report"
9899
run: mochawesome-merge "./*-artifacts/results/packages/testsuite/cypress/e2e/*.json" > mochawesome.json
99100
- name: "Copy video assets"
100-
run: copyfiles -u 3 "./*-artifacts/packages/testsuite/cypress/videos/*.mp4" mochawesome-report/assets/videos
101+
run: copyfiles -u 2 "./*-artifacts/cypress/videos/*.mp4" mochawesome-report/assets/videos
101102
- name: "Create GH Pages content"
102103
run: marge mochawesome.json -f index.html
103104
- name: "Get time info"

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ npm run develop
5454
```
5555

5656
- If you want to execute whole testsuite execute `npm test`
57-
5857
- It is also possible to run on specific browser by supplying `--browser` argument, e.g
58+
- Chrome is the default browser and is recommended for video recording. Firefox may produce black videos.
59+
- For debugging purposes, you can run tests in headed mode (visible browser window) by adding `--headed` flag:
5960

6061
```
61-
npm test -- --browser=chrome
62+
npm test -- --browser=firefox --headed
63+
or
64+
npm test -- --browser=chrome --headed --specs="packages/testsuite/cypress/e2e/homepage/test-homepage.cy.ts"
6265
```
6366

6467
- It is possible to reduce the amount of specs executed by passing `--specs` flag. It also supports glob patterns, e.g to execute only `homepage` related tests, run
@@ -81,7 +84,7 @@ npm run test:compiled -- --specs="packages/testsuite/cypress/e2e/homepage/test-h
8184
HAL_IMAGE=quay.io/myorg/hal WILDFLY_IMAGE=quay.io/myorg/wildfly npm test ...
8285
```
8386

84-
- For debugging purposes videos (and screenshots) of failed tests are stored after the test run (works only with chrome).
87+
- For debugging purposes, videos and screenshots of failed tests are stored after the test run in `cypress/videos` and `cypress/screenshots` directories. Video recording works best with Chrome browser.
8588

8689
## Available environment properties
8790

cypress.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export default defineConfig({
6767
configFile: "reporter-config.json",
6868
},
6969
video: true,
70-
videoCompression: false,
70+
videoCompression: 32,
71+
screenshotOnRunFailure: true,
7172
e2e: {
7273
supportFile: "packages/testsuite/cypress/support/e2e.ts",
7374
specPattern: "packages/testsuite/cypress/e2e/**/*.cy.ts",

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"author": "",
3131
"license": "ISC",
3232
"devDependencies": {
33-
"@cypress/xvfb": "1.2.4",
3433
"@types/command-line-args": "5.2.3",
3534
"@types/mochawesome": "6.2.4",
3635
"@types/portscanner": "2.1.4",

packages/testsuite/run-e2e-tests.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { OptionDefinition } from "command-line-args";
55
import path from "path";
66

77
const optionDefinitions: OptionDefinition[] = [
8-
{ name: "browser", type: String, defaultValue: "firefox" },
8+
{ name: "browser", type: String, defaultValue: "chrome" },
99
{
1010
name: "specs",
1111
type: String,
1212
defaultValue: "packages/testsuite/cypress/e2e/**/*.cy.ts",
1313
},
14+
{ name: "headed", type: Boolean, defaultValue: false },
1415
];
1516

1617
(async () => {
@@ -20,6 +21,7 @@ const optionDefinitions: OptionDefinition[] = [
2021
const projectRoot = path.resolve(__dirname, "..", "..", "..");
2122
const testRunResult = await cypress.run({
2223
browser: options.browser as string,
24+
headed: options.headed as boolean,
2325
project: projectRoot,
2426
configFile: path.join(projectRoot, "cypress.config.ts"),
2527
env: {

0 commit comments

Comments
 (0)