Auto-approve E2E test (#299)

This commit is contained in:
Will Chen
2025-05-31 23:50:09 -07:00
committed by GitHub
parent 54af09a041
commit 5c8cd05cf6
4 changed files with 42 additions and 1 deletions

View File

@@ -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();
});

View File

@@ -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();
}

View File

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

View File

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