You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1431,6 +1431,68 @@ jobs:
1431
1431
| [cypress-examples](https://github.com/bahmutov/cypress-examples) | Shows separate install job from parallel test jobs |
1432
1432
| [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 |
1433
1433
1434
+
## Migration
1435
+
1436
+
### Migrating from CLI command
1437
+
1438
+
To migrate from Cypress [CLI run command options](https://on.cypress.io/command-line#Options) to Cypress GitHub Action parameters, check the [CLI Run Option / Action Parameter](#cli-run-option--action-parameter) table below. In most cases, the name of the action parameter is the same as the long form of the `cypress run` CLI option.
1439
+
1440
+
Create a [GitHub Actions workflow](https://docs.github.com/en/actions/writing-workflows/quickstart) referring to [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions). The action `cypress-io/github-action@v6` is invoked with the `uses` keyword. Cypress GitHub Action input parameters are specified under the [with](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith) keyword.
1441
+
1442
+
If you have previously been using a [CLI command](https://on.cypress.io/command-line#cypress-run) to run Cypress locally or in a CI environment, you will be familiar with testing commands like this:
1443
+
1444
+
```shell
1445
+
npx cypress run --spec cypress/e2e/spec.cy.js --browser chrome
1446
+
```
1447
+
1448
+
or you may be using a script defined in your project's `package.json` file, such as:
1449
+
1450
+
```json
1451
+
"cy:e2e:chrome": "cypress run --spec cypress/e2e/spec.cy.js --browser chrome"
1452
+
```
1453
+
1454
+
Here is the equivalent GitHub Actions example workflow. The action runs Cypress by passing the action parameters (`browser` and `spec`) programmatically to the [Cypress Module API](https://on.cypress.io/module-api) without using any CLI. The complete workflow also checks out the repo and installs dependencies before running Cypress.
1455
+
1456
+
```yml
1457
+
name: CLI migration example
1458
+
on: push
1459
+
jobs:
1460
+
cypress-run:
1461
+
runs-on: ubuntu-24.04
1462
+
steps:
1463
+
- name: Check out repo
1464
+
uses: actions/checkout@v4
1465
+
- name: Cypress run # install dependencies and run Cypress E2E tests
1466
+
uses: cypress-io/github-action@v6 # replaces CLI cypress run
| `--auto-cancel-after-failures` | [`auto-cancel-after-failures`](#auto-cancel-after-failures) | Set the failed test threshold for auto cancellation or disable auto cancellation for Cloud recording |
1477
+
| `--browser`, `-b` | [`browser`](#browser) | Select browser that Cypress runs in. A filesystem path to a browser can also be used. |
1478
+
| `--ci-build-id` | [`ci-build-id`](#custom-build-id) | Specify a unique identifier for a run to enable grouping or parallelization for Cloud recording |
1479
+
| `--component` | [`component`](#component-testing) | Run component tests |
| `--record` | [`record`](#record-test-results-on-cypress-cloud) | Record the test run to Cypress Cloud |
1491
+
| `--spec`, `-s` | [`spec`](#specs) | Specify the spec files to run |
1492
+
| `--tag`, `-t` | [`tag`](#tag-recordings) | Identify a run with a tag or tags |
1493
+
1494
+
There is no equivalent action parameter for the CLI options `help`, `key`, `--no-exit`, `--no-runner-ui`, `port`, `reporter`, `reporter-options` or `runner-ui`. See the section [Record test results on Cypress Cloud](#record-test-results-on-cypress-cloud) for information on passing a Cypress Cloud record key to the action.
0 commit comments