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

feat: added expect-playwright #98

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
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
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,13 @@ module.exports = {

Other options are documented in [jest-dev-server](https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-dev-server).

## expect-playwright

There is a utility package [expect-playwright](https://github.com/mxschmitt/expect-playwright) which simplifies the expect statements in combination with Playwright to make e.g. shorter text comparisons.

## ESLint globals / `'page' is not defined`

There is [eslint-plugin-jest-playwright](https://github.com/mxschmitt/eslint-plugin-jest-playwright) available which includes the globals for using jest-playwright.
There is [eslint-plugin-jest-playwright](https://github.com/mxschmitt/eslint-plugin-jest-playwright) available which includes the globals for using jest-playwright.

## Unstable and experimental API

Expand Down Expand Up @@ -191,37 +195,37 @@ Example Jest configuration in combination with [ts-jest](https://github.com/kuls
module.exports = {
preset: 'jest-playwright-preset',
transform: {
"^.+\\.ts$": "ts-jest"
'^.+\\.ts$': 'ts-jest',
},
};
}
```

Types are also available, which you can either use via directly in your test:

```typescript
/// <reference types="jest-playwright-preset" />
/// <reference types="expect-playwright" />
```

or at your central `tsconfig.json` either via `files`:

```
```json
{
"files": [
"./global.d.ts",
"node_modules/jest-playwright-preset/types/global.d.ts"
],
"node_modules/jest-playwright-preset/types/global.d.ts",
"node_modules/expect-playwright/global.d.ts"
]
}
```

or via `types`:

```
```json
{
"compilerOptions": {
"types": [
"jest-playwright-preset"
]
},
"types": ["jest-playwright-preset", "expect-playwright"]
}
}
```

Expand Down
5 changes: 4 additions & 1 deletion jest-preset.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"globalSetup": "jest-playwright-preset/setup.js",
"globalTeardown": "jest-playwright-preset/teardown.js",
"testEnvironment": "jest-playwright-preset"
"testEnvironment": "jest-playwright-preset",
"setupFilesAfterEnv": [
"expect-playwright"
]
}
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"jest-environment-node": "^25.2.3"
},
"dependencies": {
"expect-playwright": "^0.1.0",
"jest-dev-server": "^4.4.0"
},
"devDependencies": {
Expand Down