diff --git a/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-1.png b/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-1.png new file mode 100644 index 000000000..1434eb785 Binary files /dev/null and b/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-1.png differ diff --git a/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-2.png b/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-2.png new file mode 100644 index 000000000..94246181a Binary files /dev/null and b/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-2.png differ diff --git a/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-3.png b/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-3.png new file mode 100644 index 000000000..6c9c48895 Binary files /dev/null and b/e2e-tests/__screenshots__/darwin/viewport-menu.spec.ts/can-set-and-reset-Viewport-3.png differ diff --git a/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-1.png b/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-1.png new file mode 100644 index 000000000..51b66d44e Binary files /dev/null and b/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-1.png differ diff --git a/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-2.png b/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-2.png new file mode 100644 index 000000000..ab0b6bcd9 Binary files /dev/null and b/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-2.png differ diff --git a/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-3.png b/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-3.png new file mode 100644 index 000000000..51b66d44e Binary files /dev/null and b/e2e-tests/__screenshots__/win32/viewport-menu.spec.ts/can-set-and-reset-Viewport-3.png differ diff --git a/e2e-tests/tests/infra/StudioPlaywrightPage.ts b/e2e-tests/tests/infra/StudioPlaywrightPage.ts index 5ae63714a..882cb91e1 100644 --- a/e2e-tests/tests/infra/StudioPlaywrightPage.ts +++ b/e2e-tests/tests/infra/StudioPlaywrightPage.ts @@ -263,6 +263,18 @@ export default class StudioPlaywrightPage { return path.join(this.tmpDir, "src/components", componentName + ".tsx"); } + async openViewportMenu() { + await this.page + .getByRole("button", { name: "See Available Viewports" }) + .click(); + } + + async setViewport(viewportName: string) { + await this.page + .getByRole("button", { name: `Select ${viewportName} Viewport` }) + .click(); + } + async takePageScreenshotAfterImgRender() { await this.waitForIFrameImagesToLoad(); await expect(this.page).toHaveScreenshot(); diff --git a/e2e-tests/tests/viewport-menu.spec.ts b/e2e-tests/tests/viewport-menu.spec.ts new file mode 100644 index 000000000..9f9d9421a --- /dev/null +++ b/e2e-tests/tests/viewport-menu.spec.ts @@ -0,0 +1,13 @@ +import { studioTest } from "./infra/studioTest.js"; + +studioTest("can set and reset Viewport", async ({ studioPage }) => { + await studioPage.switchPage("LocationPage"); + await studioPage.openViewportMenu(); + await studioPage.takePageScreenshotAfterImgRender(); + await studioPage.setViewport("Galaxy Z Flip5 Folded"); + await studioPage.openViewportMenu(); + await studioPage.takePageScreenshotAfterImgRender(); + await studioPage.setViewport("Reset Viewport"); + await studioPage.openViewportMenu(); + await studioPage.takePageScreenshotAfterImgRender(); +}); diff --git a/packages/studio-ui/src/components/Viewport/ViewportButton.tsx b/packages/studio-ui/src/components/Viewport/ViewportButton.tsx index 34186364e..1840a204c 100644 --- a/packages/studio-ui/src/components/Viewport/ViewportButton.tsx +++ b/packages/studio-ui/src/components/Viewport/ViewportButton.tsx @@ -14,7 +14,7 @@ export default function ViewportButton(): JSX.Element { return (