@cypress/github-action 5.7.1 → 5.8.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.
package/README.md CHANGED
@@ -55,6 +55,10 @@
55
55
 
56
56
  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.
57
57
 
58
+ Live examples, such as [example-basic.yml](.github/workflows/example-basic.yml) are shown together with a status badge. Click on the status badge to read the source code of the workflow, for example
59
+
60
+ [![End-to-End example](https://github.com/cypress-io/github-action/workflows/example-basic/badge.svg?branch=master)](.github/workflows/example-basic.yml)
61
+
58
62
  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.
59
63
 
60
64
  **Note:** this package assumes that [cypress](https://www.npmjs.com/package/cypress) is declared as a development dependency in the [package.json](https://docs.npmjs.com/creating-a-package-json-file) file. The [cypress npm module](https://www.npmjs.com/package/cypress) is required to run Cypress via its [Module API](https://on.cypress.io/module-api).
@@ -262,7 +266,7 @@ jobs:
262
266
  CYPRESS_port: 4222
263
267
  ```
264
268
 
265
- For more examples, see the workflow example below.
269
+ For more examples, see the workflows below, using environment variables for [recording](#record-test-results-on-cypress-cloud).
266
270
 
267
271
  [![Env example](https://github.com/cypress-io/github-action/workflows/example-env/badge.svg?branch=master)](.github/workflows/example-env.yml)
268
272
 
@@ -287,7 +291,7 @@ jobs:
287
291
  spec: cypress/e2e/spec1.cy.js
288
292
  ```
289
293
 
290
- You can pass multiple specs and wild card patterns using multi-line parameter, see [example-config.yml](./.github/workflows/example-config.yml):
294
+ You can pass multiple specs and wild card patterns using multi-line parameter, see [example-config.yml](.github/workflows/example-config.yml):
291
295
 
292
296
  ```yml
293
297
  spec: |
@@ -345,13 +349,13 @@ jobs:
345
349
 
346
350
  [![recording example](https://github.com/cypress-io/github-action/workflows/example-recording/badge.svg?branch=master)](.github/workflows/example-recording.yml)
347
351
 
348
- **Tip 1:** We recommend using the action with `on: [push]` instead of `on: [pull_request]` to get the most accurate information related to the commit on the dashboard. With pull requests, the merge commit is created automatically and might not correspond to a meaningful commit in the repository.
352
+ **Tip 1:** We recommend using the action with `on: push` instead of `on: pull_request` to get the most accurate information related to the commit on Cypress Cloud. With pull requests, the merge commit is created automatically and might not correspond to a meaningful commit in the repository.
349
353
 
350
354
  **Tip 2:** we recommend passing the `GITHUB_TOKEN` secret (created by the GH Action automatically) as an environment variable. This will allow correctly identifying every build and avoid confusion when re-running a build.
351
355
 
352
356
  **Tip 3:** if running on `pull_request` event, the commit message is "merge SHA into SHA", which is not what you want probably. You can overwrite the commit message sent to Cypress Cloud by setting an environment variable. See [issue 124](https://github.com/cypress-io/github-action/issues/124#issuecomment-653180260) for details.
353
357
 
354
- **Tip 4:** to record the project needs `projectId`. Typically this value is saved in the `cypress.json` file. If you want to avoid this, pass the project id using an environment variable:
358
+ **Tip 4:** to record the project needs `projectId`. Typically this value is saved in the [Cypress Configuration File](https://docs.cypress.io/guides/references/configuration#Configuration-File). If you want to avoid this, pass the `projectId` using an environment variable:
355
359
 
356
360
  ```yml
357
361
  name: Cypress tests
@@ -554,7 +558,7 @@ jobs:
554
558
 
555
559
  ### Parallel
556
560
 
557
- **Note:** Cypress parallelization requires a [Cypress Cloud](https://on.cypress.io/dashboard-introduction) account.
561
+ **Note:** Cypress parallelization requires a [Cypress Cloud](https://on.cypress.io/cloud-introduction) account.
558
562
 
559
563
  You can spin multiple containers running in parallel using `strategy: matrix` argument. Just add more dummy items to the `containers: [1, 2, ...]` array to spin more free or paid containers. Then use `record` and `parallel` parameters to [load balance tests](https://on.cypress.io/parallelization).
560
564
 
@@ -618,6 +622,8 @@ During staged rollout of a new GitHub-hosted runner version, GitHub may provide
618
622
  component: true
619
623
  ```
620
624
 
625
+ See the example project [component-test](examples/component-tests/) and the [example-component-test.yml](.github/workflows/example-component-test.yml) workflow for more details.
626
+
621
627
  ### Build app
622
628
 
623
629
  You can run a build step before starting tests
@@ -639,7 +645,7 @@ jobs:
639
645
 
640
646
  ### Start server
641
647
 
642
- If your tests run against a local server, use `start` parameter, the server will run in the background and will shut down after tests complete
648
+ If your tests run against a local server, use the `start` parameter to start your server. The server will run in the background.
643
649
 
644
650
  ```yml
645
651
  name: With server
@@ -656,7 +662,7 @@ jobs:
656
662
  start: npm start
657
663
  ```
658
664
 
659
- **Note:** sometimes on Windows you need to run a different start command. You can use `start-windows` parameter for this
665
+ **Note:** sometimes on Windows you need to run a different start command. You can use the `start-windows` parameter for this.
660
666
 
661
667
  ```yml
662
668
  name: With server
@@ -678,7 +684,7 @@ jobs:
678
684
 
679
685
  [![start example](https://github.com/cypress-io/github-action/workflows/example-start/badge.svg?branch=master)](.github/workflows/example-start.yml)
680
686
 
681
- **Note:** GitHub cleans up the running server processes automatically. This action does not stop them.
687
+ **Note:** A server continues to run until the end of the GitHub workflow job that started it. At the end of the job the GitHub workflow runner executes a "Complete job" phase automatically where it terminates any server processes which are still running.
682
688
 
683
689
  ### Start multiple servers
684
690
 
@@ -733,6 +739,8 @@ jobs:
733
739
 
734
740
  [![wait-on example](https://github.com/cypress-io/github-action/workflows/example-wait-on/badge.svg?branch=master)](.github/workflows/example-wait-on.yml)
735
741
 
742
+ [![Webpack Dev Server example](https://github.com/cypress-io/github-action/workflows/example-webpack/badge.svg?branch=master)](.github/workflows/example-webpack.yml) (also uses `wait-on`)
743
+
736
744
  By default, `wait-on` will retry for 60 seconds. You can pass a custom timeout in seconds using `wait-on-timeout`.
737
745
 
738
746
  ```yml
@@ -744,7 +752,7 @@ By default, `wait-on` will retry for 60 seconds. You can pass a custom timeout i
744
752
  wait-on-timeout: 120
745
753
  ```
746
754
 
747
- See also [![Webpack Dev Server example](https://github.com/cypress-io/github-action/workflows/example-webpack/badge.svg?branch=master)](.github/workflows/example-webpack.yml)
755
+
748
756
 
749
757
  You can wait for multiple URLs to respond by separating urls with a comma
750
758
 
@@ -760,7 +768,7 @@ You can wait for multiple URLs to respond by separating urls with a comma
760
768
 
761
769
  The action will wait for the first url to respond, then will check the second url, and so on.
762
770
 
763
- You can even use your own command (usually by using `npm`, `yarn`, `npx`) to wait for the server to respond. For example, if you want to use [wait-on](https://github.com/jeffbski/wait-on) utility to ping the server and run the Cypress tests after the server responds:
771
+ You can even use your own command (usually by using `npm`, `yarn`, `npx`) to wait for the server to respond. For example, if you want to use the [wait-on](https://github.com/jeffbski/wait-on) utility to ping the server and run the Cypress tests after the server responds:
764
772
 
765
773
  ```yml
766
774
  - uses: cypress-io/github-action@v5
@@ -834,7 +842,7 @@ steps:
834
842
 
835
843
  **Caution**: using the action parameter `command` causes multiple other parameters to be ignored including: `auto-cancel-after-failures`, `browser`, `ci-build-id`, `command-prefix`, `component`, `config`, `config-file`, `env`, `group`, `headed`, `parallel`, `project`, `publish-summary`, `quiet`, `record`, `spec` and `tag`.
836
844
 
837
- See [.github/workflows/example-custom-command.yml](.github/workflows/example-custom-command.yml) file.
845
+ See [example-custom-command.yml](.github/workflows/example-custom-command.yml) file.
838
846
 
839
847
  ### Custom build id
840
848
 
@@ -868,7 +876,7 @@ jobs:
868
876
 
869
877
  ### Robust custom build id
870
878
 
871
- If you re-run the GitHub workflow, if you use the same custom build id during recording, Cypress Cloud will cancel the run with "Build already finished" error. To avoid this, you need to generate a _new_ custom build id on every workflow re-run. A good solution showing in the [example-custom-ci-build-id.yml](./.github/workflows/example-custom-ci-build-id.yml) file is to run a common job first that just generates a new random ID. This ID can be used by the testing jobs to tie the build together. If the user re-runs the workflow a new unique build id is generated, allowing recording the new Cypress Cloud run.
879
+ If you re-run the GitHub workflow, if you use the same custom build id during recording, Cypress Cloud will cancel the run with "Build already finished" error. To avoid this, you need to generate a _new_ custom build id on every workflow re-run. A good solution showing in the [example-custom-ci-build-id.yml](.github/workflows/example-custom-ci-build-id.yml) file is to run a common job first that just generates a new random ID. This ID can be used by the testing jobs to tie the build together. If the user re-runs the workflow a new unique build id is generated, allowing recording the new Cypress Cloud run.
872
880
 
873
881
  ```yml
874
882
  jobs:
@@ -897,7 +905,7 @@ jobs:
897
905
  CYPRESS_RECORD_KEY: ${{ secrets.EXAMPLE_RECORDING_KEY }}
898
906
  ```
899
907
 
900
- See the [example-custom-ci-build-id.yml](./.github/workflows/example-custom-ci-build-id.yml) for the full workflow
908
+ See the [example-custom-ci-build-id.yml](.github/workflows/example-custom-ci-build-id.yml) for the full workflow.
901
909
 
902
910
  ### Working directory
903
911
 
@@ -1050,8 +1058,6 @@ jobs:
1050
1058
  working-directory: examples/yarn-classic
1051
1059
  ```
1052
1060
 
1053
- See [example-yarn-classic.yml](.github/workflows/example-yarn-classic.yml) for an example.
1054
-
1055
1061
  [![Yarn classic example](https://github.com/cypress-io/github-action/workflows/example-yarn-classic/badge.svg?branch=master)](.github/workflows/example-yarn-classic.yml)
1056
1062
 
1057
1063
  ### Yarn Modern
@@ -1074,8 +1080,6 @@ jobs:
1074
1080
  install-command: yarn install
1075
1081
  ```
1076
1082
 
1077
- See [example-yarn-modern.yml](.github/workflows/example-yarn-modern.yml) for an example.
1078
-
1079
1083
  [![Yarn Modern example](https://github.com/cypress-io/github-action/workflows/example-yarn-modern/badge.svg?branch=master)](.github/workflows/example-yarn-modern.yml)
1080
1084
 
1081
1085
  ### Yarn Plug'n'Play
@@ -1214,7 +1218,7 @@ jobs:
1214
1218
  working-directory: e2e
1215
1219
  ```
1216
1220
 
1217
- See [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) for working example.
1221
+ See [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) for a working example.
1218
1222
 
1219
1223
  ### Custom install
1220
1224
 
@@ -1238,8 +1242,6 @@ If the project has many dependencies, but you want to install just Cypress you c
1238
1242
  install: false
1239
1243
  ```
1240
1244
 
1241
- See [.github/workflows/example-install-only.yml](.github/workflows/example-install-only.yml) file.
1242
-
1243
1245
  [![Install only Cypress example](https://github.com/cypress-io/github-action/workflows/example-install-only/badge.svg?branch=master)](.github/workflows/example-install-only.yml)
1244
1246
 
1245
1247
  ### Timeouts
@@ -1274,7 +1276,7 @@ See [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-ex
1274
1276
  | [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 |
1275
1277
  | [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 |
1276
1278
  | [cypress-examples](https://github.com/bahmutov/cypress-examples) | Shows separate install job from parallel test jobs |
1277
- | [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 |
1279
+ | [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 |
1278
1280
  <!-- prettier-ignore-end -->
1279
1281
 
1280
1282
  ## Notes
@@ -1308,7 +1310,7 @@ You can set the environment variable using GitHub UI interface, or in the workfl
1308
1310
  DEBUG: '@cypress/github-action'
1309
1311
  ```
1310
1312
 
1311
- See the [example-debug.yml](./.github/workflows/example-debug.yml) workflow file.
1313
+ See the [example-debug.yml](.github/workflows/example-debug.yml) workflow file.
1312
1314
 
1313
1315
  ### Logs from the test runner
1314
1316
 
@@ -1357,9 +1359,9 @@ If you add `workflow_dispatch` event to your workflow, you will be able to start
1357
1359
 
1358
1360
  ### Outputs
1359
1361
 
1360
- This action sets a GitHub step output `dashboardUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/dashboard-introduction) using the action parameter setting `record: true` (see [Record test results on Cypress Cloud](#record-test-results-on-cypress-cloud)). Note that using a [Custom test command](#custom-test-command) with the `command` parameter overrides the `record` parameter and in this case no `dashboardUrl` step output is saved.
1362
+ This action sets a GitHub step output `resultsUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/cloud-introduction) using the action parameter setting `record: true` (see [Record test results on Cypress Cloud](#record-test-results-on-cypress-cloud)). Note that using a [Custom test command](#custom-test-command) with the `command` parameter overrides the `record` parameter and in this case no `resultsUrl` step output is saved.
1361
1363
 
1362
- This is an example of using the step output `dashboardUrl`:
1364
+ This is an example of using the step output `resultsUrl`:
1363
1365
 
1364
1366
  ```yml
1365
1367
  - name: Cypress tests
@@ -1377,9 +1379,11 @@ This is an example of using the step output `dashboardUrl`:
1377
1379
  - name: Print Cypress Cloud URL
1378
1380
  run: |
1379
1381
  echo Cypress finished with: ${{ steps.cypress.outcome }}
1380
- echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
1382
+ echo See results at ${{ steps.cypress.outputs.resultsUrl }}
1381
1383
  ```
1382
1384
 
1385
+ The GitHub step output `dashboardUrl` is deprecated. Cypress Dashboard is now [Cypress Cloud](https://on.cypress.io/cloud-introduction).
1386
+
1383
1387
  [![recording example](https://github.com/cypress-io/github-action/workflows/example-recording/badge.svg?branch=master)](.github/workflows/example-recording.yml)
1384
1388
 
1385
1389
  **Note:** every GitHub workflow step can have `outcome` and `conclusion` properties. See the GitHub [Contexts](https://docs.github.com/en/actions/learn-github-actions/contexts) documentation section [steps context](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context). In particular, the `outcome` or `conclusion` value can be `success`, `failure`, `cancelled`, or `skipped` which you can use in any following steps.
@@ -1451,8 +1455,6 @@ jobs:
1451
1455
  uses: cypress-io/github-action@v5
1452
1456
  ```
1453
1457
 
1454
- See the [example-cron.yml](./.github/workflows/example-cron.yml) workflow.
1455
-
1456
1458
  [![cron example](https://github.com/cypress-io/github-action/workflows/example-cron/badge.svg?branch=master)](.github/workflows/example-cron.yml)
1457
1459
 
1458
1460
  ### Suppress test summary
package/action.yml CHANGED
@@ -4,7 +4,7 @@ description: 'GitHub Action for running Cypress end-to-end and component tests'
4
4
  author: 'Cypress-io'
5
5
  inputs:
6
6
  record:
7
- description: 'Sends test results to Cypress Dashboard'
7
+ description: 'Sends test results to Cypress Cloud'
8
8
  required: false
9
9
  default: false
10
10
  auto-cancel-after-failures:
@@ -93,7 +93,9 @@ inputs:
93
93
  default: false
94
94
  outputs:
95
95
  dashboardUrl:
96
- description: 'Cypress Dashboard URL if the run was recorded'
96
+ description: 'Cypress Cloud URL if the run was recorded (deprecated)'
97
+ resultsUrl:
98
+ description: 'Cypress Cloud URL if the run was recorded'
97
99
  runs:
98
100
  using: 'node16'
99
101
  main: 'dist/index.js'
package/dist/index.js CHANGED
@@ -75091,7 +75091,7 @@ const runTests = async () => {
75091
75091
  debug(`Cypress options ${JSON.stringify(cypressOptions)}`)
75092
75092
 
75093
75093
  const onTestsFinished = (testResults) => {
75094
- const dashboardUrl = testResults.runUrl
75094
+ const resultsUrl = testResults.runUrl
75095
75095
  process.chdir(startWorkingDirectory)
75096
75096
 
75097
75097
  if (testResults.failures) {
@@ -75112,14 +75112,15 @@ const runTests = async () => {
75112
75112
 
75113
75113
  debug(`Cypress tests: ${testResults.totalFailed} failed`)
75114
75114
 
75115
- if (dashboardUrl) {
75116
- debug(`Dashboard url ${dashboardUrl}`)
75115
+ if (resultsUrl) {
75116
+ debug(`resultsUrl ${resultsUrl}`)
75117
75117
  } else {
75118
- debug('There is no Dashboard url')
75118
+ debug('There is no resultsUrl')
75119
75119
  }
75120
75120
 
75121
75121
  // we still set the output explicitly
75122
- core.setOutput('dashboardUrl', dashboardUrl)
75122
+ core.setOutput('dashboardUrl', resultsUrl) // deprecated and retained for backward compatibility
75123
+ core.setOutput('resultsUrl', resultsUrl) // replacement for dashboardUrl
75123
75124
 
75124
75125
  if (testResults.totalFailed) {
75125
75126
  return Promise.reject(
@@ -75180,7 +75181,7 @@ const generateSummary = async (testResults) => {
75180
75181
  .addHeading('Cypress Results', 2)
75181
75182
  .addTable([headers, summaryRows])
75182
75183
  .addLink(
75183
- testResults.runUrl ? 'View Run in Dashboard' : '',
75184
+ testResults.runUrl ? 'View run in Cypress Cloud' : '',
75184
75185
  testResults.runUrl || ''
75185
75186
  )
75186
75187
  .write()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/github-action",
3
- "version": "5.7.1",
3
+ "version": "5.8.0",
4
4
  "description": "GitHub Action for running Cypress end-to-end and component tests",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "supports-color": "9.3.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "18.16.1",
49
+ "@types/node": "18.16.14",
50
50
  "@vercel/ncc": "0.36.1",
51
51
  "husky": "8.0.3",
52
52
  "markdown-link-check": "3.11.1",