diff --git a/e2e-tests/auto_approve.spec.ts b/e2e-tests/auto_approve.spec.ts new file mode 100644 index 0000000..d7c628c --- /dev/null +++ b/e2e-tests/auto_approve.spec.ts @@ -0,0 +1,12 @@ +import { test } from "./helpers/test_helper"; +import { expect } from "@playwright/test"; + +test("auto-approve", async ({ po }) => { + await po.setUp({ autoApprove: true }); + await po.sendPrompt("tc=write-index"); + await po.snapshotMessages(); + + // This can be pretty slow because it's waiting for the app to build. + await expect(po.getPreviewIframeElement()).toBeVisible({ timeout: 15_000 }); + await po.snapshotPreview(); +}); diff --git a/e2e-tests/helpers/test_helper.ts b/e2e-tests/helpers/test_helper.ts index c119298..b63640a 100644 --- a/e2e-tests/helpers/test_helper.ts +++ b/e2e-tests/helpers/test_helper.ts @@ -8,10 +8,14 @@ const showDebugLogs = process.env.DEBUG_LOGS === "true"; class PageObject { constructor(private page: Page) {} - async setUp() { + async setUp({ autoApprove = false }: { autoApprove?: boolean } = {}) { await this.goToSettingsTab(); + if (autoApprove) { + await this.toggleAutoApprove(); + } await this.setUpTestProvider(); await this.setUpTestModel(); + await this.goToAppsTab(); await this.selectTestModel(); } @@ -142,6 +146,14 @@ class PageObject { await this.page.getByRole("link", { name: "Settings" }).click(); } + //////////////////////////////// + // Settings related + //////////////////////////////// + + async toggleAutoApprove() { + await this.page.getByRole("switch", { name: "Auto-approve" }).click(); + } + async goToAppsTab() { await this.page.getByRole("link", { name: "Apps" }).click(); } diff --git a/e2e-tests/snapshots/auto_approve.spec.ts_auto-approve-1.aria.yml b/e2e-tests/snapshots/auto_approve.spec.ts_auto-approve-1.aria.yml new file mode 100644 index 0000000..0b43a10 --- /dev/null +++ b/e2e-tests/snapshots/auto_approve.spec.ts_auto-approve-1.aria.yml @@ -0,0 +1,13 @@ +- paragraph: tc=write-index +- paragraph: OK, I'm going to do some writing now... +- img +- text: Index.tsx +- img +- text: "src/pages/Index.tsx Summary: write-description" +- paragraph: And it's done! +- img +- text: Approved +- button "Undo": + - img +- button "Retry": + - img \ No newline at end of file diff --git a/e2e-tests/snapshots/auto_approve.spec.ts_auto-approve-2.aria.yml b/e2e-tests/snapshots/auto_approve.spec.ts_auto-approve-2.aria.yml new file mode 100644 index 0000000..d176260 --- /dev/null +++ b/e2e-tests/snapshots/auto_approve.spec.ts_auto-approve-2.aria.yml @@ -0,0 +1,4 @@ +- region "Notifications (F8)": + - list +- region "Notifications alt+T" +- text: Testing:write-index! \ No newline at end of file