Unverified 提交 5c8cd05c authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Auto-approve E2E test (#299)

上级 54af09a0
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"; ...@@ -8,10 +8,14 @@ const showDebugLogs = process.env.DEBUG_LOGS === "true";
class PageObject { class PageObject {
constructor(private page: Page) {} constructor(private page: Page) {}
async setUp() { async setUp({ autoApprove = false }: { autoApprove?: boolean } = {}) {
await this.goToSettingsTab(); await this.goToSettingsTab();
if (autoApprove) {
await this.toggleAutoApprove();
}
await this.setUpTestProvider(); await this.setUpTestProvider();
await this.setUpTestModel(); await this.setUpTestModel();
await this.goToAppsTab(); await this.goToAppsTab();
await this.selectTestModel(); await this.selectTestModel();
} }
...@@ -142,6 +146,14 @@ class PageObject { ...@@ -142,6 +146,14 @@ class PageObject {
await this.page.getByRole("link", { name: "Settings" }).click(); await this.page.getByRole("link", { name: "Settings" }).click();
} }
////////////////////////////////
// Settings related
////////////////////////////////
async toggleAutoApprove() {
await this.page.getByRole("switch", { name: "Auto-approve" }).click();
}
async goToAppsTab() { async goToAppsTab() {
await this.page.getByRole("link", { name: "Apps" }).click(); await this.page.getByRole("link", { name: "Apps" }).click();
} }
......
- 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
- region "Notifications (F8)":
- list
- region "Notifications alt+T"
- text: Testing:write-index!
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论