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(trace-viewer): fit the browser frame to phone-sized snapshots (#43321)
Pavel Feldmandb38ff6b386c
diff --git a/packages/trace-viewer/src/ui/snapshotTab.tsx b/packages/trace-viewer/src/ui/snapshotTab.tsxindex 7fdf5b9f77..31873c259a 100644--- a/packages/trace-viewer/src/ui/snapshotTab.tsx+++ b/packages/trace-viewer/src/ui/snapshotTab.tsx@@ -235,7 +235,7 @@ const SnapshotWrapper: React.FunctionComponent<React.PropsWithChildren<{};const renderedBrowserFrameSize = {- width: Math.max(snapshotContainerSize.width, 480),+ width: Math.max(snapshotContainerSize.width, 320),height: Math.max(snapshotContainerSize.height + windowHeaderHeight, 320),};diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.tsindex 18b251dbc2..adc0f07e99 100644--- a/tests/library/trace-viewer.spec.ts+++ b/tests/library/trace-viewer.spec.ts@@ -76,7 +76,7 @@ test.beforeAll(async function recordTrace({ browser, browserName, browserType, spage.waitForResponse(server.PREFIX + '/frames/frame.html'),page.waitForTimeout(200).then(() => page.goto(server.PREFIX + '/frames/frame.html'))]);- await page.setViewportSize({ width: 500, height: 600 });+ await page.setViewportSize({ width: 390, height: 600 });// Go through instrumentation to exercise reentrant stack traces.const csi = {@@ -486,14 +486,17 @@ test('should truncate long return values with ellipsis but copy full value', asy});test('should have correct snapshot size', async ({ showTraceViewer }, testInfo) => {+ test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43313' });const traceViewer = await showTraceViewer(traceFile);await traceViewer.selectAction('SET VIEWPORT');await traceViewer.selectSnapshot('Before');await expect(traceViewer.snapshotContainer).toHaveCSS('width', '1280px');await expect(traceViewer.snapshotContainer).toHaveCSS('height', '720px');await traceViewer.selectSnapshot('After');- await expect(traceViewer.snapshotContainer).toHaveCSS('width', '500px');+ await expect(traceViewer.snapshotContainer).toHaveCSS('width', '390px');await expect(traceViewer.snapshotContainer).toHaveCSS('height', '600px');+ // A phone-sized snapshot fills the browser frame.+ await expect(traceViewer.page.locator('.snapshot-container')).toHaveCSS('width', '390px');});test('should have correct stack trace', async ({ showTraceViewer }) => {