chore: wait for downloads getting removed on context.close() (#23500)
Before there was a race, that we ran into this code:9cd49d5dd5/packages/playwright-core/src/server/browserContext.ts (L236-L237)and then into this code:9cd49d5dd5/packages/playwright-core/src/server/browserContext.ts (L429-L431)which had the side effect, that the first call did not wait. Then immediately clears the downloads Set and then the second call is a NOOP. This ends up that the the removal of the downloads can happen after the context is closed, hence the test is flaky. Relates to https://github.com/microsoft/playwright/pull/6151 where it got introduced. So something for @yury-s. Fixes https://github.com/microsoft/playwright/issues/22525
This commit is contained in:
parent
ce2f902c1f
commit
8bc26a2b44
|
|
@ -232,9 +232,12 @@ export abstract class BrowserContext extends SdkObject {
|
|||
// at the same time.
|
||||
return;
|
||||
}
|
||||
const gotClosedGracefully = this._closedStatus === 'closing';
|
||||
this._closedStatus = 'closed';
|
||||
if (!gotClosedGracefully) {
|
||||
this._deleteAllDownloads();
|
||||
this._downloads.clear();
|
||||
}
|
||||
this.tracing.dispose().catch(() => {});
|
||||
if (this._isPersistentContext)
|
||||
this.onClosePersistent();
|
||||
|
|
|
|||
Loading…
Reference in a new issue