feat: enhance admin API helpers with CRUD operations for collections and seed data management

- Added functions for creating, updating, deleting, and listing collection entries in admin API.
- Introduced seed data management for consistent test content across tests.
- Updated global setup and teardown processes to ensure seeded content is created and cleaned up.
- Refactored existing tests to utilize seeded content for improved reliability and maintainability.
This commit is contained in:
2026-05-12 20:36:06 +00:00
parent 491f495c66
commit 1b24bb2157
17 changed files with 697 additions and 444 deletions
+14 -15
View File
@@ -1,28 +1,27 @@
import { test, expect, waitForSpaReady, isMobileViewport } from "./fixtures"
import { test, expect, waitForSpaReady, isMobileViewport, openHamburgerMenu } from "./fixtures"
import { SEEDED_TEST_CONTENT } from "../fixtures/test-constants"
test.describe("Home Page (Mobile)", () => {
test("should load the start page on mobile", async ({ page }) => {
await page.goto("/de/")
test.describe("Seeded Home Page (Mobile)", () => {
test("loads the seeded page on mobile and keeps the current route prefix", async ({ page }) => {
await page.goto(`/de${SEEDED_TEST_CONTENT.home.path}`)
await waitForSpaReady(page)
expect(isMobileViewport(page) || true).toBeTruthy()
await expect(page.locator("#appContainer")).not.toBeEmpty()
await expect(page).toHaveURL(new RegExp(`/de${SEEDED_TEST_CONTENT.home.path}$`))
await expect(page.getByRole("heading", { level: 1, name: "Playwright Seed Startseite" })).toBeVisible()
})
test("should have a visible header", async ({ page }) => {
await page.goto("/de/")
test("opens the mobile menu and exposes the language switcher", async ({ page }) => {
await page.goto(`/de${SEEDED_TEST_CONTENT.home.path}`)
await waitForSpaReady(page)
const header = page.locator("header")
await expect(header).toBeVisible()
})
await openHamburgerMenu(page)
// Uncomment when your project has a hamburger menu:
// test("should open hamburger menu", async ({ page }) => {
// await page.goto("/de/")
// await waitForSpaReady(page)
// await openHamburgerMenu(page)
// const expandedBtn = page.locator("header button[aria-expanded='true']")
// await expect(expandedBtn).toBeVisible()
// })
await expect(page.locator("header button[aria-expanded='true']")).toBeVisible()
await expect(header.getByRole("link", { name: "Deutsch" })).toBeVisible()
await expect(header.getByRole("link", { name: "English" })).toBeVisible()
})
})