test(templates): keep sweep evidence outside source
This commit is contained in:
@@ -3,8 +3,6 @@ const { chromium } = require("playwright");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const REPO_ROOT = path.resolve(__dirname, "..", "..");
|
||||
|
||||
function parseArgs(argv) {
|
||||
const args = {
|
||||
baseUrl: "http://localhost:3000",
|
||||
@@ -12,7 +10,7 @@ function parseArgs(argv) {
|
||||
expectedCount: 60,
|
||||
selection: "draftable",
|
||||
templateId: "",
|
||||
outputDir: "",
|
||||
outputDir: process.env.YUQEI_TEMPLATE_SWEEP_OUTPUT_DIR || "",
|
||||
screenshots: "all",
|
||||
browserExecutable: "",
|
||||
email: process.env.YUQEI_TEST_EMAIL || "",
|
||||
@@ -93,7 +91,7 @@ Options:
|
||||
--expected-count <n> Expected selected template count. Default: 60
|
||||
--selection <mode> draftable | published. Default: draftable
|
||||
--template-id <id> Restrict the sweep to one template while retaining the full catalog UI assertion.
|
||||
--output-dir <path> Artifact directory. Default: output/playwright/template-draft-sweep/<timestamp>
|
||||
--output-dir <path> Required external artifact directory (or set YUQEI_TEMPLATE_SWEEP_OUTPUT_DIR).
|
||||
--screenshots <mode> all | failures | none. Default: all
|
||||
--browser-executable <path> Use an installed Chromium browser instead of Playwright's bundled browser.
|
||||
YUQEI_TEST_EMAIL/PASSWORD Optional authenticated test account; both environment variables are required together.
|
||||
@@ -102,20 +100,15 @@ Options:
|
||||
`);
|
||||
}
|
||||
|
||||
function nowStamp() {
|
||||
const value = new Date().toISOString().replace(/[:.]/g, "-");
|
||||
return value.replace("Z", "");
|
||||
}
|
||||
|
||||
function normalizeBaseUrl(value) {
|
||||
return value.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
function resolveOutputDir(value) {
|
||||
if (value) {
|
||||
return path.isAbsolute(value) ? value : path.resolve(REPO_ROOT, value);
|
||||
if (!value) {
|
||||
throw new Error("--output-dir or YUQEI_TEMPLATE_SWEEP_OUTPUT_DIR is required; store raw sweep evidence outside the source worktree.");
|
||||
}
|
||||
return path.resolve(REPO_ROOT, "output", "playwright", "template-draft-sweep", nowStamp());
|
||||
return path.isAbsolute(value) ? value : path.resolve(value);
|
||||
}
|
||||
|
||||
async function fetchJson(url) {
|
||||
|
||||
Reference in New Issue
Block a user