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
chore: process stdio buffers (#22270)
Pavel Feldmaneed5b4c83b89
diff --git a/packages/playwright-test/src/isomorphic/teleReceiver.ts b/packages/playwright-test/src/isomorphic/teleReceiver.tsindex 91edb7a3cf..7842855792 100644--- a/packages/playwright-test/src/isomorphic/teleReceiver.ts+++ b/packages/playwright-test/src/isomorphic/teleReceiver.ts@@ -263,7 +263,7 @@ export class TeleReporterReceiver {}private _onStdIO(type: 'stdout' | 'stderr', testId: string | undefined, resultId: string | undefined, data: string, isBase64: boolean) {- const chunk = isBase64 ? Buffer.from(data, 'base64') : data;+ const chunk = isBase64 ? ((globalThis as any).Buffer ? Buffer.from(data, 'base64') : atob(data)) : data;const test = testId ? this._tests.get(testId) : undefined;const result = test && resultId ? test.resultsMap.get(resultId) : undefined;if (type === 'stdout')diff --git a/tests/playwright-test/ui-mode-test-output.spec.ts b/tests/playwright-test/ui-mode-test-output.spec.tsindex fc5ff0ece1..870a41fa28 100644--- a/tests/playwright-test/ui-mode-test-output.spec.ts+++ b/tests/playwright-test/ui-mode-test-output.spec.ts@@ -56,3 +56,21 @@ test('should work after theme switch', async ({ runUITest, writeFiles }) => {await page.getByTitle('Run all').click();await expect(page.getByTestId('output')).toContainText(`Hello world 2`);});++test('should print buffers', async ({ runUITest }) => {+ const { page } = await runUITest({+ 'a.test.ts': `+ import { test } from '@playwright/test';+ import { PassThrough } from 'stream';+ test('print', () => {+ const writable = new PassThrough();+ writable.pipe(process.stdout);+ const red = Buffer.from('G1szMW1IRUxMTxtbMzlt', 'base64');+ writable.write(red);+ });+ `,+ });+ await page.getByTitle('Toggle output').click();+ await page.getByTitle('Run all').click();+ await expect(page.getByTestId('output')).toContainText('HELLO', { timeout: 15000 });+});