strona-czynna/tests/admin.test.ts
Kuba Orlik 10ef8cd3d2 Coverage test
Summary: --

Reviewers: #reviewers

Subscribers: jenkins-user

Differential Revision: https://hub.sealcode.org/D1606
2025-07-22 17:26:24 +02:00

36 lines
1.5 KiB
TypeScript

import { test, expect } from "./backend-fixture.js";
test.beforeEach(async ({ page, backendUrl }) => {
await page.goto(backendUrl);
await page.getByRole("link", { name: "Go to Admin" }).click();
await page.getByPlaceholder("text").click();
await page.getByPlaceholder("text").fill("admin");
await page.getByPlaceholder("text").press("Tab");
await page.getByPlaceholder("password").fill("adminadmin");
await page.getByRole("button", { name: "Wyślij" }).click();
});
test("Basic flow of adding a navbar link", async ({ page }) => {
await page.getByRole("link", { name: "Edit Navbar" }).click();
await page.getByRole("link", { name: "Create" }).click();
await page.getByLabel("label").click();
await page.getByLabel("label").fill("Homepage");
await page.getByLabel("href").fill("/");
await page.getByRole("button", { name: "Wyślij" }).click();
await page.getByRole("link", { name: "Homepage" }).click();
await expect(page).toHaveScreenshot();
});
test("Basic flow of creating a page", async ({ page, backendUrl }) => {
await page.getByRole("link", { name: "Edit Pages" }).click();
await page.getByRole("link", { name: "Create" }).click();
await page.getByLabel("url").click();
await page.getByLabel("url").fill("/my-page/");
await page.getByLabel("title").fill("My Page");
await page.getByLabel("heading").fill("My Heading");
await page.getByLabel("description").fill("My Description");
await page.getByRole("button", { name: "Wyślij" }).click();
await page.goto(`${backendUrl}/my-page/`);
await expect(page).toHaveScreenshot();
});