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,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();
|
||||
}
|
||||
Reference in new issue
Block a user