34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
import { chromium } from "playwright";
|
|
import assert from "node:assert/strict";
|
|
const base = process.env.BASE_URL || "http://127.0.0.1:4173";
|
|
const b = await chromium.launch({
|
|
executablePath:
|
|
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
|
|
headless: true,
|
|
});
|
|
try {
|
|
const p = await b.newPage();
|
|
for (const theme of ["light", "dark"])
|
|
for (const [device, width, height] of [
|
|
["desktop", 1440, 900],
|
|
["mobile", 390, 844],
|
|
]) {
|
|
await p.setViewportSize({ width, height });
|
|
await p.goto(
|
|
`${base}/playground/frame.html?concept=dock&page=identity&theme=${theme}&identityState=factor_required`,
|
|
);
|
|
await p.locator("[data-identity=verify-factor]").click();
|
|
await p.waitForTimeout(300);
|
|
const before = await p.locator("#dialog").boundingBox();
|
|
await p.locator("#identity-factor input").fill("000000");
|
|
const after = await p.locator("#dialog").boundingBox();
|
|
assert.deepEqual(after, before);
|
|
await p.screenshot({
|
|
path: `references/identity/totp-error-${theme}-${device}.png`,
|
|
});
|
|
console.log(theme, device, "TOTP dialog geometry stable");
|
|
}
|
|
} finally {
|
|
await b.close();
|
|
}
|