✨ feat: add navigation and media library tests with structured controls and visibility checks
This commit is contained in:
+31
-10
@@ -48,21 +48,42 @@ export async function openNovaProjectDashboard(page: Page): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function openContentCollection(page: Page): Promise<void> {
|
export async function openContentCollection(page: Page): Promise<void> {
|
||||||
await openNovaProjectDashboard(page)
|
await openCollection(page, /Inhalte/, "content", "Inhalte")
|
||||||
await page
|
|
||||||
.getByRole("link", { name: /Inhalte/ })
|
|
||||||
.first()
|
|
||||||
.click()
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/collections\/content$/)
|
|
||||||
await expect(page.locator("main h1")).toHaveText("Inhalte")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function openNewContentEntry(page: Page): Promise<void> {
|
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 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()
|
await expect(page.getByRole("heading", { level: 1, name: /Neuer Eintrag|New Entry/i })).toBeVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { test, expect, openNavigationCollection, openMedialibCollection, openNewMedialibEntry } from "./fixtures"
|
||||||
|
|
||||||
|
test.describe("Admin navigation and media config", () => {
|
||||||
|
test("renders the navigation collection with declared trees and structure controls", async ({ page }) => {
|
||||||
|
await openNavigationCollection(page)
|
||||||
|
|
||||||
|
const main = page.locator("main")
|
||||||
|
await expect(page).toHaveURL(/\/collections\/navigation\?view=navigation$/)
|
||||||
|
await expect(page.getByRole("heading", { level: 2, name: "Deklarierte Bäume" })).toBeVisible()
|
||||||
|
await expect(main).toContainText("Header DE")
|
||||||
|
await expect(main).toContainText("Header EN")
|
||||||
|
await expect(main).toContainText("Footer DE")
|
||||||
|
await expect(main).toContainText("Footer EN")
|
||||||
|
await expect(main).toContainText("Wurzelknoten")
|
||||||
|
await expect(main).toContainText("Max. Ebene")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("renders the media library list with subnavigation and previews", async ({ page }) => {
|
||||||
|
await openMedialibCollection(page)
|
||||||
|
|
||||||
|
const main = page.locator("main")
|
||||||
|
await expect(page).toHaveURL(/\/collections\/medialib\?view=media$/)
|
||||||
|
await expect(page.getByRole("region", { name: "Mediathek-Raster" })).toBeVisible()
|
||||||
|
await expect(main).toContainText("Bilder")
|
||||||
|
await expect(main).toContainText("Dokumente")
|
||||||
|
await expect(main).toContainText("Dateien hinzufügen")
|
||||||
|
await expect(
|
||||||
|
page.getByRole("img", { name: /Technology Stack|Homepage Hero|About Team|Contact Hero|Workflow/ }).first()
|
||||||
|
).toBeVisible()
|
||||||
|
})
|
||||||
|
|
||||||
|
test("shows the configured media widgets in the new entry form", async ({ page }) => {
|
||||||
|
await openNewMedialibEntry(page)
|
||||||
|
|
||||||
|
await expect(page.getByText("Datei", { exact: true })).toBeVisible()
|
||||||
|
await expect(page.getByRole("button", { name: /Datei hochladen/ })).toBeVisible()
|
||||||
|
await expect(page.getByLabel("Titel")).toBeVisible()
|
||||||
|
await expect(page.getByText("Alt-Text")).toBeVisible()
|
||||||
|
await expect(page.getByRole("tab", { name: "de" })).toBeVisible()
|
||||||
|
await expect(page.getByRole("tab", { name: "en" })).toBeVisible()
|
||||||
|
await expect(page.getByLabel("Beschreibung")).toBeVisible()
|
||||||
|
await expect(page.getByLabel("Tags")).toBeVisible()
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user