Skip to content

Commit

Permalink
fix: change order of dispose browser context
Browse files Browse the repository at this point in the history
  • Loading branch information
barak007 committed Nov 30, 2023
1 parent 417847c commit 7ec33ed
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/test-kit/src/with-feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,12 @@ export function withFeature(withFeatureOptions: IWithFeatureOptions = {}) {
throw new Error('Browser is not open!');
}
dedicatedBrowserContext = await browser.newContext(browserContextOptions);

dispose(() => dedicatedBrowserContext?.close(), {
group: WITH_FEATURE_DISPOSABLES,
name: `close browser context for feature "${featureName}"`,
timeout: 5000,
});

await enableTestBrowserContext({
browserContext: dedicatedBrowserContext,
Expand All @@ -346,11 +352,6 @@ export function withFeature(withFeatureOptions: IWithFeatureOptions = {}) {
capturedErrors,
consoleLogAllowedErrors,
});
dispose(() => dedicatedBrowserContext?.close(), {
group: WITH_FEATURE_DISPOSABLES,
name: `close browser context for feature "${featureName}"`,
timeout: 5000,
});
}

if (!executableApp) {
Expand Down

0 comments on commit 7ec33ed

Please sign in to comment.