test: restart worker fixtures after test failure (#3021)
This way previous test that leaves browser in a bad state does not affect future tests.
This commit is contained in:
parent
562e1e6460
commit
13c3f7243c
|
|
@ -75,7 +75,6 @@ class PlaywrightEnvironment extends NodeEnvironment {
|
|||
|
||||
async handleTestEvent(event, state) {
|
||||
if (event.name === 'setup') {
|
||||
|
||||
this.patchToEnableFixtures(this.global, 'beforeEach');
|
||||
this.patchToEnableFixtures(this.global, 'afterEach');
|
||||
|
||||
|
|
@ -111,6 +110,7 @@ class PlaywrightEnvironment extends NodeEnvironment {
|
|||
};
|
||||
this.global.expect.extend({ toBeGolden });
|
||||
}
|
||||
|
||||
if (event.name === 'test_start') {
|
||||
const fn = event.test.fn;
|
||||
event.test.fn = async () => {
|
||||
|
|
@ -121,6 +121,10 @@ class PlaywrightEnvironment extends NodeEnvironment {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (event.name === 'test_fn_failure') {
|
||||
await this.fixturePool.teardownScope('worker');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue