mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
Feature/saajan persona (#3)
* feat: add template based email content (html + plaintext fallback) * feat: init saajan component * feat: add aesthetic noise background and implement Saajan component in register and login * feat: add post seal modal for vault * refactor: add proper props interfaces * refactor: expose props on ui components * feat: add ssajan in lots of flows * fix: remove render test with no value and add aria helper for btn identification * refactor: update email notification to account for proper arguments * refactor: refactor E2E auth helper and mail parsing logic --------- Co-authored-by: ramvignesh-b <ramvignesh-b@github.com>
This commit is contained in:
@@ -14,13 +14,13 @@ const logger = pino({
|
||||
/**
|
||||
* Completes the full registration -> activation -> login cycle.
|
||||
*/
|
||||
export async function registerAndLogin(
|
||||
async function registerAndLogin(
|
||||
page: Page,
|
||||
email: string,
|
||||
fullName: string,
|
||||
password: string,
|
||||
) {
|
||||
// 1. Registration
|
||||
// Register the User
|
||||
logger.info(`[Auth] Registering user: ${email}`);
|
||||
await page.goto("/onboard");
|
||||
await page.getByLabel(/pen name/i).fill(fullName);
|
||||
@@ -31,7 +31,7 @@ export async function registerAndLogin(
|
||||
|
||||
await expect(page).toHaveURL(/\/verify-email/);
|
||||
|
||||
// 2. Activation via Mailpit
|
||||
// Get activation URL from Mailpit and activate user
|
||||
logger.info(`[Auth] Polling Mailpit for activation email...`);
|
||||
const activationLink = await MailpitHelper.getActivationLink(email);
|
||||
|
||||
@@ -40,11 +40,11 @@ export async function registerAndLogin(
|
||||
await expect(page.getByText(/account activated/i)).toBeVisible();
|
||||
await page.getByRole("button", { name: /start writing/i }).click();
|
||||
|
||||
// 3. Login
|
||||
// Dismiss the Welcom Modal and Perform Login
|
||||
logger.info(`[Auth] Logging in...`);
|
||||
await expect(page).toHaveURL(/\/login/);
|
||||
|
||||
const welcomeButton = page.getByRole("button", { name: /i understand/i });
|
||||
const welcomeButton = page.getByRole("button", { name: /I'll remember/i });
|
||||
await welcomeButton.waitFor({ state: "visible", timeout: 10000 });
|
||||
await welcomeButton.click();
|
||||
await expect(welcomeButton).toBeHidden();
|
||||
@@ -56,6 +56,4 @@ export async function registerAndLogin(
|
||||
await expect(page).toHaveURL(/\/drawer/);
|
||||
logger.info(`[Auth] Successfully authenticated ${email}`);
|
||||
}
|
||||
|
||||
// Maintain backward compatibility if needed, or update callers
|
||||
export const AuthHelper = { registerAndLogin };
|
||||
|
||||
@@ -31,8 +31,8 @@ export const MailpitHelper = {
|
||||
);
|
||||
const details = await detailRes.json();
|
||||
|
||||
const body = details.HTML || details.Text || "";
|
||||
const match = body.match(/https?:\/\/\S+activate\/\S+/);
|
||||
const body = details.Text || "";
|
||||
const match = body.match(/https?:\/\/\S*activate\S*/);
|
||||
|
||||
if (match) return match[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user