import { chromium } from "@playwright/test"; import { execSync } from "node:child_process"; const EMAIL = process.env.QA_EMAIL ?? "qa.mobile@polyllm.test", PASSWORD = process.env.QA_PASSWORD ?? "Str0ng-Passw0rd-qa!"; const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 1200, height: 800 } }); await p.goto("http://localhost:3000/signup", { waitUntil: "networkidle" }); console.log("labels:", await p.locator("label").allTextContents()); const name = p.getByLabel(/name/i).first(); if (await name.count()) await name.fill("QA Mobile"); await p.getByLabel(/email/i).first().fill(EMAIL); const pw = p.getByLabel(/^password$/i); await pw.first().fill(PASSWORD); const confirm = p.getByLabel(/confirm/i); if (await confirm.count()) await confirm.first().fill(PASSWORD); const terms = p.getByRole("checkbox"); if (await terms.count()) await terms.first().check().catch(() => {}); await p.getByRole("button", { name: /create|sign up/i }).first().click(); await p.waitForTimeout(4000); console.log("after signup url:", p.url()); console.log("alerts:", await p.locator('[role=alert], .text-danger').allTextContents()); console.log(execSync(`psql postgres://localhost:5432/polyllm -Atc "update users set email_verified=true where email='${EMAIL}' returning id"`).toString().trim() || "no user row"); await b.close();