Polish approved 1.0 scope and verify portable previews
This commit is contained in:
1 parent
1819f35f91
commit
2b45df2816
181 files changed
+996
-139
No files matched your search
@@ -0,0 +1,259 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { chromium } from "playwright";
|
||||
const base = process.env.BASE_URL || "http://127.0.0.1:4173";
|
||||
const browser = await chromium.launch({
|
||||
executablePath:
|
||||
process.env.PLAYWRIGHT_EXECUTABLE_PATH ||
|
||||
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
||||
headless: true,
|
||||
});
|
||||
const context = await browser.newContext({ acceptDownloads: true });
|
||||
const page = await context.newPage();
|
||||
page.setDefaultTimeout(8000);
|
||||
const errors = [];
|
||||
let passed = 0;
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await mkdir("test-results/content", { recursive: true });
|
||||
try {
|
||||
for (const theme of ["light", "dark"])
|
||||
for (const locale of ["ru", "en"])
|
||||
for (const width of [1440, 768, 390]) {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
await page.goto(
|
||||
`${base}/?page=statistics&panel=admin&theme=${theme}&locale=${locale}`,
|
||||
);
|
||||
await page.locator(".statistics-panel").last().waitFor();
|
||||
assert.equal(await page.locator(".statistics-panel").count(), 8);
|
||||
const layout = await page
|
||||
.locator(".statistics-panel")
|
||||
.evaluateAll((nodes) =>
|
||||
nodes.map((node) => {
|
||||
const plot = node.querySelector(".chart-plot"),
|
||||
rect = plot.getBoundingClientRect(),
|
||||
data = node
|
||||
.querySelector(".chart-data")
|
||||
.getBoundingClientRect();
|
||||
return {
|
||||
height: rect.height,
|
||||
bottom: rect.bottom,
|
||||
dataTop: data.top,
|
||||
colors: [...node.querySelectorAll(".chart-line")].map(
|
||||
(n) => getComputedStyle(n).stroke,
|
||||
),
|
||||
};
|
||||
}),
|
||||
);
|
||||
assert.ok(
|
||||
layout.every(
|
||||
(x) => Math.abs(x.height - 180) < 1 && x.dataTop >= x.bottom,
|
||||
),
|
||||
JSON.stringify(layout),
|
||||
);
|
||||
assert.notEqual(layout[2].colors[0], layout[2].colors[1]);
|
||||
assert.equal(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth > innerWidth,
|
||||
),
|
||||
false,
|
||||
);
|
||||
const chart = page.locator('[data-stat-chart="network"]');
|
||||
await chart
|
||||
.locator(".chart-plot")
|
||||
.hover({ position: { x: 70, y: 80 } });
|
||||
assert.equal(await chart.locator(".chart-tooltip").isVisible(), true);
|
||||
await chart.locator(".chart-plot").focus();
|
||||
await page.keyboard.press("End");
|
||||
assert.ok(
|
||||
(await chart.locator(".chart-tooltip").innerText()).includes(
|
||||
locale === "ru" ? "Исходящий" : "Outbound",
|
||||
),
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
assert.equal(await chart.locator(".chart-tooltip").isVisible(), false);
|
||||
await chart.locator("summary").click();
|
||||
assert.equal(await chart.locator("tbody tr").count(), 24);
|
||||
await chart.locator("summary").click();
|
||||
await page.locator("[data-statistics-range]").selectOption("24h");
|
||||
assert.equal(
|
||||
await page.locator("[data-statistics-range]").inputValue(),
|
||||
"24h",
|
||||
);
|
||||
await page.evaluate(() => {
|
||||
document.activeElement?.blur();
|
||||
scrollTo(0, 0);
|
||||
});
|
||||
await page.mouse.move(width - 2, 2);
|
||||
if (locale === "ru")
|
||||
await page.screenshot({
|
||||
path: `test-results/content/statistics-${theme}-${width}.png`,
|
||||
fullPage: true,
|
||||
});
|
||||
passed++;
|
||||
}
|
||||
for (const theme of ["light", "dark"])
|
||||
for (const width of [1440, 768, 390]) {
|
||||
await page.setViewportSize({ width, height: 844 });
|
||||
await page.goto(
|
||||
`${base}/?page=documents&path=/server-guide.md&theme=${theme}`,
|
||||
);
|
||||
await page.locator(".markdown-body table").waitFor();
|
||||
assert.equal(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth > innerWidth,
|
||||
),
|
||||
false,
|
||||
`Markdown overflow ${theme}/${width}`,
|
||||
);
|
||||
await page.screenshot({
|
||||
path: `test-results/content/markdown-${theme}-${width}.png`,
|
||||
fullPage: true,
|
||||
});
|
||||
passed++;
|
||||
}
|
||||
await page.setViewportSize({ width: 1440, height: 950 });
|
||||
await page.goto(
|
||||
base + "/?page=documents&path=/some/fee/foo/README.md&theme=dark",
|
||||
);
|
||||
await page.locator(".markdown-body h1").waitFor();
|
||||
assert.ok(await page.locator(".code-editor-gutter").innerText());
|
||||
await page
|
||||
.locator(".code-editor textarea")
|
||||
.fill('# Новый заголовок\n\n```json\n{"port":8080}\n```');
|
||||
await page
|
||||
.locator(".markdown-body h1")
|
||||
.filter({ hasText: "Новый заголовок" })
|
||||
.waitFor();
|
||||
await page.locator(".markdown-body .hljs-attr").waitFor();
|
||||
const before = await page.locator(".code-editor textarea").inputValue();
|
||||
await page.locator(".code-editor textarea").press("Control+End");
|
||||
await page.keyboard.press("Enter");
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.insertText("abc");
|
||||
assert.ok(
|
||||
(await page.locator(".code-editor textarea").inputValue()).endsWith(
|
||||
"\n abc",
|
||||
),
|
||||
);
|
||||
await page.keyboard.press("Control+z");
|
||||
const download = page.waitForEvent("download");
|
||||
await page.locator("[data-document-download]").click();
|
||||
await download;
|
||||
await page.locator(".breadcrumbs a").filter({ hasText: /^fee$/ }).click();
|
||||
assert.equal(new URL(page.url()).searchParams.get("path"), "/some/fee");
|
||||
await page.goBack();
|
||||
await page
|
||||
.locator(".markdown-body h1")
|
||||
.filter({ hasText: "Новый заголовок" })
|
||||
.waitFor();
|
||||
await page.screenshot({
|
||||
path: "test-results/content/documents-dark.png",
|
||||
fullPage: true,
|
||||
});
|
||||
passed++;
|
||||
await page.evaluate(async () => {
|
||||
const {
|
||||
mountMarkdown,
|
||||
mountChart,
|
||||
mountMiniLog,
|
||||
mountStatistics,
|
||||
statisticsMarkup,
|
||||
mountCodeEditor,
|
||||
} = await import("/runtime/index.js");
|
||||
const fixture = document.createElement("section");
|
||||
fixture.id = "content-fixture";
|
||||
fixture.style = "position:relative;margin:30px 120px;width:500px;";
|
||||
document.body.append(fixture);
|
||||
const markdown = document.createElement("div");
|
||||
fixture.append(markdown);
|
||||
window.__unsafe = 0;
|
||||
const md = mountMarkdown(markdown, {
|
||||
source:
|
||||
'# Safe\n\n<script>window.__unsafe=1</script><img src=x onerror="window.__unsafe=2"><a href="javascript:alert(1)">bad</a><iframe src="about:blank"></iframe>\n\n- [x] done',
|
||||
});
|
||||
await md.ready;
|
||||
if (
|
||||
markdown.querySelector(
|
||||
'script,iframe,[onerror],a[href^="javascript:"]',
|
||||
) ||
|
||||
window.__unsafe
|
||||
)
|
||||
throw Error("Unsafe Markdown");
|
||||
if (!markdown.querySelector("input[disabled]"))
|
||||
throw Error("Task is editable");
|
||||
await md.setSource("## Replacement");
|
||||
if (!markdown.querySelector("h2")) throw Error("Markdown update");
|
||||
md.dispose();
|
||||
const el = document.createElement("div");
|
||||
fixture.append(el);
|
||||
const c = mountChart(el, {
|
||||
type: "bar",
|
||||
title: "Zero",
|
||||
unit: "%",
|
||||
labels: ["a", "b"],
|
||||
series: [{ name: "CPU", values: [0, 0] }],
|
||||
});
|
||||
if (
|
||||
[...el.querySelectorAll(".chart-bar")].some(
|
||||
(n) => Number(n.getAttribute("height")) !== 0,
|
||||
)
|
||||
)
|
||||
throw Error("Zero bar drawn");
|
||||
c.update({ series: [{ name: "CPU", values: [50, 100] }] });
|
||||
if (!el.querySelector(".chart-scale").textContent.includes("100"))
|
||||
throw Error("Stale chart scale");
|
||||
c.update({ series: [] });
|
||||
if (!el.querySelector(".chart-empty")) throw Error("Empty chart");
|
||||
c.update({
|
||||
type: "line",
|
||||
series: [{ name: "CPU", values: [10, null, 20] }],
|
||||
});
|
||||
if (el.querySelectorAll("circle.chart-bar").length !== 2)
|
||||
throw Error("Isolated points missing");
|
||||
c.dispose();
|
||||
el.querySelector(".chart-plot").dispatchEvent(
|
||||
new KeyboardEvent("keydown", { key: "End", bubbles: true }),
|
||||
);
|
||||
if (!el.querySelector(".chart-tooltip").hidden)
|
||||
throw Error("Chart not disposed");
|
||||
const logs = document.createElement("div");
|
||||
fixture.append(logs);
|
||||
const l = mountMiniLog(logs, {
|
||||
entries: [{ level: "WARN", message: "<script>unsafe</script>" }],
|
||||
limit: 2,
|
||||
});
|
||||
l.append({ level: "ERROR", message: "Failure" });
|
||||
l.append({ level: "INFO", message: "Recovered" });
|
||||
if (
|
||||
logs.querySelectorAll(".mini-log-line").length !== 2 ||
|
||||
logs.querySelector("script")
|
||||
)
|
||||
throw Error("Mini-log limit/text");
|
||||
l.dispose();
|
||||
const stats = document.createElement("section");
|
||||
fixture.append(stats);
|
||||
stats.innerHTML = statisticsMarkup();
|
||||
const st = mountStatistics(stats.querySelector(".server-statistics"), {
|
||||
data: null,
|
||||
});
|
||||
st.update({ labels: ["a"], cpu: [10], memory: [2] });
|
||||
if (stats.querySelectorAll(".statistics-panel .chart-plot").length < 2)
|
||||
throw Error("Stats empty recovery");
|
||||
st.dispose();
|
||||
const edit = document.createElement("div");
|
||||
fixture.append(edit);
|
||||
const editor = mountCodeEditor(edit, { value: "readonly", readOnly: true });
|
||||
if (!edit.querySelector("textarea").readOnly) throw Error("Readonly");
|
||||
editor.dispose();
|
||||
fixture.remove();
|
||||
});
|
||||
passed++;
|
||||
assert.deepEqual(errors, []);
|
||||
await writeFile(
|
||||
"test-results/content/qa.json",
|
||||
JSON.stringify({ passed, errors }, null, 2),
|
||||
);
|
||||
console.log(`Content workspaces: ${passed} checks passed, no runtime errors`);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
+13
-4
@@ -31,14 +31,18 @@ try {
|
||||
assert.ok(
|
||||
await p
|
||||
.locator(".navigation")
|
||||
.evaluate((el) => el.getBoundingClientRect().width <= 68),
|
||||
.evaluate((el) =>
|
||||
matchMedia("(max-width:600px)").matches
|
||||
? el.getBoundingClientRect().bottom >= innerHeight - 25
|
||||
: el.getBoundingClientRect().width <= 68,
|
||||
),
|
||||
);
|
||||
assert.equal(
|
||||
await p
|
||||
.locator(".nav-links button>span")
|
||||
.first()
|
||||
.evaluate((el) => getComputedStyle(el).opacity),
|
||||
"0",
|
||||
width <= 600 ? "1" : "0",
|
||||
);
|
||||
const before = await p.locator(".main-column").boundingBox();
|
||||
await p.screenshot({
|
||||
@@ -124,6 +128,7 @@ try {
|
||||
"false",
|
||||
);
|
||||
passed++;
|
||||
await p.setViewportSize({ width: 1440, height: 900 });
|
||||
await p.goto(`${base}/playground/frame.html?concept=dock&page=identity`);
|
||||
await p.locator("[data-identity=reset]").click();
|
||||
await p.goto(`${base}/playground/frame.html?concept=dock`);
|
||||
@@ -131,10 +136,14 @@ try {
|
||||
assert.equal(
|
||||
await p
|
||||
.locator(".navigation")
|
||||
.evaluate((el) => el.firstElementChild.classList.contains("dock-brand")),
|
||||
.evaluate((el) =>
|
||||
[...el.children]
|
||||
.find((node) => node.getBoundingClientRect().width > 0)
|
||||
?.classList.contains("dock-brand"),
|
||||
),
|
||||
true,
|
||||
);
|
||||
assert.equal(await p.locator(".dock-brand svg").count(), 0);
|
||||
assert.equal(await p.locator(".dock-brand > svg").count(), 0);
|
||||
await p.locator(".dock-toggle").hover();
|
||||
await p.waitForTimeout(300);
|
||||
assert.equal(
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import http from "node:http";
|
||||
import path from "node:path";
|
||||
import { chromium } from "playwright";
|
||||
const base = process.env.BASE_URL || "http://127.0.0.1:4173";
|
||||
await mkdir("test-results", { recursive: true });
|
||||
const root = await mkdtemp(path.resolve("test-results/export-consumer-"));
|
||||
const zip = path.join(root, "snapshot.zip");
|
||||
const browser = await chromium.launch({
|
||||
executablePath:
|
||||
process.env.PLAYWRIGHT_EXECUTABLE_PATH ||
|
||||
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
||||
headless: true,
|
||||
});
|
||||
let server,
|
||||
passed = 0;
|
||||
try {
|
||||
const page = await browser.newPage({ acceptDownloads: true });
|
||||
await page.goto(base + "/?page=tokens&theme=dark");
|
||||
const download = page.waitForEvent("download");
|
||||
await page.locator('[data-action="download-system"]').click();
|
||||
await (await download).saveAs(zip);
|
||||
const result = spawnSync(
|
||||
"python",
|
||||
[
|
||||
"-c",
|
||||
`import sys,zipfile,pathlib
|
||||
root=pathlib.Path(sys.argv[2]).resolve()
|
||||
with zipfile.ZipFile(sys.argv[1]) as archive:
|
||||
for name in archive.namelist():
|
||||
target=(root/name).resolve()
|
||||
if not target.is_relative_to(root): raise ValueError(name)
|
||||
archive.extractall(root)
|
||||
`,
|
||||
zip,
|
||||
root,
|
||||
],
|
||||
{ encoding: "utf8", windowsHide: true },
|
||||
);
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
const mime = {
|
||||
".html": "text/html",
|
||||
".js": "text/javascript",
|
||||
".css": "text/css",
|
||||
".json": "application/json",
|
||||
".svg": "image/svg+xml",
|
||||
};
|
||||
server = http.createServer(async (req, res) => {
|
||||
try {
|
||||
const url = new URL(req.url, "http://localhost"),
|
||||
name = decodeURIComponent(url.pathname);
|
||||
const file = path.resolve(
|
||||
root,
|
||||
"." + (name.endsWith("/") ? name + "index.html" : name),
|
||||
);
|
||||
if (!file.startsWith(root + path.sep)) throw Error();
|
||||
const body = await readFile(file);
|
||||
res.writeHead(200, {
|
||||
"Content-Type": mime[path.extname(file)] || "application/octet-stream",
|
||||
"Cache-Control": "no-store",
|
||||
});
|
||||
res.end(body);
|
||||
} catch {
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
}
|
||||
});
|
||||
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
||||
const origin = `http://127.0.0.1:${server.address().port}`,
|
||||
errors = [],
|
||||
failures = [],
|
||||
external = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
page.on("response", (r) => {
|
||||
if (r.status() >= 400 && !r.url().endsWith("/favicon.ico"))
|
||||
failures.push(`${r.status()} ${r.url()}`);
|
||||
});
|
||||
page.on("request", (r) => {
|
||||
if (!r.url().startsWith(origin + "/") && !r.url().startsWith("blob:"))
|
||||
external.push(r.url());
|
||||
});
|
||||
for (const route of [
|
||||
"/?page=statistics&panel=admin",
|
||||
"/?page=documents&path=/server-guide.md",
|
||||
"/icons/",
|
||||
]) {
|
||||
await page.goto(origin + route);
|
||||
await page
|
||||
.locator(
|
||||
route.includes("statistics")
|
||||
? ".statistics-panel .chart-plot"
|
||||
: route.includes("documents")
|
||||
? ".markdown-body h1"
|
||||
: ".icon-tile",
|
||||
)
|
||||
.first()
|
||||
.waitFor();
|
||||
passed++;
|
||||
}
|
||||
assert.equal(await page.locator(".icon-tile").count(), 76);
|
||||
assert.deepEqual(errors, []);
|
||||
assert.deepEqual(failures, []);
|
||||
assert.deepEqual(external, []);
|
||||
await writeFile(
|
||||
"test-results/export-qa.json",
|
||||
JSON.stringify({ passed, errors, failures, external }, null, 2),
|
||||
);
|
||||
console.log(
|
||||
`Gallery export: ${passed} isolated ZIP routes passed; no missing or external resources`,
|
||||
);
|
||||
} finally {
|
||||
await browser.close();
|
||||
if (server) await new Promise((resolve) => server.close(resolve));
|
||||
}
|
||||
+30
-2
@@ -16,8 +16,10 @@ p.on("pageerror", (e) => errors.push(e.message));
|
||||
let passed = 0;
|
||||
await mkdir("references/icons", { recursive: true });
|
||||
try {
|
||||
assert.equal(iconNames.length, 64);
|
||||
assert.equal(new Set(iconNames).size, 64);
|
||||
assert.equal(iconNames.length, 76);
|
||||
for (const name of ["key-control", "key-alt", "windows", "linux"])
|
||||
assert.ok(icons[name]);
|
||||
assert.equal(new Set(iconNames).size, iconNames.length);
|
||||
await p.goto(base + "/icons/");
|
||||
await p.locator(".icon-tile").last().waitFor();
|
||||
const bounds = await p.locator(".icon-tile svg").evaluateAll((es) =>
|
||||
@@ -93,6 +95,27 @@ try {
|
||||
for (const locale of ["ru", "en"]) {
|
||||
await p.setViewportSize({ width, height: 900 });
|
||||
await p.goto(`${base}/?page=security&theme=${theme}&locale=${locale}`);
|
||||
if (width <= 600) {
|
||||
const controls = p.locator(
|
||||
".mobile-recent,.dock-brand,.dock-account",
|
||||
);
|
||||
for (const node of await controls.all()) {
|
||||
if (!(await node.isVisible())) continue;
|
||||
const rect = await node.boundingBox(),
|
||||
glyph = await node.locator("svg,.avatar").first().boundingBox();
|
||||
assert.ok(
|
||||
Math.abs(glyph.x + glyph.width / 2 - (rect.x + rect.width / 2)) <
|
||||
1,
|
||||
);
|
||||
assert.ok(
|
||||
Math.abs(
|
||||
glyph.y + glyph.height / 2 - (rect.y + rect.height / 2),
|
||||
) < 1,
|
||||
);
|
||||
}
|
||||
passed++;
|
||||
continue;
|
||||
}
|
||||
await p.locator(".nav-icon").first().waitFor();
|
||||
const nav = await p.locator(".navigation").boundingBox();
|
||||
for (const button of await p
|
||||
@@ -140,6 +163,11 @@ try {
|
||||
await p.setViewportSize({ width: 960, height: 1140 });
|
||||
for (const theme of ["light", "dark"]) {
|
||||
await p.goto(`${base}/icons/preview-${theme}.svg`);
|
||||
const height = await p
|
||||
.locator("svg")
|
||||
.first()
|
||||
.evaluate((n) => n.height.baseVal.value);
|
||||
await p.setViewportSize({ width: 960, height: Math.ceil(height) });
|
||||
await p.screenshot({ path: `references/icons/preview-${theme}.png` });
|
||||
}
|
||||
// Full design export must include the icon module and a valid binary icon ZIP.
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { chromium } from "playwright";
|
||||
const base = process.env.BASE_URL || "http://127.0.0.1:4173";
|
||||
const browser = await chromium.launch({
|
||||
executablePath:
|
||||
process.env.PLAYWRIGHT_EXECUTABLE_PATH ||
|
||||
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
||||
headless: true,
|
||||
});
|
||||
let passed = 0;
|
||||
try {
|
||||
for (const viewport of [
|
||||
{ width: 390, height: 844 },
|
||||
{ width: 844, height: 390 },
|
||||
])
|
||||
for (const theme of ["light", "dark"]) {
|
||||
const context = await browser.newContext({
|
||||
viewport,
|
||||
hasTouch: true,
|
||||
isMobile: true,
|
||||
});
|
||||
const page = await context.newPage();
|
||||
await page.goto(`${base}/?page=dashboard&panel=admin&theme=${theme}`);
|
||||
const nav = page.locator(".navigation");
|
||||
const box = await nav.boundingBox();
|
||||
assert.ok(
|
||||
box.y > viewport.height - 100 && box.width > viewport.width - 40,
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator(".mobile-recent-current").isVisible(),
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator(".mobile-recent-previous").isDisabled(),
|
||||
true,
|
||||
);
|
||||
await page.locator(".dock-brand").tap();
|
||||
await page.locator('.nav-links [data-page="documents"]').tap();
|
||||
assert.equal(
|
||||
await page
|
||||
.locator("body")
|
||||
.evaluate((n) => n.classList.contains("dock-open")),
|
||||
false,
|
||||
);
|
||||
assert.equal(new URL(page.url()).searchParams.get("page"), "documents");
|
||||
assert.equal(
|
||||
await page.locator(".mobile-recent-previous").isEnabled(),
|
||||
true,
|
||||
);
|
||||
await page.locator(".mobile-recent-previous").tap();
|
||||
assert.equal(new URL(page.url()).searchParams.get("page"), "dashboard");
|
||||
await page.locator(".mobile-recent-previous").tap();
|
||||
assert.equal(new URL(page.url()).searchParams.get("page"), "documents");
|
||||
await page.locator(".dock-account").tap();
|
||||
await page.locator(".account-submenu-toggle").tap();
|
||||
await page.locator(".account-submenu:popover-open").waitFor();
|
||||
const sub = await page.locator(".account-submenu").boundingBox();
|
||||
assert.ok(
|
||||
sub.x >= 0 &&
|
||||
sub.x + sub.width <= viewport.width + 1 &&
|
||||
sub.y >= 0 &&
|
||||
sub.y + sub.height <= viewport.height + 1,
|
||||
);
|
||||
await page.locator('.account-submenu [data-page="security"]').tap();
|
||||
assert.equal(new URL(page.url()).searchParams.get("page"), "security");
|
||||
assert.equal(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth > innerWidth,
|
||||
),
|
||||
false,
|
||||
);
|
||||
await context.close();
|
||||
passed++;
|
||||
}
|
||||
console.log(`Mobile Dock: ${passed} touch/landscape/theme checks passed`);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
@@ -90,7 +90,7 @@ try {
|
||||
await p.waitForTimeout(220);
|
||||
assert.equal(await parent.getAttribute("aria-expanded"), "true");
|
||||
assert.equal(await submenu.evaluate((e) => e.inert), false);
|
||||
assert.equal(await submenu.locator("button").count(), 2);
|
||||
assert.equal(await submenu.locator("button").count(), 3);
|
||||
const textBounds = await parent
|
||||
.locator(".nav-group-label")
|
||||
.evaluate((e) => {
|
||||
@@ -110,7 +110,7 @@ try {
|
||||
await p.locator(".xterm-rows").waitFor();
|
||||
assert.equal(
|
||||
await p.locator(".dock-brand").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
assert.equal(
|
||||
await p.locator(".nav-group-toggle").getAttribute("data-active"),
|
||||
@@ -122,20 +122,22 @@ try {
|
||||
.getAttribute("aria-current"),
|
||||
"page",
|
||||
);
|
||||
if (width <= 600) await p.locator(".dock-brand").click();
|
||||
await p.locator("#administration-submenu [data-page=logs]").click();
|
||||
await p.locator(".log-row").first().waitFor();
|
||||
assert.equal(
|
||||
await p.locator(".dock-brand").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
assert.equal(
|
||||
await p.locator(".nav-group-toggle").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
if (locale === "ru")
|
||||
await p.locator(".navigation").screenshot({
|
||||
path: `references/navigation-feedback/submenu-${theme}-${width}.png`,
|
||||
});
|
||||
if (width <= 600) await p.locator(".dock-brand").click();
|
||||
await p.locator(".nav-group-toggle").focus();
|
||||
await p.keyboard.press("ArrowLeft");
|
||||
assert.equal(
|
||||
|
||||
+49
-1
@@ -226,7 +226,7 @@ try {
|
||||
await page.locator("#page-title").filter({ hasText: "Логи" }).waitFor();
|
||||
assert.equal(
|
||||
await page.locator(".dock-brand").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
await page.locator("[data-copy-input]").click();
|
||||
@@ -273,6 +273,13 @@ try {
|
||||
await page.screenshot({
|
||||
path: "references/integration/dynamic-menu-dark.png",
|
||||
});
|
||||
for (const id of ["statistics", "documents"]) {
|
||||
await page.keyboard.press("Tab");
|
||||
assert.equal(
|
||||
await page.evaluate(() => document.activeElement?.dataset.navId),
|
||||
id,
|
||||
);
|
||||
}
|
||||
await page.keyboard.press("Tab");
|
||||
assert.equal(
|
||||
await page
|
||||
@@ -294,6 +301,13 @@ try {
|
||||
.evaluate((e) => e === document.activeElement),
|
||||
true,
|
||||
);
|
||||
for (const id of ["documents", "statistics"]) {
|
||||
await page.keyboard.press("Shift+Tab");
|
||||
assert.equal(
|
||||
await page.evaluate(() => document.activeElement?.dataset.navId),
|
||||
id,
|
||||
);
|
||||
}
|
||||
await page.keyboard.press("Shift+Tab");
|
||||
assert.equal(
|
||||
await page.evaluate(() => document.activeElement?.dataset.navId),
|
||||
@@ -614,6 +628,40 @@ try {
|
||||
accountRoot.remove();
|
||||
});
|
||||
passed++;
|
||||
// The new content modules must work from the isolated copied starter too.
|
||||
account = { ...savedAccount, panel: "admin", status: "active" };
|
||||
config = structuredClone(original);
|
||||
for (const route of [
|
||||
"statistics&server=edge-01",
|
||||
"documents&path=/server-guide.md",
|
||||
]) {
|
||||
await page.goto(`${origin}/?page=${route}`);
|
||||
await page
|
||||
.locator(
|
||||
route.startsWith("statistics")
|
||||
? ".statistics-panel .chart-plot"
|
||||
: ".markdown-body h1",
|
||||
)
|
||||
.first()
|
||||
.waitFor();
|
||||
assert.equal(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth > innerWidth,
|
||||
),
|
||||
false,
|
||||
);
|
||||
if (route.startsWith("statistics")) {
|
||||
assert.equal(await page.locator(".statistics-panel").count(), 8);
|
||||
await page.locator("[data-statistics-range]").selectOption("15m");
|
||||
} else {
|
||||
await page.locator(".code-editor textarea").fill("# Portable Markdown");
|
||||
await page
|
||||
.locator(".markdown-body h1")
|
||||
.filter({ hasText: "Portable Markdown" })
|
||||
.waitFor();
|
||||
}
|
||||
passed++;
|
||||
}
|
||||
assert.ok(requests.every((url) => url.startsWith(origin + "/")));
|
||||
assert.ok(
|
||||
!requests.some((url) => /playground|demo-identity|frame\.js/.test(url)),
|
||||
|
||||
@@ -70,7 +70,7 @@ try {
|
||||
assert.equal(new URL(page.url()).searchParams.get("page"), "security");
|
||||
assert.equal(
|
||||
await page.locator(".dock-brand").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
await page.locator(".dock-account").click();
|
||||
|
||||
+4
-3
@@ -78,11 +78,11 @@ try {
|
||||
await p.locator("#user-search").waitFor();
|
||||
assert.equal(
|
||||
await p.locator(".dock-brand").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
assert.equal(
|
||||
await p.locator(".main-column").evaluate((el) => el.inert),
|
||||
true,
|
||||
width > 600,
|
||||
);
|
||||
const selectedItem = p.locator('.nav-links [aria-current="page"]');
|
||||
await p.mouse.move(width - 12, height - 12);
|
||||
@@ -90,6 +90,7 @@ try {
|
||||
const selectedColor = await selectedItem.evaluate(
|
||||
(el) => getComputedStyle(el).backgroundColor,
|
||||
);
|
||||
if (width <= 600) await p.locator(".dock-brand").click();
|
||||
await selectedItem.hover();
|
||||
await p.waitForTimeout(160);
|
||||
assert.equal(
|
||||
@@ -101,7 +102,7 @@ try {
|
||||
await selectedItem.click();
|
||||
assert.equal(
|
||||
await p.locator(".dock-brand").getAttribute("aria-expanded"),
|
||||
"true",
|
||||
width <= 600 ? "false" : "true",
|
||||
);
|
||||
assert.equal(new URL(p.url()).searchParams.get("page"), "users");
|
||||
assert.equal(
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, readFile, stat } from "node:fs/promises";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
const project = await mkdtemp(path.resolve("test-results/skill-consumer-"));
|
||||
const install = () =>
|
||||
spawnSync(
|
||||
process.execPath,
|
||||
["scripts/install-skill.mjs", "--project", project],
|
||||
{ encoding: "utf8", windowsHide: true },
|
||||
);
|
||||
const first = install();
|
||||
assert.equal(first.status, 0, first.stderr);
|
||||
const skill = path.join(project, ".agents/skills/anidev-design-system");
|
||||
await stat(path.join(skill, "SKILL.md"));
|
||||
const pkg = path.join(skill, "assets/anidev"),
|
||||
manifest = JSON.parse(
|
||||
await readFile(path.join(pkg, "manifest.json"), "utf8"),
|
||||
);
|
||||
for (const [file, hash] of Object.entries(manifest.files))
|
||||
assert.equal(
|
||||
createHash("sha256")
|
||||
.update(await readFile(path.join(pkg, file)))
|
||||
.digest("hex"),
|
||||
hash,
|
||||
file,
|
||||
);
|
||||
const api = await import(pathToFileURL(path.join(pkg, "runtime/index.js")));
|
||||
for (const name of [
|
||||
"mountMarkdown",
|
||||
"mountCodeEditor",
|
||||
"mountChart",
|
||||
"mountMiniLog",
|
||||
"mountMobileDock",
|
||||
])
|
||||
assert.equal(typeof api[name], "function");
|
||||
assert.equal(install().status, 1, "Must refuse an implicit overwrite");
|
||||
console.log(
|
||||
"Skill portability: temporary project install, bundled hashes/runtime and overwrite protection passed",
|
||||
);
|
||||
Reference in new issue
Block a user