Skip to content

Commit

Permalink
feat: config and config-file inputs (#29)
Browse files Browse the repository at this point in the history
* feat: config and config-file inputs

* Remove unnecessary comment
  • Loading branch information
prescottprue authored and bahmutov committed Nov 19, 2019
1 parent 1cad49d commit 20e2013
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,49 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
```

### Config

Specify [configuration](https://docs.cypress.io/guides/references/configuration.html) values with `config` parameter


```yml
name: Cypress tests
on: [push]
jobs:
cypress-run:
name: Cypress run
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cypress run
uses: cypress-io/github-action@v1
with:
config: pageLoadTimeout=100000,watchForFileChanges=false
```

### Config File

Specify the path to your config file with `config-file` parameter

```yml
name: Cypress tests
on: [push]
jobs:
cypress-run:
name: Cypress run
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cypress run
uses: cypress-io/github-action@v1
with:
config-file: tests/cypress-config.json
```

### Parallel

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)
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ inputs:
description: 'Sends test results to Cypress Dashboard'
required: false
default: false
config:
description: 'Set configuration values. Separate multiple values with a comma. The values set here override any values set in your configuration file.'
required: false
config-file:
description: 'Path to a JSON file where configuration values are set.'
required: false
default: cypress.json
env:
description: 'Sets Cypress environment variables'
required: false
Expand Down
10 changes: 10 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,16 @@ const runTests = () => {
cmd.push('--group')
cmd.push(quoteArgument(group))
}
const configInput = core.getInput('config')
if (configInput) {
cmd.push('--config')
cmd.push(quoteArgument(configInput))
}
const configFileInput = core.getInput('config-file')
if (configFileInput) {
cmd.push('--config-file')
cmd.push(quoteArgument(configFileInput))
}
if (parallel || group) {
// on GitHub Actions we can use workflow name and SHA commit to tie multiple jobs together
// until a better workflow id is available
Expand Down
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ const runTests = () => {
cmd.push('--group')
cmd.push(quoteArgument(group))
}
const configInput = core.getInput('config')
if (configInput) {
cmd.push('--config')
cmd.push(quoteArgument(configInput))
}
const configFileInput = core.getInput('config-file')
if (configFileInput) {
cmd.push('--config-file')
cmd.push(quoteArgument(configFileInput))
}
if (parallel || group) {
// on GitHub Actions we can use workflow name and SHA commit to tie multiple jobs together
// until a better workflow id is available
Expand Down

0 comments on commit 20e2013

Please sign in to comment.