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:
2026-05-17 00:52:41 +00:00
parent 958b45272d
commit 4020ad62c5
44 changed files with 4276 additions and 867 deletions
+28 -1
View File
@@ -1,5 +1,32 @@
import { APIRequestContext, request } from "@playwright/test"
declare const process: {
env: Record<string, string | undefined>
cwd(): string
}
declare function require(name: string): any
function detectMaildevUrlFromProject(): string | null {
const projectName =
process.env.PROJECT_NAME ||
(() => {
try {
const fs = require("fs")
const path = require("path")
const envPath = path.resolve(process.cwd(), ".env")
if (fs.existsSync(envPath)) {
const match = fs.readFileSync(envPath, "utf8").match(/PROJECT_NAME=(.+)/)
return match ? match[1].trim() : null
}
} catch {}
return null
})()
return projectName ? `https://${projectName}-maildev.code.testversion.online` : null
}
/**
* MailDev API helper for testing email flows.
*
@@ -8,7 +35,7 @@ import { APIRequestContext, request } from "@playwright/test"
* - MAILDEV_USER: Basic auth username (default: code)
* - MAILDEV_PASS: Basic auth password
*/
const MAILDEV_URL = process.env.MAILDEV_URL || "http://localhost:1080"
const MAILDEV_URL = process.env.MAILDEV_URL || detectMaildevUrlFromProject() || "http://localhost:1080"
const MAILDEV_USER = process.env.MAILDEV_USER || "code"
const MAILDEV_PASS = process.env.MAILDEV_PASS || ""