Auto-approve E2E test (#299)
This commit is contained in:
12
e2e-tests/auto_approve.spec.ts
Normal file
12
e2e-tests/auto_approve.spec.ts
Normal 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();
|
||||
});
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
- region "Notifications (F8)":
|
||||
- list
|
||||
- region "Notifications alt+T"
|
||||
- text: Testing:write-index!
|
||||
Reference in New Issue
Block a user