You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
-`selectors` <[array]>. Define [selectors](https://github.com/microsoft/playwright/blob/v0.11.1/docs/api.md#class-selectors). Each selector must be an object with name and script properties.
122
+
-`skipInitialization` <[boolean]>. Add you ability to skip first setup `playwright` process. Possible use cases can be found [here](https://github.com/playwright-community/jest-playwright/issues/424)
123
+
-`useDefaultBrowserType` <[boolean]>. [Sometimes](https://github.com/microsoft/playwright/issues/2787)`browser` + `device` combinations don't have any sense. With this option tests will be run with [`defaultBrowserType`](https://github.com/microsoft/playwright/pull/3731) of device
124
+
125
+
### Specific browser options
126
+
127
+
For `launchOptions`, `connectOptions` and `contextOptions` you can define special browser options.
128
+
129
+
```js
130
+
// jest-playwright.config.js
131
+
module.exports= {
132
+
connectOptions: {
133
+
chromium: {
134
+
wsEndpoint:'ws://chrome.proxy.com:4444'
135
+
},
136
+
firefox: {
137
+
wsEndpoint:'ws://firefox.proxy.com:4444'
138
+
}
139
+
},
140
+
...
141
+
}
142
+
```
122
143
123
144
### Device configuration
124
145
@@ -166,7 +187,7 @@ module.exports = {
166
187
167
188
### Usage with [query-selector-shadow-dom](https://github.com/Georgegriff/query-selector-shadow-dom) in `jest-playwright.config.js`:
@@ -199,7 +219,7 @@ All of them are available globally in each Jest test. If you are using ESLint an
199
219
200
220
Debugging tests can be hard sometimes and it is very useful to be able to pause tests in order to inspect the browser. Jest Playwright exposes a method `jestPlaywright.debug()` that suspends test execution and gives you opportunity to see what's going on in the browser.
201
221
202
-
```javascript
222
+
```js
203
223
awaitjestPlaywright.debug()
204
224
```
205
225
@@ -235,6 +255,54 @@ beforeEach(async () => {
235
255
236
256
You can use this snippet to reset current browser for each individual test. It will reset browser, context and page.
237
257
258
+
## Debug helper functions
259
+
260
+
`jest-playwright` provides some functions to debug your tests
261
+
262
+
### jestPlaywrightDebug
263
+
264
+
This helper function provide you ability to run specific tests in `debug` mode. It will run test in `headless` mode.
265
+
You can find more information [here](https://github.com/playwright-community/jest-playwright/issues/216)
Also you can define options for `debug` mode with `debugOptions`:
276
+
277
+
```js
278
+
// jest-playwright.config.js
279
+
module.exports= {
280
+
debugOptions: {
281
+
...
282
+
contextOptions: {
283
+
offline:true
284
+
}
285
+
}
286
+
...
287
+
}
288
+
```
289
+
290
+
### jestPlaywrightConfig
291
+
292
+
This helper function provide you ability to run specific tests with passed options.
293
+
294
+
```js
295
+
test.jestPlaywrightConfig(
296
+
{
297
+
// your jest-playwright options
298
+
},
299
+
'test name',
300
+
async () => {
301
+
/* ... */
302
+
},
303
+
)
304
+
```
305
+
238
306
## Tracking the coverage
239
307
240
308
It's possible to track the coverage of the end-to-end tests with the [babel-plugin-istanbul](https://github.com/istanbuljs/babel-plugin-istanbul) Babel plugin configured. It needs to be included in the web application which you are gonna test otherwise it won't work. To use it, you have to set `collectCoverage` in the `jest-playwright.config.js` to `true`. Per default the test coverage will be automatically saved after each navigation change (`beforeunload` event). If a certain code path is not covered, you can manually call and add the corresponding `saveCoverage(page)` call to your tests like that:
0 commit comments