Skip to content

Commit

Permalink
test: demonstrate config-file parameter (cypress-io#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 authored Oct 10, 2023
1 parent bd9dda3 commit 4581de4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ jobs:
wait-on: 'http://localhost:3333'
config: baseUrl=http://localhost:3333

config-file:
# example where we use a custom config-file
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cypress tests
uses: ./
with:
working-directory: examples/config
build: npm run build
start: npm start
wait-on: 'http://localhost:3333'
config-file: cypress.config-alternate.js

separate-specs:
# example where we pass specs to run via multiple lines
runs-on: ubuntu-22.04
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ jobs:

### Config File

Specify the path to your config file with `config-file` parameter
Specify the path to your [Configuration File](https://on.cypress.io/guides/references/configuration#Configuration-File) with `config-file` parameter

```yml
name: Cypress tests
Expand All @@ -563,9 +563,11 @@ jobs:
- name: Cypress run
uses: cypress-io/github-action@v6
with:
config-file: tests/cypress-config.json
config-file: cypress.config-alternate.js
```

[![example-config](https://github.com/cypress-io/github-action/workflows/example-config/badge.svg?branch=master)](.github/workflows/example-config.yml)

### Parallel

**Note:** Cypress parallelization requires a [Cypress Cloud](https://on.cypress.io/cloud-introduction) account.
Expand Down
12 changes: 12 additions & 0 deletions examples/config/cypress.config-alternate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
fixturesFolder: false,
e2e: {
baseUrl: 'http://localhost:3333',
setupNodeEvents(on, config) {
console.log('\nUsing cypress.config-alternate.js config-file')
},
supportFile: false
},
})

0 comments on commit 4581de4

Please sign in to comment.