Description
Is your feature request related to a problem? Please describe.
I typically run all tests headless, but I often have failing tests that that require visually inspecting the page. Currently, this involves the following:
- Find my
jest-playwright.config.js
file - Modify my
browsers
to include only one browser (since I generally don't need to visually inspect in multiple browsers) - Modify my
launchOptions
to setheadless:false
and occasionallydevtools:true
Once the test passes, I then have to undo all of the changes made above.
What would greatly speed up this process is a way to launch a single test in non-headless mode, possibly with devtools enabled, for one-or-more browsers and/or devices. Ideally, this would be as quick as adding .only
or .skip
to a test, although this would obviously take some pre-configuration.
Describe the solution you'd like
The verbose-but-flexible way would be to allow passing configuration options with each test. Using the existing jestPlaywright.skip
implementation as inspiration, perhaps something like this could work:
jestPlaywright.config({
browser: 'chromium',
launchOptions: {
headless: false,
devtools: true,
}
}, () => {
// Tests...
})
This could be made less obnoxious by storing the non-headless/debug configuration separately and passing it to the .config()
method:
const jestPlaywrightDebugConfig = {
browser: 'chromium',
launchOptions: {
headless: false,
devtools: true,
}
};
jestPlaywright.config(jestPlaywrightDebugConfig, () => {
// Tests...
})
Better yet, the non-headless/debug configuration could be set in jest-playwright.config.js
, allowing a much simpler .debug()
method to be used without passing additional parameters:
// jest-playwrite.config.js
module.exports = {
browsers: [
'chromium',
'firefox',
'webkit',
],
debugOptions: {
browsers: [
'chromium'
],
launchOptions: {
headless: false,
devtools: true
}
}
};
// my.test.js
jestPlaywright.debug(() => {
// Tests...
})