36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import { test, expect } from "./backend-fixture.js";
|
|
|
|
test.beforeEach(async ({ page, backend }) => {
|
|
await page.goto(backend.url);
|
|
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, backend }) => {
|
|
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(`${backend.url}/my-page/`);
|
|
await expect(page).toHaveScreenshot();
|
|
});
|