feat: add navigation and media library tests with structured controls and visibility checks

This commit is contained in:
2026-05-12 22:43:27 +00:00
parent 53ad012657
commit 60d5920132
2 changed files with 75 additions and 10 deletions
+31 -10
View File
@@ -48,21 +48,42 @@ export async function openNovaProjectDashboard(page: Page): Promise<void> {
}
export async function openContentCollection(page: Page): Promise<void> {
await openNovaProjectDashboard(page)
await page
.getByRole("link", { name: /Inhalte/ })
.first()
.click()
await expect(page).toHaveURL(/\/collections\/content$/)
await expect(page.locator("main h1")).toHaveText("Inhalte")
await openCollection(page, /Inhalte/, "content", "Inhalte")
}
export async function openNewContentEntry(page: Page): Promise<void> {
await openContentCollection(page)
await openNewCollectionEntry(page, /Inhalte/, "content", "Inhalte")
}
export async function openNavigationCollection(page: Page): Promise<void> {
await openCollection(page, /Navigation/, "navigation", "Navigation")
}
export async function openNewNavigationEntry(page: Page): Promise<void> {
await openNewCollectionEntry(page, /Navigation/, "navigation", "Navigation")
}
export async function openMedialibCollection(page: Page): Promise<void> {
await openCollection(page, /Mediathek/, "medialib", "Mediathek")
}
export async function openNewMedialibEntry(page: Page): Promise<void> {
await openNewCollectionEntry(page, /Mediathek/, "medialib", "Mediathek")
}
async function openCollection(page: Page, linkName: RegExp, slug: string, heading: string): Promise<void> {
await openNovaProjectDashboard(page)
await page.getByRole("link", { name: linkName }).first().click()
await expect(page).toHaveURL(new RegExp(`/collections/${slug}(\\?.*)?$`))
await expect(page.locator("main h1")).toHaveText(heading)
}
async function openNewCollectionEntry(page: Page, linkName: RegExp, slug: string, heading: string): Promise<void> {
await openCollection(page, linkName, slug, heading)
await page.getByRole("button", { name: /Neuer Eintrag|New Entry/i }).click()
await expect(page).toHaveURL(/\/collections\/content\/entries\/new/)
await expect(page).toHaveURL(new RegExp(`/collections/${slug}/entries/new`))
await expect(page.getByRole("heading", { level: 1, name: /Neuer Eintrag|New Entry/i })).toBeVisible()
}