Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example on how to programmatically control which browser to run tests in. #5313

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/guides/guides/module-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,31 @@ cypress.run({
})
```

#### Programmatically control which browser to run

You can pass a browser option to specify which browser to run tests in so that
you can programmatically control which specs to run in each browser.

```js
// run 'node cypress-chrome.js'
const cypress = require('cypress')

cypress.run({
spec: './cypress/e2e/**/chrome-test*.js',
browser: 'chrome',
})
```

```js
// run 'node cypress-firefox.js'
const cypress = require('cypress')

cypress.run({
spec: './cypress/e2e/**/firefox-test*.js',
browser: 'firefox',
})
```

#### Use modern syntax

If your Node version allows you can use the modern `async / await` syntax to
Expand Down