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.
This commit is contained in:
parent
0b6e00b99c
commit
f312b7b8f4
2 changed files with 13 additions and 12 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue