mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: add a test for cdp w/ trace (#27410)
Closes https://github.com/microsoft/playwright/issues/27409
This commit is contained in:
parent
2c56af3a3b
commit
13cca1db3d
@ -446,3 +446,25 @@ test('emulate media should not be affected by second connectOverCDP', async ({ b
|
||||
await browserServer.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('should allow tracing over cdp session', async ({ browserType, mode }, testInfo) => {
|
||||
const port = 9339 + testInfo.workerIndex;
|
||||
const browserServer = await browserType.launch({
|
||||
args: ['--remote-debugging-port=' + port]
|
||||
});
|
||||
try {
|
||||
const cdpBrowser = await browserType.connectOverCDP({
|
||||
endpointURL: `http://127.0.0.1:${port}/`,
|
||||
});
|
||||
const [context] = cdpBrowser.contexts();
|
||||
await context.tracing.start({ screenshots: true, snapshots: true });
|
||||
const page = await context.newPage();
|
||||
await page.evaluate(() => 2 + 2);
|
||||
const traceZip = testInfo.outputPath('trace.zip');
|
||||
await context.tracing.stop({ path: traceZip });
|
||||
await cdpBrowser.close();
|
||||
expect(fs.existsSync(traceZip)).toBe(true);
|
||||
} finally {
|
||||
await browserServer.close();
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user