chore: replace console logs with pino-pretty

This commit is contained in:
ramvignesh-b
2026-04-15 13:34:05 +05:30
parent e8e9a402d6
commit ef545e9e2b
4 changed files with 63 additions and 9 deletions
-4
View File
@@ -13,9 +13,6 @@ test.describe("Authentication Flow (Real Backend)", () => {
}) => {
// Perform full auth cycle using helper
await AuthHelper.registerAndLogin(page, email, fullName, password);
// 5. Verify Zero-Knowledge Artifacts in IndexedDB
console.log(">>--- Verifying MasterKey in IndexedDB...");
const masterKeyExists = await page.evaluate(async () => {
return new Promise((resolve) => {
const request = indexedDB.open("piku-keys");
@@ -36,6 +33,5 @@ test.describe("Authentication Flow (Real Backend)", () => {
});
expect(masterKeyExists).toBe(true);
console.log(">>--- E2E Flow Completed Successfully! ✅ ---<<");
});
});
+14 -4
View File
@@ -1,6 +1,16 @@
import { expect, type Page } from "@playwright/test";
import pino from "pino";
import { MailpitHelper } from "./mailpit";
const logger = pino({
transport: {
target: "pino-pretty",
options: {
colorize: true,
},
},
});
/**
* Completes the full registration -> activation -> login cycle.
*/
@@ -11,7 +21,7 @@ export async function registerAndLogin(
password: string,
) {
// 1. Registration
console.log(`[Auth] Registering user: ${email}`);
logger.info(`[Auth] Registering user: ${email}`);
await page.goto("/onboard");
await page.getByLabel(/full name/i).fill(fullName);
await page.getByLabel("Email", { exact: true }).fill(email);
@@ -22,7 +32,7 @@ export async function registerAndLogin(
await expect(page).toHaveURL(/\/verify-email/);
// 2. Activation via Mailpit
console.log(`[Auth] Polling Mailpit for activation email...`);
logger.info(`[Auth] Polling Mailpit for activation email...`);
const activationLink = await MailpitHelper.getActivationLink(email);
await page.goto(activationLink);
@@ -30,7 +40,7 @@ export async function registerAndLogin(
await page.getByRole("button", { name: /start writing/i }).click();
// 3. Login
console.log(`[Auth] Logging in...`);
logger.info(`[Auth] Logging in...`);
await expect(page).toHaveURL(/\/login/);
const welcomeButton = page.getByRole("button", { name: /i understand/i });
@@ -43,7 +53,7 @@ export async function registerAndLogin(
await page.getByRole("button", { name: /sign in/i }).click();
await expect(page).toHaveURL(/\/drawer/);
console.log(`[Auth] Successfully authenticated ${email}`);
logger.info(`[Auth] Successfully authenticated ${email}`);
}
// Maintain backward compatibility if needed, or update callers