diff --git a/frontend/e2e/letter.spec.ts b/frontend/e2e/letter.spec.ts index bfc216a..3b90fce 100644 --- a/frontend/e2e/letter.spec.ts +++ b/frontend/e2e/letter.spec.ts @@ -208,7 +208,7 @@ test.describe("Letter Drafting (Real Backend)", () => { // Verify it opens the Reader without a hash logger.info(">> [Drawer] Verifying Reader page..."); // Give it a bit more time for decryption - await expect(page).toHaveURL(/\/read\/[a-f0-9-]{36}$/, { timeout: 15000 }); // UUID without hash + await expect(page).toHaveURL(/\/read\/[a-f0-9-]{36}$/, { timeout: 15000 }); // Reveal and check decrypted content in Reader await expect(page.getByText(/breaking the seal/i)).toBeHidden({ timeout: 10000, diff --git a/frontend/e2e/utils/auth.ts b/frontend/e2e/utils/auth.ts index a9d373e..e0b255e 100644 --- a/frontend/e2e/utils/auth.ts +++ b/frontend/e2e/utils/auth.ts @@ -54,6 +54,34 @@ async function registerAndLogin( await page.getByRole("button", { name: /sign in/i }).click(); await expect(page).toHaveURL(/\/drawer/); + await handleWelcomeLetter(page); logger.info(`[Auth] Successfully authenticated ${email}`); } -export const AuthHelper = { registerAndLogin }; + +/** + * Handles and dismisses the first welocme letter + */ +async function handleWelcomeLetter(page: Page) { + logger.info("[Auth] Handling Welcome Letter..."); + // Click envelope to flip + const envelope = page.locator("#env-front"); + await envelope.waitFor({ state: "visible", timeout: 10000 }); + await envelope.click(); + + // Click seal to open flap + const seal = page.getByAltText("Seal"); + await seal.waitFor({ state: "visible" }); + await seal.click(); + + // Click letter to reveal + await page.locator("#letter").click({ position: { x: 30, y: 15 } }); + + // Click "I'll see you" button + const completeButton = page.getByRole("button", { name: /I'll see you/i }); + await completeButton.waitFor({ state: "visible", timeout: 10000 }); + await completeButton.click(); + + await expect(completeButton).toBeHidden(); +} + +export const AuthHelper = { registerAndLogin, handleWelcomeLetter }; diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 13007d3..8a81b4f 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -15,7 +15,7 @@ const baseUrl = getBaseUrl( ); export default defineConfig({ - timeout: 60000, + timeout: 80000, expect: { timeout: 10000, },