test(beautify): fix E2E test selectors for processing flow

This commit is contained in:
SnapOtter
2026-05-08 17:12:16 +08:00
parent 666880b158
commit d32c7a279e
+7 -7
View File
@@ -48,25 +48,25 @@ test.describe("Beautify Screenshot", () => {
test("processes image with default settings", async ({ loggedInPage: page }) => { test("processes image with default settings", async ({ loggedInPage: page }) => {
await page.goto("/beautify"); await page.goto("/beautify");
await uploadTestImage(page); await uploadTestImage(page);
await page.waitForTimeout(1000); await page.waitForTimeout(1500);
// Click the Beautify button // Click the Beautify button
const processBtn = page.getByTestId("beautify-submit"); const processBtn = page.getByTestId("beautify-submit");
await expect(processBtn).toBeEnabled({ timeout: 5000 });
await processBtn.click(); await processBtn.click();
await waitForProcessing(page);
// Verify download is available // Wait for download link to appear (processing may be fast enough to skip spinner)
await expect( await expect(
page page
.getByTestId("beautify-download") .getByTestId("beautify-download")
.or(page.getByRole("link", { name: /download/i }).first()), .or(page.getByRole("link", { name: /download/i }).first()),
).toBeVisible({ timeout: 15_000 }); ).toBeVisible({ timeout: 30_000 });
}); });
test("applies preset and processes", async ({ loggedInPage: page }) => { test("applies preset and processes", async ({ loggedInPage: page }) => {
await page.goto("/beautify"); await page.goto("/beautify");
await uploadTestImage(page); await uploadTestImage(page);
await page.waitForTimeout(1000); await page.waitForTimeout(1500);
// Click a preset card // Click a preset card
const presetCards = page.locator("button").filter({ hasText: /purple haze|flamingo|ocean/i }); const presetCards = page.locator("button").filter({ hasText: /purple haze|flamingo|ocean/i });
@@ -82,13 +82,13 @@ test.describe("Beautify Screenshot", () => {
// Process // Process
const processBtn = page.getByTestId("beautify-submit"); const processBtn = page.getByTestId("beautify-submit");
await expect(processBtn).toBeEnabled({ timeout: 5000 });
await processBtn.click(); await processBtn.click();
await waitForProcessing(page);
await expect( await expect(
page page
.getByTestId("beautify-download") .getByTestId("beautify-download")
.or(page.getByRole("link", { name: /download/i }).first()), .or(page.getByRole("link", { name: /download/i }).first()),
).toBeVisible({ timeout: 15_000 }); ).toBeVisible({ timeout: 30_000 });
}); });
}); });