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: do not zip live stack traces in ui mode (#37887)
Yury Semikhatskyed73b2674aab
diff --git a/packages/playwright-core/src/server/localUtils.ts b/packages/playwright-core/src/server/localUtils.tsindex 5fb9b57d41..b58f2aa855 100644--- a/packages/playwright-core/src/server/localUtils.ts+++ b/packages/playwright-core/src/server/localUtils.ts@@ -60,12 +60,8 @@ export async function zip(progress: Progress, stackSessions: Map<string, StackSeconst stackSession = params.stacksId ? stackSessions.get(params.stacksId) : undefined;if (stackSession?.callStacks.length) {await progress.race(stackSession.writer);- if (process.env.PW_LIVE_TRACE_STACKS) {- zipFile.addFile(stackSession.file, 'trace.stacks');- } else {- const buffer = Buffer.from(JSON.stringify(serializeClientSideCallMetadata(stackSession.callStacks)));- zipFile.addBuffer(buffer, 'trace.stacks');- }+ const buffer = Buffer.from(JSON.stringify(serializeClientSideCallMetadata(stackSession.callStacks)));+ zipFile.addBuffer(buffer, 'trace.stacks');}// Collect sources from stacks.diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.tsindex 48fd3873e5..08fbb46a18 100644--- a/tests/playwright-test/ui-mode-trace.spec.ts+++ b/tests/playwright-test/ui-mode-trace.spec.ts@@ -657,3 +657,39 @@ test('basic fail', async ({ page }) => {await page.getByTestId('test-tree').getByText('basic fail').dblclick();await expect(page.getByRole('tabpanel', { name: 'Actions' })).toContainText('Failed');});++test('should be able to create and dispose APIRequestContext inside Promise.all', async ({ runUITest }) => {+ const { page } = await runUITest({+ 'a.test.ts': `+ import { test, request } from '@playwright/test';+ test('create api request contexts', async ({ }) => {+ await Promise.all(Array.from({ length: 100 }).map(async () => {+ let delay = Math.floor(Math.random() * 501);+ await new Promise(res => setTimeout(res, delay));++ const apiContext = await request.newContext();+ delay = Math.floor(Math.random() * 501);+ await new Promise(res => setTimeout(res, delay));+ await apiContext.dispose();+ }));+ });+ `,+ });++ await page.getByText('create api request contexts').dblclick();++ await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');++ await page.getByText('Errors', { exact: true }).click();+ await expect(page.locator('.tab-errors')).toHaveText('No errors');++ const listItem = page.getByTestId('actions-tree').getByRole('treeitem');+ await expect(+ listItem,+ 'action list'+ ).toHaveText([+ /Before Hooks[\d.]+m?s/,+ ...Array.from({ length: 100 }).map(() => /Create request context[\d.]+m?s/),+ /After Hooks[\d.]+m?s/,+ ]);+});