diff --git a/docs/feature-overview-playwright-validation-2026-04-15.html b/docs/feature-overview-playwright-validation-2026-04-15.html index 942d8cfa..df8c91fc 100644 --- a/docs/feature-overview-playwright-validation-2026-04-15.html +++ b/docs/feature-overview-playwright-validation-2026-04-15.html @@ -567,7 +567,11 @@

执行命令: - BASE_URL= node scripts/playwright-functional-check.mjs + PLAYWRIGHT_SOURCE_PATH=<path-visible-to-operator-runner> BASE_URL=<deployed-api-base-url> node scripts/playwright-functional-check.mjs +

+

+ PLAYWRIGHT_SOURCE_PATH 必须指向 operator-runner 可读取的真实数据路径;BOS 来源需同时设置 + PLAYWRIGHT_SOURCE_DATA_SOURCE=BOS 并准备运行时访问配置。

diff --git a/docs/feature-overview-playwright-validation-2026-04-15.md b/docs/feature-overview-playwright-validation-2026-04-15.md index c4a36c16..62a0b8a6 100644 --- a/docs/feature-overview-playwright-validation-2026-04-15.md +++ b/docs/feature-overview-playwright-validation-2026-04-15.md @@ -332,9 +332,13 @@ Playwright 实测覆盖了: 执行命令如下: ```bash -BASE_URL= node scripts/playwright-functional-check.mjs +PLAYWRIGHT_SOURCE_PATH= \ +BASE_URL= \ +node scripts/playwright-functional-check.mjs ``` +`PLAYWRIGHT_SOURCE_PATH` 必须指向 operator-runner 可读取的真实数据路径。默认按文件系统路径处理;如果确实要使用 BOS,可同时设置 `PLAYWRIGHT_SOURCE_DATA_SOURCE=BOS` 并确保运行时具备对应 BOS 访问配置。 + 脚本文件位置: - [scripts/playwright-functional-check.mjs](../scripts/playwright-functional-check.mjs) diff --git a/scripts/playwright-functional-check.mjs b/scripts/playwright-functional-check.mjs index 1bbbad95..be7e922e 100644 --- a/scripts/playwright-functional-check.mjs +++ b/scripts/playwright-functional-check.mjs @@ -9,6 +9,13 @@ const videoDir = path.join(artifactDir, "video"); const suffix = Date.now().toString(36); const scanBucket = (process.env.PLAYWRIGHT_SCAN_BUCKET || "").trim(); const scanPrefix = (process.env.PLAYWRIGHT_SCAN_PREFIX || "").trim().replace(/^\/+|\/+$/g, ""); +const sourcePath = (process.env.PLAYWRIGHT_SOURCE_PATH || "").trim(); +const sourceDataSource = ( + process.env.PLAYWRIGHT_SOURCE_DATA_SOURCE || + (sourcePath.toLowerCase().startsWith("bos://") ? "BOS" : "FILESYSTEM") +) + .trim() + .toUpperCase(); const names = { admin: `PW Admin ${suffix}`, adminEmail: `pw-admin-${suffix}@playwright.local`, @@ -34,6 +41,21 @@ function assert(condition, message) { } } +function requirePlaywrightSourcePath() { + if (!sourcePath) { + throw new Error( + "PLAYWRIGHT_SOURCE_PATH is required. Point it at a real source path visible to the operator runner, for example a shared PVC dataset path.", + ); + } +} + +function sourceHyperparams() { + return [ + { key: "DATA_SOURCE", value: sourceDataSource, description: "真实数据来源类型" }, + { key: "SOURCE_PATH", value: sourcePath, description: "真实数据路径" }, + ]; +} + async function api(path, init = {}) { let lastError; for (let attempt = 1; attempt <= 6; attempt += 1) { @@ -307,6 +329,7 @@ async function fillLabeledInput(page, labelText, value) { } async function main() { + requirePlaywrightSourcePath(); await cleanupTestData(); fs.mkdirSync(videoDir, { recursive: true }); @@ -637,7 +660,7 @@ async function main() { description: "Playwright source node", inputs: [], outputs: [{ id: "out-1", name: "manifest", type: "json" }], - hyperparams: [{ key: "SOURCE_TEXT", value: `playwright-${suffix}`, description: "直接注入文本内容" }], + hyperparams: sourceHyperparams(), }, position: { x: 100, y: 100 }, }, @@ -690,8 +713,8 @@ async function main() { await page.reload({ waitUntil: "networkidle" }); await page.locator(".react-flow__node").filter({ hasText: "真实数据源" }).first().dblclick(); - const sourceGroup = page.locator('label:has-text("SOURCE_TEXT")').locator("..").locator(".."); - await sourceGroup.locator("input").fill(`playwright-ui-${suffix}`); + const sourceGroup = page.locator('label:has-text("SOURCE_PATH")').locator("..").locator(".."); + await sourceGroup.locator("input").fill(sourcePath); await page.getByRole("button", { name: "保存" }).click(); log("run workflow from editor without redirect"); @@ -771,12 +794,7 @@ async function main() { description: "Edge output running source", inputs: [], outputs: [{ id: "out-1", name: "manifest", type: "json" }], - hyperparams: [ - { - key: "SOURCE_TEXT", - value: `edge-running-${suffix}`, - }, - ], + hyperparams: sourceHyperparams(), }, position: { x: 80, y: 80 }, }, @@ -867,12 +885,7 @@ async function main() { description: "Edge output failed source", inputs: [], outputs: [{ id: "out-1", name: "manifest", type: "json" }], - hyperparams: [ - { - key: "SOURCE_TEXT", - value: `edge-failed-${suffix}`, - }, - ], + hyperparams: sourceHyperparams(), }, position: { x: 80, y: 80 }, },