Support native Git (experimental) (#338)

This commit is contained in:
Will Chen
2025-06-04 21:37:05 -07:00
committed by GitHub
parent 4e38031a65
commit 3558663ab7
25 changed files with 455 additions and 96 deletions

View File

@@ -1,22 +1,30 @@
import { testSkipIfWindows } from "./helpers/test_helper";
import { PageObject, testSkipIfWindows } from "./helpers/test_helper";
import { expect } from "@playwright/test";
testSkipIfWindows("switch versions", async ({ po }) => {
await po.setUp({ autoApprove: true });
const runSwitchVersionTest = async (po: PageObject, nativeGit: boolean) => {
await po.setUp({ autoApprove: true, nativeGit });
await po.sendPrompt("tc=write-index");
await po.snapshotPreview();
await po.snapshotPreview({ name: `v2` });
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.snapshotPreview({ name: `v1` });
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 po.snapshotPreview({ name: `v1` });
await expect(po.page.getByText("Version 3")).toBeVisible();
};
testSkipIfWindows("switch versions", async ({ po }) => {
await runSwitchVersionTest(po, false);
});
testSkipIfWindows("switch versions with native git", async ({ po }) => {
await runSwitchVersionTest(po, true);
});