fix(tracing): fix tracing + debugger test (#10619)

This commit is contained in:
Pavel Feldman 2021-11-30 17:32:29 -08:00 committed by GitHub
parent 1bfc473bc8
commit 11cbdcf58a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View file

@ -318,9 +318,9 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
await artifact.saveAs(this._options.recordHar.path);
await artifact.delete();
}
await this._channel.close();
await this._closedPromise;
});
}, true);
await this._channel.close();
await this._closedPromise;
} catch (e) {
if (isSafeCloseError(e))
return;

View file

@ -85,7 +85,7 @@ export class RecorderApp extends EventEmitter {
await mainFrame.goto(internalCallMetadata(), 'https://playwright/index.html');
}
static async open(sdkLanguage: string): Promise<RecorderApp> {
static async open(sdkLanguage: string, headed: boolean): Promise<RecorderApp> {
const recorderPlaywright = (require('../../playwright').createPlaywright as typeof import('../../playwright').createPlaywright)('javascript', true);
const args = [
'--app=data:text/html,',
@ -98,7 +98,7 @@ export class RecorderApp extends EventEmitter {
channel: findChromiumChannel(sdkLanguage),
args,
noDefaultViewport: true,
headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !process.env.HEADFUL),
headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !headed),
useWebSocket: !!process.env.PWTEST_RECORDER_PORT
});
const controller = new ProgressController(internalCallMetadata(), context._browser);

View file

@ -76,7 +76,7 @@ export class RecorderSupplement implements InstrumentationListener {
}
async install() {
const recorderApp = await RecorderApp.open(this._context._browser.options.sdkLanguage);
const recorderApp = await RecorderApp.open(this._context._browser.options.sdkLanguage, !!this._context._browser.options.headful);
this._recorderApp = recorderApp;
recorderApp.once('close', () => {
this._debugger.resume(false);

View file

@ -194,7 +194,6 @@ test('should open simple trace viewer', async ({ showTraceViewer }) => {
/page.gotohttp:\/\/localhost:\d+\/frames\/frame.html/,
/route.continue/,
/page.setViewportSize/,
/browserContext.close/,
]);
});