Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(multiclient): store videos into artifacts folder (#36688)
Simon Knott09b2ab471895
diff --git a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserDispatcher.tsindex d15db5ea49..bda9e1f426 100644--- a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts@@ -59,14 +59,15 @@ export class BrowserDispatcher extends Dispatcher<Browser, channels.BrowserChann}async newContext(params: channels.BrowserNewContextParams, progress: Progress): Promise<channels.BrowserNewContextResult> {+ if (params.recordVideo && this._object.attribution.playwright.options.isServer)+ params.recordVideo.dir = this._object.options.artifactsDir;+if (!this._options.isolateContexts) {const context = await this._object.newContext(progress, params);const contextDispatcher = BrowserContextDispatcher.from(this, context);return { context: contextDispatcher };}- if (params.recordVideo)- params.recordVideo.dir = this._object.options.artifactsDir;const context = await this._object.newContext(progress, params);this._isolatedContexts.add(context);context.on(BrowserContext.Events.Close, () => this._isolatedContexts.delete(context));diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.tsindex 9efe3b0f98..acd6d7d47d 100644--- a/tests/library/browsertype-connect.spec.ts+++ b/tests/library/browsertype-connect.spec.ts@@ -502,6 +502,9 @@ for (const kind of ['launchServer', 'run-server'] as const) {await new Promise(r => setTimeout(r, 1000));await context.close();+ test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/36685' });+ expect(fs.readdirSync(videosPath), 'recordVideo.dir might be unaccessible in server mode, so /tmp/artifacts should be used').toHaveLength(0);+const savedAsPath = testInfo.outputPath('my-video.webm');await page.video().saveAs(savedAsPath);expect(fs.existsSync(savedAsPath)).toBeTruthy();