Skip to content

Commit

Permalink
Add missed comma in utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarkelov committed Feb 1, 2020
1 parent 76f41d9 commit 7ffe561
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,32 @@ Update your Jest configuration:
}
```

You should provide **browser** option as environment variable:
## Configuration

You can specify a `jest-playwright.config.js` at the root of the project or define a custom path using `JEST_PLAYWRIGHT_CONFIG` environment variable. It should export a config object.

- `launchBrowserApp` <[object]> [All Playwright launch options](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsertypelaunchbrowserappoptions) can be specified in config. Since it is JavaScript, you can use all stuff you need, including environment.
- `context` <[object]> [All Playwright context options](https://github.com/microsoft/playwright/blob/master/docs/api.md#browsernewcontextoptions) can be specified in config.
- `browser` <[string]>. Define a [browser](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browsertype) to run tests into.
- `chromium` Each test runs Chromium.
- `firefox` Each test runs Firefox.
- `webkit` Each test runs Webkit.
- `exitOnPageError` <[boolean]> Exits page on any global error message thrown. Defaults to `true`.

## Browser type

You can specify browser in multiple ways:

- With `BROWSER` environment variable
- With your `jest-playwright.config.js`

If you don't pass any value it will be use `chromium` as default

Use Playwright in your tests:
```json
"test": "BROWSER=chromium jest"
```


```js
describe('Google', () => {
beforeAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function readConfig() {
const hasCustomConfigPath = !!process.env.JEST_PLAYWRIGHT_CONFIG;
const configPath =
process.env.JEST_PLAYWRIGHT_CONFIG || 'jest-playwright.config.js';
const absConfigPath = path.resolve(process.cwd(), configPath)
const absConfigPath = path.resolve(process.cwd(), configPath);
const configExists = await exists(absConfigPath);

if (hasCustomConfigPath && !configExists) {
Expand Down

0 comments on commit 7ffe561

Please sign in to comment.