From af751e4f94e73174ed17d82293c7da7e505f6932 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Sun, 5 Jul 2026 22:16:37 +0200 Subject: [PATCH] fix(email): import React in auth template for server-side rendering compatibility --- packages/email/src/templates/auth.tsx | 4 + tests/e2e/specs/applications-tracker.spec.ts | 80 ++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 tests/e2e/specs/applications-tracker.spec.ts diff --git a/packages/email/src/templates/auth.tsx b/packages/email/src/templates/auth.tsx index 807f39bc7..b86c841ed 100644 --- a/packages/email/src/templates/auth.tsx +++ b/packages/email/src/templates/auth.tsx @@ -1,3 +1,4 @@ +import * as React from "react"; import { Body, Button, @@ -16,6 +17,9 @@ import { Text, } from "react-email"; +// ponytail: server dev consumes this source through tsx, which emits React.createElement here. +void React; + const appName = "Reactive Resume"; const logoUrl = "https://rxresu.me/icon/dark.svg"; diff --git a/tests/e2e/specs/applications-tracker.spec.ts b/tests/e2e/specs/applications-tracker.spec.ts new file mode 100644 index 000000000..c3cd15e79 --- /dev/null +++ b/tests/e2e/specs/applications-tracker.spec.ts @@ -0,0 +1,80 @@ +import type { Locator, Page } from "@playwright/test"; +import { expect, test } from "../fixtures/test"; + +const field = (sheet: Locator, label: string) => + sheet + .locator("label") + .filter({ hasText: label }) + .locator("xpath=following-sibling::input | following-sibling::textarea") + .first(); + +async function openApplications(page: Page) { + await page.goto("/dashboard/applications"); + await expect(page.getByRole("heading", { name: "Applications" })).toBeVisible(); +} + +test("adds an application and logs stage changes and notes", async ({ authPage: page }) => { + const company = `E2E Company ${Date.now().toString(36)}`; + const role = "Frontend Platform Engineer"; + const note = "Follow up with the hiring manager after the screen."; + + await openApplications(page); + await page.getByRole("button", { name: "Add application" }).click(); + + const sheet = page.getByRole("dialog", { name: "Add application" }); + await field(sheet, "Company").fill(company); + await field(sheet, "Role / title").fill(role); + await field(sheet, "Location").fill("Remote"); + await field(sheet, "Salary range").fill("$180k"); + await field(sheet, "Source").fill("Referral"); + await field(sheet, "Notes").fill("Submitted through a referral."); + await sheet.getByRole("button", { name: "Add to pipeline" }).click(); + + const card = page.getByRole("button", { name: new RegExp(`${role}.*${company}`) }).first(); + await expect(card).toBeVisible(); + await expect(card).toContainText("Referral"); + + await card.click(); + const detail = page.getByRole("dialog", { name: role }); + await expect(detail.getByText(company)).toBeVisible(); + await detail.getByRole("button", { name: "Move to Applied" }).click(); + await expect(detail.getByRole("button", { name: "Move to Screening" })).toBeVisible(); + await expect(detail.getByText("Moved to Applied")).toBeVisible(); + + await detail.getByPlaceholder("Add a note or log activity…").fill(note); + await detail.getByRole("button", { name: "Add", exact: true }).click(); + await expect(detail.getByText(note)).toBeVisible(); +}); + +test("imports applications from CSV and archives them from the table view", async ({ authPage: page }) => { + const company = `E2E Import ${Date.now().toString(36)}`; + const role = "Imported Product Engineer"; + const csv = [ + "Company,Role,Stage,Location,Salary,Source,Tags", + `${company},${role},applied,Remote,$190k,LinkedIn,remote;imported`, + ].join("\n"); + + await openApplications(page); + await page.getByRole("button", { name: /Import (CSV|from CSV)/ }).click(); + + const sheet = page.getByRole("dialog", { name: "Import from CSV" }); + await sheet.locator("textarea").fill(csv); + await expect(sheet.getByText("1 ready to import")).toBeVisible(); + await sheet.getByRole("button", { name: "Import 1" }).click(); + + await expect(page.getByRole("button", { name: new RegExp(`${role}.*${company}`) }).first()).toBeVisible(); + + await page.getByRole("tab", { name: "Insights" }).click(); + await expect(page.getByText("Pipeline health across all applications")).toBeVisible(); + await expect(page.getByText("Where your applications went")).toBeVisible(); + + await page.getByRole("tab", { name: "Table" }).click(); + await expect(page.getByRole("button", { name: new RegExp(`${role}.*${company}`) }).first()).toBeVisible(); + await page.getByRole("checkbox", { name: `Select ${company}` }).check(); + await expect(page.getByText("1 selected")).toBeVisible(); + await page.getByRole("button", { name: "Archive" }).click(); + + await expect(page.getByText("No applications match your filters.")).toBeVisible(); + await page.getByRole("button", { name: "Archived (1)" }).click(); + await expect(page.getByRole("button", { name: new RegExp(`${role}.*${company}`) }).first()).toBeVisible(); +});