forked from cms/tibi-svelte-starter
✨ feat: enhance medialib image handling and add asset URL resolution
- Implemented `resolveApiAssetUrl` function to normalize asset URLs based on API base. - Updated `MedialibImage` component to utilize new asset URL resolution and added support for alt text and class properties. - Enhanced image loading behavior with improved width measurement and focal point handling. - Added placeholder image handling and improved accessibility with alt text. - Introduced new test script for auditing broken links in skill documentation. - Expanded seeded test content to include medialib entries and updated related tests for pagebuilder previews. - Improved global setup and teardown logging for clarity on seeded content management.
This commit is contained in:
@@ -21,6 +21,9 @@ export const test = base.extend({
|
||||
export async function loginToAdmin(page: Page): Promise<void> {
|
||||
await page.goto(`${TEST_ADMIN_BASE_URL}/login`)
|
||||
|
||||
// Admin bootet als SPA; das Formular ist oft erst nach Chunk-Ladevorgang interaktiv.
|
||||
await expect(page.getByLabel(/Benutzername|Username/i)).toBeVisible({ timeout: 20000 })
|
||||
|
||||
await page.getByLabel(/Benutzername|Username/i).fill(ADMIN_UI_CREDENTIALS.username)
|
||||
await page.getByLabel(/Passwort|Password/i).fill(ADMIN_UI_CREDENTIALS.password)
|
||||
await page.getByRole("button", { name: /Anmelden|Sign in|Login/i }).click()
|
||||
@@ -55,6 +58,17 @@ export async function openNewContentEntry(page: Page): Promise<void> {
|
||||
await openNewCollectionEntry(page, /Inhalte/, "content", "Inhalte")
|
||||
}
|
||||
|
||||
export async function openContentEntry(page: Page, rowText: string | RegExp): Promise<void> {
|
||||
await openContentCollection(page)
|
||||
|
||||
const entryRow = page.getByRole("row").filter({ hasText: rowText }).first()
|
||||
await expect(entryRow).toBeVisible()
|
||||
await entryRow.click()
|
||||
|
||||
await expect(page).toHaveURL(/\/collections\/content\/entries\/[^/?]+/)
|
||||
await expect(page.locator("main")).toBeVisible()
|
||||
}
|
||||
|
||||
export async function openNavigationCollection(page: Page): Promise<void> {
|
||||
await openCollection(page, /Navigation/, "navigation", "Navigation")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { test, expect, openContentEntry } from "./fixtures"
|
||||
|
||||
test.describe("Admin pagebuilder registry and preview rendering", () => {
|
||||
test("renders seeded image-backed blocks through the configured pagebuilder registry", async ({ page }) => {
|
||||
await openContentEntry(page, /Playwright Pagebuilder Preview/)
|
||||
|
||||
const previewRoot = page.locator("[data-admin-preview]")
|
||||
const heroPreview = previewRoot.locator("[data-block='hero']").first()
|
||||
const richtextPreview = previewRoot.locator("[data-block='richtext']").first()
|
||||
|
||||
await expect(previewRoot.first()).toBeVisible()
|
||||
await expect(heroPreview.getByRole("heading", { name: "Playwright Registry Hero" })).toBeVisible()
|
||||
await expect(richtextPreview).toContainText("Richtext mit Bild")
|
||||
await expect(richtextPreview).toContainText("dass ein image-gestuetzter Preview-Block")
|
||||
|
||||
const previewImages = previewRoot.locator("img[data-entry-id]")
|
||||
await expect(previewImages.first()).toBeVisible()
|
||||
await expect(previewImages.first()).toHaveAttribute("src", /\/medialib\/[^/]+\/file\/[^?]+(?:\?filter=[^"']+)?/)
|
||||
await expect(previewImages).toHaveCount(2)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user