test: unflake 'should not include trace resources from the previous chunks' test
This commit is contained in:
parent
86cc252da2
commit
6e245ed33e
|
|
@ -432,6 +432,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
||||||
this._browser._contexts.delete(this);
|
this._browser._contexts.delete(this);
|
||||||
this._browserType?._contexts?.delete(this);
|
this._browserType?._contexts?.delete(this);
|
||||||
this._disposeHarRouters();
|
this._disposeHarRouters();
|
||||||
|
this.tracing._resetStackCounterIfNeeded();
|
||||||
this.emit(Events.BrowserContext.Close, this);
|
this.emit(Events.BrowserContext.Close, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,7 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _doStopChunk(filePath: string | undefined) {
|
private async _doStopChunk(filePath: string | undefined) {
|
||||||
if (this._isTracing) {
|
this._resetStackCounterIfNeeded();
|
||||||
this._isTracing = false;
|
|
||||||
this._connection.setIsTracing(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filePath) {
|
if (!filePath) {
|
||||||
// Not interested in artifacts.
|
// Not interested in artifacts.
|
||||||
|
|
@ -113,4 +110,11 @@ export class Tracing extends ChannelOwner<channels.TracingChannel> implements ap
|
||||||
|
|
||||||
await this._connection.localUtils()._channel.zip({ zipFile: filePath, entries: [], mode: 'append', stacksId: this._stacksId, includeSources: this._includeSources });
|
await this._connection.localUtils()._channel.zip({ zipFile: filePath, entries: [], mode: 'append', stacksId: this._stacksId, includeSources: this._includeSources });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_resetStackCounterIfNeeded() {
|
||||||
|
if (this._isTracing) {
|
||||||
|
this._isTracing = false;
|
||||||
|
this._connection.setIsTracing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,19 @@
|
||||||
import { browserTest, expect } from '../config/browserTest';
|
import { browserTest, expect } from '../config/browserTest';
|
||||||
import type { BrowserContext, BrowserContextOptions } from '@playwright/test';
|
import type { BrowserContext, BrowserContextOptions } from '@playwright/test';
|
||||||
|
|
||||||
const test = browserTest.extend<{ reusedContext: (options?: BrowserContextOptions) => Promise<BrowserContext> }>({
|
const test = browserTest.extend<{}, { reusedContext: (options?: BrowserContextOptions) => Promise<BrowserContext> }>({
|
||||||
reusedContext: async ({ browserType, browser }, use) => {
|
reusedContext: [async ({ browserType, browser }, use) => {
|
||||||
|
let context;
|
||||||
await use(async (options: BrowserContextOptions = {}) => {
|
await use(async (options: BrowserContextOptions = {}) => {
|
||||||
const defaultContextOptions = (browserType as any)._defaultContextOptions;
|
const defaultContextOptions = (browserType as any)._defaultContextOptions;
|
||||||
const context = await (browser as any)._newContextForReuse({
|
context = await (browser as any)._newContextForReuse({
|
||||||
...defaultContextOptions,
|
...defaultContextOptions,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
return context;
|
return context;
|
||||||
});
|
});
|
||||||
},
|
await context.close();
|
||||||
|
}, { scope: 'worker' }],
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should re-add binding after reset', async ({ reusedContext }) => {
|
test('should re-add binding after reset', async ({ reusedContext }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue