playwright
playwright copied to clipboard
[Feature]: support test.fail.only
🚀 Feature Request
Support test.fail.only()
to be able to focus on failing test.
Example
Imagine I have two tests and 1st is expected to fail:
test.fail('my test', async ({ page }) => {
throw new Error('foo')
});
test('my test 2', async ({ page }) => {
// pass
});
If for some reason 1st test does not fail, I'd like to focus on it with adding .only
to the test function. But nether of the following works:
test.fail.only('my test', async ({ page }) => { ... }
test.only.fail('my test', async ({ page }) => { ... }
Error:
TypeError: test.fail.only is not a function
Note:
If I use test.fail()
inside test body, it works:
test.only('my test', async ({ page }) => {
test.fail();
throw new Error('foo')
});
Motivation
I'd like to be able to focus on expectedly-failing tests as well as I can on passing tests.