switch versions e2e (#312)

This commit is contained in:
Will Chen
2025-06-02 21:31:47 -07:00
committed by GitHub
parent 0a8e40c73c
commit 4997a8f2ff
5 changed files with 41 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ class PageObject {
private userDataDir: string; private userDataDir: string;
constructor( constructor(
private page: Page, public page: Page,
{ userDataDir }: { userDataDir: string }, { userDataDir }: { userDataDir: string },
) { ) {
this.userDataDir = userDataDir; this.userDataDir = userDataDir;

View File

@@ -0,0 +1,4 @@
- region "Notifications (F8)":
- list
- region "Notifications alt+T"
- text: Testing:write-index!

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/

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/

View File

@@ -0,0 +1,22 @@
import { test } from "./helpers/test_helper";
import { expect } from "@playwright/test";
test("switch versions", async ({ po }) => {
await po.setUp({ autoApprove: true });
await po.sendPrompt("tc=write-index");
await po.snapshotPreview();
expect(
await po.page.getByRole("button", { name: "Version" }).textContent(),
).toBe("Version 2");
await po.page.getByRole("button", { name: "Version" }).click();
await po.page.getByText("Init Dyad app Undo").click();
await po.snapshotPreview();
await po.page.getByRole("button", { name: "Undo to latest version" }).click();
// Should be same as the previous snapshot, but just to be sure.
await po.snapshotPreview();
await expect(po.page.getByText("Version 3")).toBeVisible();
});