Keep approved Dock and add row feedback with stable themed scrollbars
This commit is contained in:
1 parent
c41a5e4276
commit
645afe3ebf
101 files changed
+580
-1348
No files matched your search
@@ -0,0 +1,183 @@
|
||||
import { chromium } from "playwright";
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
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 page = await browser.newPage({ viewport: { width: 1440, height: 700 } }),
|
||||
errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
let passed = 0;
|
||||
await mkdir("references/approved-dock", { recursive: true });
|
||||
const frame = (p, theme) =>
|
||||
`${base}/playground/frame.html?concept=dock&page=${p}&theme=${theme}&density=compact`;
|
||||
try {
|
||||
await page.goto(base + "/playground/");
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
assert.equal(
|
||||
await page
|
||||
.locator("#concepts,#compare,#second,#preview-b,.version")
|
||||
.count(),
|
||||
0,
|
||||
);
|
||||
assert.equal(
|
||||
/EXPLORATIONS|Relay|Ledger|Signal|Axis|Grid|Шесть точек|не выбрана/.test(
|
||||
await page.locator("body").innerText(),
|
||||
),
|
||||
false,
|
||||
);
|
||||
passed++;
|
||||
// A preference saved before approval must not restore an abandoned concept.
|
||||
await page.evaluate(() =>
|
||||
localStorage.setItem(
|
||||
"anidev.lab",
|
||||
JSON.stringify({
|
||||
concept: "ledger",
|
||||
second: "signal",
|
||||
compare: true,
|
||||
theme: "light",
|
||||
page: "users",
|
||||
locale: "ru",
|
||||
}),
|
||||
),
|
||||
);
|
||||
await page.reload();
|
||||
await page.frameLocator("#preview-a").locator("#user-search").waitFor();
|
||||
assert.equal(
|
||||
await page
|
||||
.frameLocator("#preview-a")
|
||||
.locator("body")
|
||||
.getAttribute("data-concept"),
|
||||
"dock",
|
||||
);
|
||||
passed++;
|
||||
for (const theme of ["light", "dark"]) {
|
||||
for (const [p, selector] of [
|
||||
["users", "tbody tr"],
|
||||
["dashboard", ".service"],
|
||||
["dashboard", ".activity-row"],
|
||||
["security", ".identity-setting-row"],
|
||||
["sessions", ".identity-session"],
|
||||
["applications", ".identity-app"],
|
||||
["tokens", ".token-row"],
|
||||
]) {
|
||||
await page.goto(frame(p, theme));
|
||||
await page.locator(selector).first().waitFor();
|
||||
await page.waitForTimeout(450);
|
||||
const row = page.locator(selector).first();
|
||||
await page.mouse.move(1430, 690);
|
||||
const rest = await row.evaluate(
|
||||
(el) => getComputedStyle(el).backgroundColor,
|
||||
);
|
||||
await row.hover();
|
||||
await page.waitForTimeout(180);
|
||||
const hover = await row.evaluate(
|
||||
(el) => getComputedStyle(el).backgroundColor,
|
||||
);
|
||||
assert.notEqual(
|
||||
hover,
|
||||
rest,
|
||||
`${theme}/${p}/${selector} hover; actual hover=${await row.evaluate((el) => el.matches(":hover"))}`,
|
||||
);
|
||||
assert.notEqual(hover, "rgba(0, 0, 0, 0)");
|
||||
passed++;
|
||||
if (p === "users") {
|
||||
await page.screenshot({
|
||||
path: `references/approved-dock/rows-${theme}-desktop.png`,
|
||||
});
|
||||
await row.locator("[data-edit]").focus();
|
||||
assert.equal(
|
||||
await row.evaluate((el) => getComputedStyle(el).backgroundColor),
|
||||
hover,
|
||||
);
|
||||
passed++;
|
||||
}
|
||||
}
|
||||
await page.goto(frame("profile", theme));
|
||||
await page.locator("#identity-profile").waitFor();
|
||||
await page.waitForTimeout(450);
|
||||
await page.evaluate(() => scrollTo(0, 160));
|
||||
const before = await page.locator(".main-column").boundingBox(),
|
||||
scroll = await page.evaluate(() => scrollY);
|
||||
assert.match(
|
||||
await page
|
||||
.locator("html")
|
||||
.evaluate((el) => getComputedStyle(el).scrollbarGutter),
|
||||
/stable/,
|
||||
);
|
||||
assert.notEqual(
|
||||
await page
|
||||
.locator("html")
|
||||
.evaluate((el) => getComputedStyle(el).scrollbarColor),
|
||||
"auto",
|
||||
);
|
||||
await page.locator(".dock-brand").hover();
|
||||
await page.waitForTimeout(300);
|
||||
const open = await page.locator(".main-column").boundingBox();
|
||||
assert.equal(open.x, before.x);
|
||||
assert.equal(open.width, before.width);
|
||||
assert.equal(await page.evaluate(() => scrollY), scroll);
|
||||
await page.keyboard.press("Escape");
|
||||
await page.mouse.move(1430, 690);
|
||||
await page.waitForTimeout(300);
|
||||
const closed = await page.locator(".main-column").boundingBox();
|
||||
assert.equal(closed.x, before.x);
|
||||
assert.equal(closed.width, before.width);
|
||||
passed++;
|
||||
// Native modal / scroll locking must not move the shell either.
|
||||
await page.goto(frame("users", theme));
|
||||
await page.locator("#user-search").waitFor();
|
||||
const baseBox = await page.locator(".main-column").boundingBox();
|
||||
await page.locator("[data-edit]").first().click();
|
||||
await page.waitForTimeout(300);
|
||||
const modalBox = await page.locator(".main-column").boundingBox();
|
||||
assert.equal(baseBox.x, modalBox.x);
|
||||
assert.equal(baseBox.width, modalBox.width);
|
||||
await page.keyboard.press("Escape");
|
||||
passed++;
|
||||
}
|
||||
await page.goto(frame("profile", "light"));
|
||||
await page.locator("#identity-profile").waitFor();
|
||||
const long = await page.locator(".main-column").boundingBox();
|
||||
await page.locator(".nav-links [data-page=applications]").click();
|
||||
await page.locator(".identity-app").first().waitFor();
|
||||
const short = await page.locator(".main-column").boundingBox();
|
||||
assert.equal(long.width, short.width);
|
||||
assert.equal(long.x, short.x);
|
||||
passed++;
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto(base + "/playground/");
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
assert.ok(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth <= innerWidth,
|
||||
),
|
||||
);
|
||||
await page.screenshot({
|
||||
path: "references/approved-dock/gallery-mobile.png",
|
||||
fullPage: true,
|
||||
});
|
||||
passed++;
|
||||
assert.deepEqual(errors, []);
|
||||
await writeFile(
|
||||
"references/approved-dock/qa.json",
|
||||
JSON.stringify(
|
||||
{
|
||||
passed,
|
||||
failed: 0,
|
||||
errors,
|
||||
checks:
|
||||
"Dock-only migration; hover/focus rows; stable geometry across nav and dialog open/close and long/short pages; themed native scrollbars; mobile",
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
console.log(`Approved Dock: ${passed} passed`);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
+34
-35
@@ -32,8 +32,13 @@ try {
|
||||
await check("HTTP root and gallery", async () => {
|
||||
const r = await page.goto(base);
|
||||
assert.equal(r.status(), 200);
|
||||
await page.locator("#concepts button").first().waitFor();
|
||||
assert.equal(await page.locator("#concepts button").count(), 6);
|
||||
assert.equal(await page.locator("#concepts, #compare, #second").count(), 0);
|
||||
assert.equal(
|
||||
/EXPLORATIONS|Six perspectives|Шесть точек/.test(
|
||||
await page.locator("body").innerText(),
|
||||
),
|
||||
false,
|
||||
);
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
await page.screenshot({ path: "references/gallery.png", fullPage: true });
|
||||
});
|
||||
@@ -94,7 +99,7 @@ try {
|
||||
await check(
|
||||
"User search, filter, pagination, sorting, empty state",
|
||||
async () => {
|
||||
await page.goto(url("relay", "users"));
|
||||
await page.goto(url("dock", "users"));
|
||||
await page.locator("#user-search").fill("anna");
|
||||
assert.equal(await page.locator("tbody tr").count(), 1);
|
||||
await page.locator("#user-search").fill("no-such-person");
|
||||
@@ -136,7 +141,7 @@ try {
|
||||
await page.locator("[data-action=reset-users]").click();
|
||||
});
|
||||
await check("Settings persistence and keyboard tabs", async () => {
|
||||
await page.goto(url("grid", "settings"));
|
||||
await page.goto(url("dock", "settings"));
|
||||
await page.locator("input[name=name]").fill("Anidev Test");
|
||||
await page.locator("#settings-form button[type=submit]").click();
|
||||
await page.reload();
|
||||
@@ -157,7 +162,7 @@ try {
|
||||
assert.equal(await page.locator("#mfa").isChecked(), false);
|
||||
});
|
||||
await check("Auth native validation and demo sign in", async () => {
|
||||
await page.goto(url("axis", "auth"));
|
||||
await page.goto(url("dock", "auth"));
|
||||
await page.locator("input[name=email]").fill("test@example.com");
|
||||
await page.locator("input[name=password]").fill("short");
|
||||
await page.locator("#auth-form button[type=submit]").click();
|
||||
@@ -235,33 +240,27 @@ try {
|
||||
);
|
||||
}
|
||||
});
|
||||
await check(
|
||||
"Gallery controls, comparison and actual mobile viewport",
|
||||
async () => {
|
||||
await page.goto(base);
|
||||
await page.locator("[data-concept=ledger]").click();
|
||||
await page.locator("#theme").selectOption("dark");
|
||||
await page.locator("#density").selectOption("compact");
|
||||
await page.locator("#page").selectOption("users");
|
||||
await page.locator("[data-size=mobile]").click();
|
||||
await page.locator("#compare").check();
|
||||
await page.locator("#second").selectOption("signal");
|
||||
await page.frameLocator("#preview-b").locator("#user-search").waitFor();
|
||||
assert.equal(
|
||||
await page
|
||||
.frameLocator("#preview-a")
|
||||
.locator("body")
|
||||
.getAttribute("data-concept"),
|
||||
"ledger",
|
||||
);
|
||||
assert.ok(
|
||||
await page.locator("#preview-a").evaluate((e) => e.clientWidth <= 390),
|
||||
);
|
||||
await page.locator("#accent").fill("#ffcc00");
|
||||
await page.locator("#accent").dispatchEvent("change");
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
},
|
||||
);
|
||||
await check("Approved Dock controls and actual mobile viewport", async () => {
|
||||
await page.goto(base);
|
||||
await page.locator("#theme").selectOption("dark");
|
||||
await page.locator("#density").selectOption("compact");
|
||||
await page.locator("#page").selectOption("users");
|
||||
await page.locator("[data-size=mobile]").click();
|
||||
await page.frameLocator("#preview-a").locator("#user-search").waitFor();
|
||||
assert.equal(
|
||||
await page
|
||||
.frameLocator("#preview-a")
|
||||
.locator("body")
|
||||
.getAttribute("data-concept"),
|
||||
"dock",
|
||||
);
|
||||
assert.ok(
|
||||
await page.locator("#preview-a").evaluate((e) => e.clientWidth <= 390),
|
||||
);
|
||||
await page.locator("#accent").fill("#ffcc00");
|
||||
await page.locator("#accent").dispatchEvent("change");
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
});
|
||||
await check("Mobile navigation and density variants", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
for (const c of concepts) {
|
||||
@@ -287,19 +286,19 @@ try {
|
||||
}
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await page.goto(base);
|
||||
await page.locator("[data-concept=ledger]").click();
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
});
|
||||
await check("Export archive download", async () => {
|
||||
const download = page.waitForEvent("download");
|
||||
await page.locator("#export").click();
|
||||
const d = await download;
|
||||
await d.saveAs("test-results/anidev-export.zip");
|
||||
assert.match(d.suggestedFilename(), /anidev-ledger.zip/);
|
||||
assert.match(d.suggestedFilename(), /anidev-dock.zip/);
|
||||
});
|
||||
await check("Gallery mobile overflow", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto(base);
|
||||
await page.locator("#concepts button").first().waitFor();
|
||||
await page.frameLocator("#preview-a").locator("h1").waitFor();
|
||||
assert.ok(
|
||||
await page.evaluate(
|
||||
() => document.documentElement.scrollWidth <= innerWidth + 1,
|
||||
|
||||
+4
-2
@@ -322,10 +322,12 @@ try {
|
||||
await (await download).saveAs("test-results/identity-export.zip");
|
||||
});
|
||||
await check(
|
||||
"Identity change in comparison clears an open private dialog",
|
||||
"Identity change across frames clears an open private dialog",
|
||||
async () => {
|
||||
await p.goto(base + "/playground/?concept=dock&page=security");
|
||||
await p.locator("#compare").check();
|
||||
await p.setContent(
|
||||
`<iframe id="preview-a" style="width:48%;height:760px" src="${base}/playground/frame.html?concept=dock&page=security"></iframe><iframe id="preview-b" style="width:48%;height:760px" src="${base}/playground/frame.html?concept=dock&page=security"></iframe>`,
|
||||
);
|
||||
const first = p.frameLocator("#preview-a"),
|
||||
second = p.frameLocator("#preview-b");
|
||||
await second.locator("h1").waitFor();
|
||||
|
||||
Reference in new issue
Block a user