E2E test for fixing errors (#351)

This commit is contained in:
Will Chen
2025-06-05 23:29:52 -07:00
committed by GitHub
parent d3fbb48472
commit 4907fcafd8
10 changed files with 140 additions and 6 deletions

View File

@@ -10,10 +10,10 @@ import { generateAppFilesSnapshotData } from "./generateAppFilesSnapshotData";
const showDebugLogs = process.env.DEBUG_LOGS === "true";
export const Timeout = {
// Why make this a constant? In some platforms, perhaps locally,
// we may want to shorten this.
LONG: os.platform() === "win32" ? 60_000 : 30_000,
MEDIUM: os.platform() === "win32" ? 30_000 : 15_000,
// Things generally take longer on CI, so we make them longer.
EXTRA_LONG: process.env.CI ? 120_000 : 60_000,
LONG: process.env.CI ? 60_000 : 30_000,
MEDIUM: process.env.CI ? 30_000 : 15_000,
};
export class PageObject {
@@ -165,6 +165,20 @@ export class PageObject {
return this.page.getByTestId("preview-iframe-element");
}
async clickFixErrorWithAI() {
await this.page.getByRole("button", { name: "Fix error with AI" }).click();
}
async snapshotPreviewErrorBanner() {
await expect(this.locatePreviewErrorBanner()).toMatchAriaSnapshot({
timeout: Timeout.LONG,
});
}
locatePreviewErrorBanner() {
return this.page.getByTestId("preview-error-banner");
}
async snapshotPreview({ name }: { name?: string } = {}) {
const iframe = this.getPreviewIframeElement();
await expect(iframe.contentFrame().locator("body")).toMatchAriaSnapshot({