diff --git a/README.md b/README.md
index 6598c8d2..a972b3b9 100644
--- a/README.md
+++ b/README.md
@@ -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
@@ -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
///
+///
```
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"]
+ }
}
```
diff --git a/jest-preset.json b/jest-preset.json
index 832a6020..b8eacc86 100644
--- a/jest-preset.json
+++ b/jest-preset.json
@@ -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"
+ ]
}
diff --git a/package-lock.json b/package-lock.json
index 4ff0c602..06a9bd19 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3716,6 +3716,11 @@
}
}
},
+ "expect-playwright": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/expect-playwright/-/expect-playwright-0.1.0.tgz",
+ "integrity": "sha512-REvHqzNC2F8KZv7y78kc160xF8dcZlU4+BBpiN6GBX2u2KjrxZ1KuHJfLhM0NoGX6GTwM4ICFEx4KzeEmtey1g=="
+ },
"extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
diff --git a/package.json b/package.json
index 0534ff66..e9693a09 100644
--- a/package.json
+++ b/package.json
@@ -49,6 +49,7 @@
"jest-environment-node": "^25.2.3"
},
"dependencies": {
+ "expect-playwright": "^0.1.0",
"jest-dev-server": "^4.4.0"
},
"devDependencies": {