mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix(ci): resolve unit test reference error and visual test race condition
- Fix `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` by correctly destructuring the spy calls. - Fix visual regression in `tests/visual/overlay-layers.spec.ts` by pre-suppressing the disclaimer modal via `addInitScript`, preventing it from hiding the sidebar and causing visibility assertion failures. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
200acf0785
commit
4d6fa37df5
2 files changed
+7
-32
No files matched your search
@@ -313,7 +313,7 @@ test("NIP-07 login falls back when structured permissions fail", async () => {
|
||||
const pubkey = result.pubkey;
|
||||
assert.equal(pubkey, HEX_PUBKEY);
|
||||
assert.ok(env.enableCalls.length >= 2, "should retry with alternate payloads");
|
||||
const [objectCall, stringCall] = env.enableCalls;
|
||||
const [objectCall, stringCall, plainCall] = env.enableCalls;
|
||||
assert.ok(Array.isArray(objectCall?.permissions));
|
||||
assert.equal(
|
||||
typeof objectCall.permissions[0],
|
||||
|
||||
@@ -10,40 +10,15 @@ declare global {
|
||||
}
|
||||
|
||||
test.describe("overlay layering tokens", () => {
|
||||
async function dismissDisclaimerModal(page: Page) {
|
||||
const modal = page.locator("#disclaimerModal");
|
||||
if ((await modal.count()) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
await page.evaluate(() => {
|
||||
try {
|
||||
window.localStorage?.setItem("hasSeenDisclaimer", "true");
|
||||
} catch (error) {
|
||||
console.warn("Failed to persist disclaimer state", error);
|
||||
}
|
||||
document
|
||||
.querySelectorAll<HTMLElement>("#disclaimerModal")
|
||||
.forEach((node) => {
|
||||
node.classList.add("hidden");
|
||||
node.setAttribute("data-open", "false");
|
||||
});
|
||||
document.documentElement?.classList.remove("modal-open");
|
||||
document.body?.classList.remove("modal-open");
|
||||
});
|
||||
|
||||
await page.waitForFunction(() =>
|
||||
Array.from(
|
||||
document.querySelectorAll("#disclaimerModal")
|
||||
).every((modalElement) => modalElement.classList.contains("hidden"))
|
||||
);
|
||||
}
|
||||
|
||||
test("mobile sidebar shares desktop rail behavior", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.goto("/index.html", { waitUntil: "networkidle" });
|
||||
|
||||
await dismissDisclaimerModal(page);
|
||||
// Pre-suppress the disclaimer modal to avoid race conditions with app hydration
|
||||
await page.addInitScript(() => {
|
||||
window.localStorage.setItem("hasSeenDisclaimer", "true");
|
||||
});
|
||||
|
||||
await page.goto("/index.html", { waitUntil: "networkidle" });
|
||||
|
||||
// Wait for initial fade-in to complete so opacity doesn't interfere with visibility checks
|
||||
await page.waitForFunction(
|
||||
|
||||
Reference in new issue
Block a user