test: add welcome letter onboarding helper to e2e
This commit is contained in:
@@ -208,7 +208,7 @@ test.describe("Letter Drafting (Real Backend)", () => {
|
|||||||
// Verify it opens the Reader without a hash
|
// Verify it opens the Reader without a hash
|
||||||
logger.info(">> [Drawer] Verifying Reader page...");
|
logger.info(">> [Drawer] Verifying Reader page...");
|
||||||
// Give it a bit more time for decryption
|
// 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
|
// Reveal and check decrypted content in Reader
|
||||||
await expect(page.getByText(/breaking the seal/i)).toBeHidden({
|
await expect(page.getByText(/breaking the seal/i)).toBeHidden({
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
|
|||||||
@@ -54,6 +54,34 @@ async function registerAndLogin(
|
|||||||
await page.getByRole("button", { name: /sign in/i }).click();
|
await page.getByRole("button", { name: /sign in/i }).click();
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/drawer/);
|
await expect(page).toHaveURL(/\/drawer/);
|
||||||
|
await handleWelcomeLetter(page);
|
||||||
logger.info(`[Auth] Successfully authenticated ${email}`);
|
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 };
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const baseUrl = getBaseUrl(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
timeout: 60000,
|
timeout: 80000,
|
||||||
expect: {
|
expect: {
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user