@cypress/github-action 5.2.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -30
- package/action.yml +4 -0
- package/dist/index.js +643 -4776
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## Examples
|
|
6
6
|
|
|
7
|
-
- [
|
|
7
|
+
- [End-to-End](#end-to-end-testing) testing
|
|
8
|
+
- [Component](#component-testing) testing
|
|
8
9
|
- [Explicit version](#explicit-version)
|
|
9
10
|
- Run tests in a given [browser](#browser)
|
|
10
11
|
- using [Chrome](#chrome)
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
- Set Cypress [config values](#config)
|
|
24
25
|
- Use specific [config file](#config-file)
|
|
25
26
|
- Run tests in [parallel](#parallel)
|
|
26
|
-
-
|
|
27
|
+
- Combine [Component and E2E](#component-and-e2e-testing) testing
|
|
27
28
|
- [Build app](#build-app) before running the tests
|
|
28
29
|
- [Start server](#start-server) before running the tests
|
|
29
30
|
- [Start multiple servers](#start-multiple-servers) before running the tests
|
|
@@ -42,9 +43,14 @@
|
|
|
42
43
|
- [timeouts](#timeouts) to avoid hanging CI jobs
|
|
43
44
|
- [print Cypress info](#print-cypress-info) like detected browsers
|
|
44
45
|
- [run tests nightly](#nightly-tests) or on any schedule
|
|
46
|
+
- [Suppress test summary](#suppress-test-summary)
|
|
45
47
|
- [more examples](#more-examples)
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
Current examples contained in this repository are based on Cypress 12.x and can be found in the [examples](./examples) directory. Examples for [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration) use Cypress `9.7.0` and are kept in the [examples/v9](./examples/v9) directory.
|
|
50
|
+
|
|
51
|
+
Some older **external** examples, linked to by this document, are based solely on Cypress 9 and below and therefore use a [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration). These may need modification to be applied to Cypress 10 and later. Each of these external links is listed with a `(legacy)` notation.
|
|
52
|
+
|
|
53
|
+
### End-to-End Testing
|
|
48
54
|
|
|
49
55
|
```yml
|
|
50
56
|
name: End-to-end tests
|
|
@@ -61,12 +67,37 @@ jobs:
|
|
|
61
67
|
uses: cypress-io/github-action@v5
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
[](.github/workflows/example-basic.yml)
|
|
71
|
+
|
|
72
|
+
The workflow file [example-basic.yml](.github/workflows/example-basic.yml) shows how Cypress runs on GH Actions using Ubuntu (20 and 22), Windows, and macOS without additional OS dependencies necessary.
|
|
65
73
|
|
|
66
|
-
|
|
74
|
+
This workflow uses the default [test type](https://on.cypress.io/guides/overview/why-cypress#Test-types) of [End-to-End (E2E) Testing](https://on.cypress.io/guides/overview/why-cypress#End-to-end). Alternatively, [Component Testing](https://on.cypress.io/guides/overview/why-cypress#Component) can be utilized by referencing the [Component Testing](#component-testing) section below.
|
|
67
75
|
|
|
68
76
|
**Note:** this package assumes that `cypress` is declared as a development dependency in the `package.json` file. The `cypress` NPM module is required to run Cypress via its [NPM module API](https://on.cypress.io/module-api).
|
|
69
77
|
|
|
78
|
+
### Component Testing
|
|
79
|
+
|
|
80
|
+
To use [Cypress Component Testing](https://on.cypress.io/component-testing) add `component: true`
|
|
81
|
+
|
|
82
|
+
```yml
|
|
83
|
+
name: End-to-end tests
|
|
84
|
+
on: push
|
|
85
|
+
jobs:
|
|
86
|
+
cypress-run:
|
|
87
|
+
runs-on: ubuntu-22.04
|
|
88
|
+
steps:
|
|
89
|
+
- name: Checkout
|
|
90
|
+
uses: actions/checkout@v3
|
|
91
|
+
- name: Cypress run
|
|
92
|
+
uses: cypress-io/github-action@v5
|
|
93
|
+
with:
|
|
94
|
+
component: true
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
[](.github/workflows/example-component-test.yml)
|
|
98
|
+
|
|
99
|
+
See the example project [component-tests](examples/component-tests/) and the [example-component-test.yml](.github/workflows/example-component-test.yml) workflow for more details.
|
|
100
|
+
|
|
70
101
|
### Explicit version
|
|
71
102
|
|
|
72
103
|
**Best practice:**
|
|
@@ -134,7 +165,7 @@ name: Edge
|
|
|
134
165
|
on: push
|
|
135
166
|
jobs:
|
|
136
167
|
edge:
|
|
137
|
-
runs-on:
|
|
168
|
+
runs-on: ubuntu-22.04
|
|
138
169
|
name: E2E on Edge
|
|
139
170
|
steps:
|
|
140
171
|
- uses: actions/checkout@v3
|
|
@@ -437,7 +468,7 @@ See [Auto Cancellation](https://docs.cypress.io/guides/cloud/smart-orchestration
|
|
|
437
468
|
|
|
438
469
|
### Artifacts
|
|
439
470
|
|
|
440
|
-
If you don't record the test run on Cypress Cloud, you can still store generated videos and screenshots as CI artifacts. See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example) and the workflow example below
|
|
471
|
+
If you don't record the test run on Cypress Cloud, you can still store generated videos and screenshots as CI artifacts. See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example) (legacy) and the workflow example below
|
|
441
472
|
|
|
442
473
|
```yml
|
|
443
474
|
name: Artifacts
|
|
@@ -560,25 +591,22 @@ jobs:
|
|
|
560
591
|
|
|
561
592
|
The Cypress GH Action does not spawn or create any additional containers - it only links the multiple containers spawned using the matrix strategy into a single logical Cypress Cloud run and into splitting the specs amongst the machines. See the [Cypress parallelization](https://on.cypress.io/parallelization) guide for the explanation.
|
|
562
593
|
|
|
563
|
-
### Component
|
|
594
|
+
### Component and E2E Testing
|
|
564
595
|
|
|
565
|
-
|
|
596
|
+
[Component Testing](https://on.cypress.io/guides/overview/why-cypress#Component) and [End-to-End (E2E) Testing](https://on.cypress.io/guides/overview/why-cypress#End-to-end) types can be combined in the same job using separate steps
|
|
566
597
|
|
|
567
598
|
```yml
|
|
568
|
-
- name: Run E2E tests
|
|
599
|
+
- name: Run E2E tests
|
|
569
600
|
uses: cypress-io/github-action@v5
|
|
570
601
|
|
|
571
|
-
- name: Run Component
|
|
602
|
+
- name: Run Component Testing
|
|
572
603
|
uses: cypress-io/github-action@v5
|
|
573
604
|
with:
|
|
574
605
|
# we have already installed everything
|
|
575
606
|
install: false
|
|
576
|
-
# to run component tests we need to use "component: true"
|
|
577
607
|
component: true
|
|
578
608
|
```
|
|
579
609
|
|
|
580
|
-
See the example project [component-test](examples/component-tests/) and the [example-component-test-workflow](.github/workflows/example-component-test.yml) for more details.
|
|
581
|
-
|
|
582
610
|
### Build app
|
|
583
611
|
|
|
584
612
|
You can run a build step before starting tests
|
|
@@ -963,7 +991,7 @@ jobs:
|
|
|
963
991
|
working-directory: e2e
|
|
964
992
|
```
|
|
965
993
|
|
|
966
|
-
See [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) for example.
|
|
994
|
+
See [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) (legacy) for example.
|
|
967
995
|
|
|
968
996
|
### Yarn workspaces
|
|
969
997
|
|
|
@@ -1082,7 +1110,7 @@ See [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-m
|
|
|
1082
1110
|
|
|
1083
1111
|
### Custom install
|
|
1084
1112
|
|
|
1085
|
-
Finally, you might not need this GH Action at all. For example, if you want to split the NPM dependencies installation from the Cypress binary installation, then it makes no sense to use this action. Instead you can install and cache Cypress yourself. See [cypress-gh-action-split-install](https://github.com/bahmutov/cypress-gh-action-split-install) for working example.
|
|
1113
|
+
Finally, you might not need this GH Action at all. For example, if you want to split the NPM dependencies installation from the Cypress binary installation, then it makes no sense to use this action. Instead you can install and cache Cypress yourself. See [cypress-gh-action-split-install](https://github.com/bahmutov/cypress-gh-action-split-install) (legacy) for a working example.
|
|
1086
1114
|
|
|
1087
1115
|
### Install Cypress only
|
|
1088
1116
|
|
|
@@ -1124,23 +1152,22 @@ jobs:
|
|
|
1124
1152
|
timeout-minutes: 5
|
|
1125
1153
|
```
|
|
1126
1154
|
|
|
1127
|
-
See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example)
|
|
1155
|
+
See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example) (legacy).
|
|
1128
1156
|
|
|
1129
1157
|
### More examples
|
|
1130
1158
|
|
|
1131
1159
|
<!-- prettier-ignore-start -->
|
|
1132
|
-
Name
|
|
1133
|
-
|
|
1134
|
-
[cypress-gh-action-small-example](https://github.com/bahmutov/cypress-gh-action-small-example) | Runs tests and records them on Cypress Cloud
|
|
1135
|
-
[cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example)
|
|
1136
|
-
[cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo)
|
|
1137
|
-
[cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) | separate folder for Cypress dependencies
|
|
1138
|
-
[cypress-gh-action-split-install](https://github.com/bahmutov/cypress-gh-action-split-install) |
|
|
1139
|
-
[test-personal-site](https://github.com/bahmutov/test-personal-site) | Testing an external website every night and by manually clicking a button
|
|
1140
|
-
[cypress-gh-action-changed-files](https://github.com/bahmutov/cypress-gh-action-changed-files) | Shows how to run different Cypress projects depending on changed files
|
|
1141
|
-
[cypress-examples](https://github.com/bahmutov/cypress-examples)
|
|
1142
|
-
[cypress-gh-action-split-jobs](https://github.com/bahmutov/cypress-gh-action-split-jobs) | Shows a separate install job with the build step, and another job that runs the tests
|
|
1143
|
-
[cypress-react-component-example](https://github.com/bahmutov/cypress-react-component-example) | Run E2E and component tests using this action
|
|
1160
|
+
| Name | Description |
|
|
1161
|
+
| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
1162
|
+
| [cypress-gh-action-small-example](https://github.com/bahmutov/cypress-gh-action-small-example) (legacy) | Runs tests and records them on Cypress Cloud |
|
|
1163
|
+
| [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example) (legacy) | Uses Yarn, and runs in parallel on several versions of Node, different browsers, and more |
|
|
1164
|
+
| [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) | Splits install and running tests commands, runs Cypress from sub-folder |
|
|
1165
|
+
| [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) (legacy) | Has separate folder for Cypress dependencies |
|
|
1166
|
+
| [cypress-gh-action-split-install](https://github.com/bahmutov/cypress-gh-action-split-install) (legacy) | Only install NPM dependencies, then install and cache Cypress binary yourself |
|
|
1167
|
+
| [test-personal-site](https://github.com/bahmutov/test-personal-site) (legacy) | Testing an external website every night and by manually clicking a button |
|
|
1168
|
+
| [cypress-gh-action-changed-files](https://github.com/bahmutov/cypress-gh-action-changed-files) (legacy) | Shows how to run different Cypress projects depending on changed files |
|
|
1169
|
+
| [cypress-examples](https://github.com/bahmutov/cypress-examples) | Shows separate install job from parallel test jobs |
|
|
1170
|
+
| [cypress-gh-action-split-jobs](https://github.com/bahmutov/cypress-gh-action-split-jobs) (legacy) | Shows a separate install job with the build step, and another job that runs the tests |
|
|
1144
1171
|
<!-- prettier-ignore-end -->
|
|
1145
1172
|
|
|
1146
1173
|
## Notes
|
|
@@ -1256,7 +1283,7 @@ This GH Action sets an output `dashboardUrl` if the run was recorded on [Cypress
|
|
|
1256
1283
|
|
|
1257
1284
|
### Docker image
|
|
1258
1285
|
|
|
1259
|
-
If your repository does not have `package.json` or `yarn.json` (maybe it contains a static site and does not need any dependencies), you can run Cypress tests using `cypress/included:...` [Cypress Docker images](https://github.com/cypress-io/cypress-docker-images/tree/master/included). In that case you don't even need this GH Action, instead use the Docker container and write `cypress run` command like this example from [cypress-gh-action-included](https://github.com/bahmutov/cypress-gh-action-included)
|
|
1286
|
+
If your repository does not have `package.json` or `yarn.json` (maybe it contains a static site and does not need any dependencies), you can run Cypress tests using `cypress/included:...` [Cypress Docker images](https://github.com/cypress-io/cypress-docker-images/tree/master/included). In that case you don't even need this GH Action, instead use the Docker container and write `cypress run` command like this example from [cypress-gh-action-included](https://github.com/bahmutov/cypress-gh-action-included) (legacy)
|
|
1260
1287
|
|
|
1261
1288
|
```yml
|
|
1262
1289
|
name: included
|
|
@@ -1343,6 +1370,27 @@ See the [example-cron.yml](./.github/workflows/example-cron.yml) workflow.
|
|
|
1343
1370
|
|
|
1344
1371
|
[](.github/workflows/example-cron.yml)
|
|
1345
1372
|
|
|
1373
|
+
### Suppress test summary
|
|
1374
|
+
|
|
1375
|
+
The default test summary can be suppressed by using the parameter `publish-summary` and setting its value to `false`.
|
|
1376
|
+
Sometimes users want to publish test summary using a specific action.
|
|
1377
|
+
For example, a user running Cypress tests using a matrix and wants to retrieve the test summary for each matrix job and use a specific action that merges reports.
|
|
1378
|
+
|
|
1379
|
+
```yml
|
|
1380
|
+
name: Example no summary
|
|
1381
|
+
on: push
|
|
1382
|
+
jobs:
|
|
1383
|
+
cypress-run:
|
|
1384
|
+
runs-on: ubuntu-22.04
|
|
1385
|
+
steps:
|
|
1386
|
+
- name: Checkout
|
|
1387
|
+
uses: actions/checkout@v3
|
|
1388
|
+
- name: Cypress run
|
|
1389
|
+
uses: cypress-io/github-action@v5
|
|
1390
|
+
with:
|
|
1391
|
+
publish-summary: false
|
|
1392
|
+
```
|
|
1393
|
+
|
|
1346
1394
|
## Changelog
|
|
1347
1395
|
|
|
1348
1396
|
See [Releases](https://github.com/cypress-io/github-action/releases) for full details of changes.
|
|
@@ -1355,6 +1403,8 @@ See [Releases](https://github.com/cypress-io/github-action/releases) for full de
|
|
|
1355
1403
|
| v2 | Cypress runs using the [NPM module API](https://docs.cypress.io/guides/guides/module-api) instead of being started via the command line. |
|
|
1356
1404
|
| v1 | *This version is no longer runnable in GitHub due to security changes.* |
|
|
1357
1405
|
|
|
1406
|
+
*Note: [GitHub announced](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/) their plan to disable `save-state` and `set-output` commands by May 31, 2023. This will prevent [cypress-io/github-action](https://github.com/cypress-io/github-action) version [v4.2.1](https://github.com/cypress-io/github-action/releases/tag/v4.2.1), and earlier, running after this date since they use `set-output`. Affected users should update to using `v5` of the [cypress-io/github-action](https://github.com/cypress-io/github-action) action before the deadline.*
|
|
1407
|
+
|
|
1358
1408
|
## License
|
|
1359
1409
|
|
|
1360
1410
|
[MIT License](./LICENSE.md)
|
package/action.yml
CHANGED
|
@@ -65,6 +65,10 @@ inputs:
|
|
|
65
65
|
headed:
|
|
66
66
|
description: 'Whether or not to use headed mode'
|
|
67
67
|
required: false
|
|
68
|
+
publish-summary:
|
|
69
|
+
description: 'Whether or not to publish job summary'
|
|
70
|
+
required: false
|
|
71
|
+
default: true
|
|
68
72
|
spec:
|
|
69
73
|
description: 'Provide a specific specs to run'
|
|
70
74
|
required: false
|