test: add welcome letter onboarding helper to e2e
CI / Generate Certificates (pull_request) Successful in 31s
CI / Frontend CI (pull_request) Successful in 1m6s
CI / Backend CI (pull_request) Successful in 1m7s
CI / E2E Tests (pull_request) Successful in 7m13s

This commit is contained in:
me
2026-05-06 21:53:20 +05:30
parent e532507a0f
commit c0fb7aabf8
3 changed files with 31 additions and 3 deletions
+1 -1
View File
@@ -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,
+29 -1
View File
@@ -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 };
+1 -1
View File
@@ -15,7 +15,7 @@ const baseUrl = getBaseUrl(
);
export default defineConfig({
timeout: 60000,
timeout: 80000,
expect: {
timeout: 10000,
},