refresh e2e (#307)

This commit is contained in:
Will Chen
2025-06-02 15:53:06 -07:00
committed by GitHub
parent 46d398b4e9
commit e905e9e10f
4 changed files with 46 additions and 0 deletions

View File

@@ -54,6 +54,22 @@ class PageObject {
await this.page.getByRole("button", { name: "Restart" }).click();
}
async clickPreviewRefresh() {
await this.page.getByTestId("preview-refresh-button").click();
}
async clickPreviewNavigateBack() {
await this.page.getByTestId("preview-navigate-back-button").click();
}
async clickPreviewNavigateForward() {
await this.page.getByTestId("preview-navigate-forward-button").click();
}
async clickPreviewOpenBrowser() {
await this.page.getByTestId("preview-open-browser-button").click();
}
locateLoadingAppPreview() {
return this.page.getByText("Loading app preview...");
}

19
e2e-tests/refresh.spec.ts Normal file
View File

@@ -0,0 +1,19 @@
import { test } from "./helpers/test_helper";
test("refresh app", async ({ po }) => {
await po.setUp({ autoApprove: true });
await po.sendPrompt("hi");
// Drop the document.body inside the contentFrame to make
// sure refresh works.
await po
.getPreviewIframeElement()
.contentFrame()
.locator("body")
.evaluate((body) => {
body.remove();
});
await po.clickPreviewRefresh();
await po.snapshotPreview();
});

View File

@@ -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/