@cypress/github-action 5.3.0 → 5.4.0

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.
Files changed (3) hide show
  1. package/README.md +73 -19
  2. package/dist/index.js +641 -4775
  3. package/package.json +3 -4
package/README.md CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  ## Examples
6
6
 
7
- - [Basic](#basic)
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
- - Run E2E and [Component tests](#component-tests)
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
@@ -34,6 +35,8 @@
34
35
  - pass [custom build id](#custom-build-id) when recording to Cypress Cloud
35
36
  - generate a [robust custom build id](#robust-custom-build-id) to allow re-running the workflow
36
37
  - use different [working-directory](#working-directory)
38
+ - use [Yarn Classic](#yarn-classic)
39
+ - use [Yarn workspaces](#yarn-workspaces)
37
40
  - use [custom cache key](#custom-cache-key)
38
41
  - run tests on multiple [Node versions](#node-versions)
39
42
  - split [install and tests](#split-install-and-tests) into separate jobs
@@ -49,7 +52,7 @@ Current examples contained in this repository are based on Cypress 12.x and can
49
52
 
50
53
  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.
51
54
 
52
- ### Basic
55
+ ### End-to-End Testing
53
56
 
54
57
  ```yml
55
58
  name: End-to-end tests
@@ -66,12 +69,37 @@ jobs:
66
69
  uses: cypress-io/github-action@v5
67
70
  ```
68
71
 
69
- [![Basic example](https://github.com/cypress-io/github-action/workflows/example-basic/badge.svg?branch=master)](.github/workflows/example-basic.yml)
72
+ [![End-to-End example](https://github.com/cypress-io/github-action/workflows/example-basic/badge.svg?branch=master)](.github/workflows/example-basic.yml)
70
73
 
71
- The workflow file [.github/workflows/example-basic.yml](.github/workflows/example-basic.yml) shows how Cypress runs on GH Actions using Ubuntu (20 and 22), on Windows, and on Mac without additional OS dependencies necessary.
74
+ 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.
75
+
76
+ 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.
72
77
 
73
78
  **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).
74
79
 
80
+ ### Component Testing
81
+
82
+ To use [Cypress Component Testing](https://on.cypress.io/component-testing) add `component: true`
83
+
84
+ ```yml
85
+ name: End-to-end tests
86
+ on: push
87
+ jobs:
88
+ cypress-run:
89
+ runs-on: ubuntu-22.04
90
+ steps:
91
+ - name: Checkout
92
+ uses: actions/checkout@v3
93
+ - name: Cypress run
94
+ uses: cypress-io/github-action@v5
95
+ with:
96
+ component: true
97
+ ```
98
+
99
+ [![Component Testing example](https://github.com/cypress-io/github-action/workflows/example-component-test/badge.svg?branch=master)](.github/workflows/example-component-test.yml)
100
+
101
+ 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.
102
+
75
103
  ### Explicit version
76
104
 
77
105
  **Best practice:**
@@ -139,7 +167,7 @@ name: Edge
139
167
  on: push
140
168
  jobs:
141
169
  edge:
142
- runs-on: windows-latest
170
+ runs-on: ubuntu-22.04
143
171
  name: E2E on Edge
144
172
  steps:
145
173
  - uses: actions/checkout@v3
@@ -565,25 +593,22 @@ jobs:
565
593
 
566
594
  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.
567
595
 
568
- ### Component tests
596
+ ### Component and E2E Testing
569
597
 
570
- You can run [Cypress component tests](https://on.cypress.io/component-testing) in a job separate from E2E tests by adding `component: true`:
598
+ [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
571
599
 
572
600
  ```yml
573
- - name: Run E2E tests 🧪
601
+ - name: Run E2E tests
574
602
  uses: cypress-io/github-action@v5
575
603
 
576
- - name: Run Component tests 🧪
604
+ - name: Run Component Testing
577
605
  uses: cypress-io/github-action@v5
578
606
  with:
579
607
  # we have already installed everything
580
608
  install: false
581
- # to run component tests we need to use "component: true"
582
609
  component: true
583
610
  ```
584
611
 
585
- See the example project [component-test](examples/component-tests/) and the [example-component-test-workflow](.github/workflows/example-component-test.yml) for more details.
586
-
587
612
  ### Build app
588
613
 
589
614
  You can run a build step before starting tests
@@ -732,7 +757,7 @@ You can even use your own command (usually by using `npm`, `yarn`, `npx`) to wai
732
757
  - uses: cypress-io/github-action@v5
733
758
  with:
734
759
  start: npm start
735
- wait-on: 'npx wait-on --timeout 5000 http://localhost:3000'
760
+ wait-on: 'npx wait-on --timeout 60000 http://localhost:3000'
736
761
  ```
737
762
 
738
763
  See [example-wait-on.yml](.github/workflows/example-wait-on.yml) workflow file.
@@ -970,6 +995,31 @@ jobs:
970
995
 
971
996
  See [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) (legacy) for example.
972
997
 
998
+ ### Yarn Classic
999
+
1000
+ If a `yarn.lock` file is found, the action uses the [Yarn 1 (Classic)](https://classic.yarnpkg.com/) command `yarn --frozen-lockfile` by default to install dependencies.
1001
+
1002
+ ```yaml
1003
+ name: example-yarn-classic
1004
+ on: push
1005
+ jobs:
1006
+ yarn-classic:
1007
+ runs-on: ubuntu-22.04
1008
+ steps:
1009
+ - name: Checkout
1010
+ uses: actions/checkout@v3
1011
+ - name: Cypress run
1012
+ uses: cypress-io/github-action@v5
1013
+ with:
1014
+ working-directory: examples/yarn-classic
1015
+ ```
1016
+
1017
+ See [example-yarn-classic.yml](.github/workflows/example-yarn-classic.yml) for an example.
1018
+
1019
+ [![Yarn classic example](https://github.com/cypress-io/github-action/workflows/example-yarn-classic/badge.svg?branch=master)](.github/workflows/example-yarn-classic.yml)
1020
+
1021
+ See below under [Yarn Modern](#yarn-modern) (version 2 and later) for instructions on installing dependencies using this later version.
1022
+
973
1023
  ### Yarn workspaces
974
1024
 
975
1025
  This action should discover the Yarn workspaces correctly. For example, see folder [examples/start-and-yarn-workspaces](examples/start-and-yarn-workspaces) and workflow file [example-start-and-yarn-workspaces.yml](.github/workflows/example-start-and-yarn-workspaces.yml)
@@ -1141,11 +1191,9 @@ See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-ex
1141
1191
  | [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) | Splits install and running tests commands, runs Cypress from sub-folder |
1142
1192
  | [cypress-gh-action-subfolders](https://github.com/bahmutov/cypress-gh-action-subfolders) (legacy) | Has separate folder for Cypress dependencies |
1143
1193
  | [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 |
1144
- | [test-personal-site](https://github.com/bahmutov/test-personal-site) (legacy) | Testing an external website every night and by manually clicking a button |
1145
1194
  | [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 |
1146
1195
  | [cypress-examples](https://github.com/bahmutov/cypress-examples) | Shows separate install job from parallel test jobs |
1147
1196
  | [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 |
1148
- | [cypress-react-component-example](https://github.com/bahmutov/cypress-react-component-example) (legacy) | Run E2E and component tests using this action |
1149
1197
  <!-- prettier-ignore-end -->
1150
1198
 
1151
1199
  ## Notes
@@ -1154,7 +1202,9 @@ See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-ex
1154
1202
 
1155
1203
  This action installs local dependencies using lock files. If `yarn.lock` file is found, the install uses `yarn --frozen-lockfile` command. Otherwise it expects to find `package-lock.json` and install using `npm ci` command.
1156
1204
 
1157
- The above default `yarn` installation command can be replaced for [Yarn Berry](https://yarnpkg.com/) (Yarn 2 and later) using the `install-command` parameter, for example:
1205
+ #### Yarn Modern
1206
+
1207
+ The above default `yarn` installation command can be replaced for [Yarn Modern](https://yarnpkg.com/) (Yarn 2 and later) using the `install-command` parameter, for example:
1158
1208
 
1159
1209
  ```yml
1160
1210
  - uses: cypress-io/github-action@v5
@@ -1162,7 +1212,9 @@ The above default `yarn` installation command can be replaced for [Yarn Berry](h
1162
1212
  install-command: yarn install
1163
1213
  ```
1164
1214
 
1165
- This action uses several production dependencies. The minimum Node version required to run this action depends on the minimum Node required by the dependencies.
1215
+ #### Minimum Node.js
1216
+
1217
+ This action uses several production dependencies. The minimum Node version required to run this action depends on the minimum Node version required by the dependencies.
1166
1218
 
1167
1219
  ## Debugging
1168
1220
 
@@ -1351,7 +1403,7 @@ See the [example-cron.yml](./.github/workflows/example-cron.yml) workflow.
1351
1403
  ### Suppress test summary
1352
1404
 
1353
1405
  The default test summary can be suppressed by using the parameter `publish-summary` and setting its value to `false`.
1354
- Sometimes users want to publish test summary using a specific action.
1406
+ Sometimes users want to publish test summary using a specific action.
1355
1407
  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.
1356
1408
 
1357
1409
  ```yml
@@ -1381,6 +1433,8 @@ See [Releases](https://github.com/cypress-io/github-action/releases) for full de
1381
1433
  | v2 | Cypress runs using the [NPM module API](https://docs.cypress.io/guides/guides/module-api) instead of being started via the command line. |
1382
1434
  | v1 | *This version is no longer runnable in GitHub due to security changes.* |
1383
1435
 
1436
+ *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.*
1437
+
1384
1438
  ## License
1385
1439
 
1386
1440
  [MIT License](./LICENSE.md)