From f312b7b8f4aff0e7a535bc5893c372aa35a06b95 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 10 Aug 2026 16:01:51 -0400 Subject: [PATCH] test(e2e): refresh frontend login and landing smoke tests Enable baseURL in playwright config and replace the placeholder homepage check with a landing-page test and a dev-user login flow. --- playwright.config.ts | 2 +- tests/e2e/frontend.e2e.spec.ts | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/playwright.config.ts b/playwright.config.ts index 7a5a8b3..02d57fc 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -22,7 +22,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://localhost:3000', + baseURL: "http://localhost:3000", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", diff --git a/tests/e2e/frontend.e2e.spec.ts b/tests/e2e/frontend.e2e.spec.ts index dfb3e99..bf99b41 100644 --- a/tests/e2e/frontend.e2e.spec.ts +++ b/tests/e2e/frontend.e2e.spec.ts @@ -1,20 +1,21 @@ -import { expect, Page, test } from "@playwright/test"; +import { expect, test } from "@playwright/test"; test.describe("Frontend", () => { - let page: Page; + test("guests see the landing page", async ({ page }) => { + await page.goto("/"); - test.beforeAll(async ({ browser }, testInfo) => { - const context = await browser.newContext(); - page = await context.newPage(); + await expect(page).toHaveTitle(/Polaris Task Force/); + await expect(page.getByRole("heading", { level: 1 })).toHaveText("Polaris Task Force"); + await expect(page.getByRole("link", { name: "Log in to access the portal" })).toBeVisible(); }); - test("can go on homepage", async ({ page }) => { - await page.goto("http://localhost:3000"); + test("a user can log in and reach the dashboard", async ({ page }) => { + await page.goto("/login"); - await expect(page).toHaveTitle(/Payload Blank Template/); + await page.getByLabel("Username").fill("dev"); + await page.getByLabel("Password").fill("Test123"); + await page.getByRole("button", { name: "Log in" }).click(); - const heading = page.locator("h1").first(); - - await expect(heading).toHaveText("Welcome to your new project."); + await expect(page.getByRole("heading", { level: 1 })).toHaveText("Welcome back, J. Fraley"); }); });