Add Prettier for TypeScript formatting
- Install prettier - Configure .prettierrc.json and .prettierignore - Add npm scripts: format, format:check - Add Makefile target: format-frontend - Format all frontend files
This commit is contained in:
parent
4b394b0698
commit
37de6f70e0
44 changed files with 906 additions and 856 deletions
|
|
@ -23,13 +23,13 @@ async function createInvite(request: APIRequestContext): Promise<string> {
|
|||
data: { email: ADMIN_EMAIL, password: ADMIN_PASSWORD },
|
||||
});
|
||||
const cookies = loginResp.headers()["set-cookie"];
|
||||
|
||||
|
||||
// Get admin user ID (we'll use admin as godfather for simplicity)
|
||||
const meResp = await request.get(`${API_BASE}/api/auth/me`, {
|
||||
headers: { Cookie: cookies },
|
||||
});
|
||||
const admin = await meResp.json();
|
||||
|
||||
|
||||
// Create invite
|
||||
const inviteResp = await request.post(`${API_BASE}/api/admin/invites`, {
|
||||
data: { godfather_id: admin.id },
|
||||
|
|
@ -61,7 +61,7 @@ test.describe("Authentication Flow", () => {
|
|||
test("signup page has invite code form", async ({ page }) => {
|
||||
await page.goto("/signup");
|
||||
await expect(page.locator("h1")).toHaveText("Join with Invite");
|
||||
await expect(page.locator('input#inviteCode')).toBeVisible();
|
||||
await expect(page.locator("input#inviteCode")).toBeVisible();
|
||||
await expect(page.locator('button[type="submit"]')).toHaveText("Continue");
|
||||
await expect(page.locator('a[href="/login"]')).toBeVisible();
|
||||
});
|
||||
|
|
@ -80,19 +80,22 @@ test.describe("Authentication Flow", () => {
|
|||
});
|
||||
|
||||
test.describe("Logged-in User Visiting Invite URL", () => {
|
||||
test("redirects to home when logged-in user visits direct invite URL", async ({ page, request }) => {
|
||||
test("redirects to home when logged-in user visits direct invite URL", async ({
|
||||
page,
|
||||
request,
|
||||
}) => {
|
||||
const email = uniqueEmail();
|
||||
const inviteCode = await createInvite(request);
|
||||
|
||||
// First sign up to create a user
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
|
||||
|
|
@ -110,13 +113,13 @@ test.describe("Logged-in User Visiting Invite URL", () => {
|
|||
|
||||
// Sign up and stay logged in
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
|
||||
|
|
@ -136,18 +139,18 @@ test.describe("Signup with Invite", () => {
|
|||
const inviteCode = await createInvite(request);
|
||||
|
||||
await page.goto("/signup");
|
||||
|
||||
|
||||
// Step 1: Enter invite code
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
|
||||
// Wait for form to transition to registration form
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
|
||||
// Step 2: Fill registration form
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Should redirect to home after signup
|
||||
|
|
@ -162,17 +165,17 @@ test.describe("Signup with Invite", () => {
|
|||
|
||||
// Use direct URL with code
|
||||
await page.goto(`/signup/${inviteCode}`);
|
||||
|
||||
|
||||
// Should redirect to signup with code in query and validate
|
||||
await page.waitForURL(/\/signup\?code=/);
|
||||
|
||||
|
||||
// Wait for form to transition to registration form
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
|
||||
// Fill registration form
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Should redirect to home
|
||||
|
|
@ -181,7 +184,7 @@ test.describe("Signup with Invite", () => {
|
|||
|
||||
test("shows error for invalid invite code", async ({ page }) => {
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', "fake-code-99");
|
||||
await page.fill("input#inviteCode", "fake-code-99");
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Should show error
|
||||
|
|
@ -192,14 +195,14 @@ test.describe("Signup with Invite", () => {
|
|||
const inviteCode = await createInvite(request);
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', uniqueEmail());
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "differentpassword");
|
||||
|
||||
await page.fill("input#email", uniqueEmail());
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "differentpassword");
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
await expect(page.getByText("Passwords do not match")).toBeVisible();
|
||||
|
|
@ -209,14 +212,14 @@ test.describe("Signup with Invite", () => {
|
|||
const inviteCode = await createInvite(request);
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', uniqueEmail());
|
||||
await page.fill('input#password', "short");
|
||||
await page.fill('input#confirmPassword', "short");
|
||||
|
||||
await page.fill("input#email", uniqueEmail());
|
||||
await page.fill("input#password", "short");
|
||||
await page.fill("input#confirmPassword", "short");
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
await expect(page.getByText("Password must be at least 6 characters")).toBeVisible();
|
||||
|
|
@ -231,7 +234,7 @@ test.describe("Login", () => {
|
|||
// Create a test user with invite
|
||||
testEmail = uniqueEmail();
|
||||
const inviteCode = await createInvite(request);
|
||||
|
||||
|
||||
// Register the test user via backend API
|
||||
await request.post(`${API_BASE}/api/auth/register`, {
|
||||
data: {
|
||||
|
|
@ -292,13 +295,13 @@ test.describe("Logout", () => {
|
|||
|
||||
// Sign up
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
|
||||
|
|
@ -315,13 +318,13 @@ test.describe("Logout", () => {
|
|||
|
||||
// Sign up
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
|
||||
|
|
@ -342,13 +345,13 @@ test.describe("Session Persistence", () => {
|
|||
|
||||
// Sign up
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
await expect(page.getByText(email)).toBeVisible();
|
||||
|
|
@ -366,13 +369,13 @@ test.describe("Session Persistence", () => {
|
|||
const inviteCode = await createInvite(request);
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
|
||||
|
|
@ -388,13 +391,13 @@ test.describe("Session Persistence", () => {
|
|||
const inviteCode = await createInvite(request);
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.fill('input#inviteCode', inviteCode);
|
||||
await page.fill("input#inviteCode", inviteCode);
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator("h1")).toHaveText("Create account");
|
||||
|
||||
await page.fill('input#email', email);
|
||||
await page.fill('input#password', "password123");
|
||||
await page.fill('input#confirmPassword', "password123");
|
||||
|
||||
await page.fill("input#email", email);
|
||||
await page.fill("input#password", "password123");
|
||||
await page.fill("input#confirmPassword", "password123");
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL("/");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue