diff --git a/e2e-tests/helpers/test_helper.ts b/e2e-tests/helpers/test_helper.ts index 92b8fc3..c166999 100644 --- a/e2e-tests/helpers/test_helper.ts +++ b/e2e-tests/helpers/test_helper.ts @@ -54,13 +54,19 @@ class PageObject { await this.page.getByRole("button", { name: "Restart" }).click(); } + locateLoadingAppPreview() { + return this.page.getByText("Loading app preview..."); + } + getPreviewIframeElement() { return this.page.getByTestId("preview-iframe-element"); } async snapshotPreview() { const iframe = this.getPreviewIframeElement(); - await expect(iframe.contentFrame().locator("body")).toMatchAriaSnapshot(); + await expect(iframe.contentFrame().locator("body")).toMatchAriaSnapshot({ + timeout: 15_000, + }); } async snapshotServerDump({ diff --git a/e2e-tests/restart.spec.ts b/e2e-tests/restart.spec.ts new file mode 100644 index 0000000..f8408d6 --- /dev/null +++ b/e2e-tests/restart.spec.ts @@ -0,0 +1,15 @@ +import { test } from "./helpers/test_helper"; +import { expect } from "@playwright/test"; + +test("restart app", async ({ po }) => { + await po.setUp({ autoApprove: true }); + await po.sendPrompt("hi"); + + await po.clickRestart(); + await expect(po.locateLoadingAppPreview()).toBeVisible(); + await expect(po.locateLoadingAppPreview()).not.toBeVisible({ + timeout: 15_000, + }); + + await po.snapshotPreview(); +}); diff --git a/e2e-tests/snapshots/restart.spec.ts_restart-app-1.aria.yml b/e2e-tests/snapshots/restart.spec.ts_restart-app-1.aria.yml new file mode 100644 index 0000000..a778454 --- /dev/null +++ b/e2e-tests/snapshots/restart.spec.ts_restart-app-1.aria.yml @@ -0,0 +1,7 @@ +- region "Notifications (F8)": + - list +- region "Notifications alt+T" +- heading "Welcome to Your Blank App" [level=1] +- paragraph: Start building your amazing project here! +- link "Made with Dyad": + - /url: https://www.dyad.sh/ \ No newline at end of file