mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Merge branch 'unstable' into agents/daily/onboarding-audit-2026-02-22-6501903614915901077
This commit is contained in:
11 files changed
+9548
-40
No files matched your search
@@ -83,6 +83,7 @@ test.describe("Accessibility and keyboard navigation", () => {
|
||||
|
||||
// When: login button receives focus and Enter is pressed
|
||||
const loginBtn = page.locator('[data-testid="login-button"]');
|
||||
await expect(loginBtn).toBeVisible();
|
||||
await loginBtn.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
|
||||
@@ -133,6 +133,11 @@ async function gotoWithTestMode(page: Page, relayUrl: string, path = "/") {
|
||||
() => typeof (window as any).__bitvidTest__ === "object",
|
||||
{ timeout: 15000 },
|
||||
);
|
||||
|
||||
// Explicitly set test relays to ensure they are active and recognized by the relayManager patch
|
||||
await page.evaluate((url) => {
|
||||
(window as any).__bitvidTest__.setTestRelays([url], { persist: false });
|
||||
}, relayUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -98,6 +98,11 @@ test.describe("Login and authentication flows", () => {
|
||||
(window as any).__bitvidTest__.logout();
|
||||
});
|
||||
|
||||
// Wait for state to settle with a longer timeout
|
||||
await page.waitForFunction(() => {
|
||||
return (window as any).__bitvidTest__.getAppState().isLoggedIn === false;
|
||||
}, { timeout: 15000 });
|
||||
|
||||
const loggedOut = await page.evaluate(() => {
|
||||
return (window as any).__bitvidTest__.getAppState();
|
||||
});
|
||||
|
||||
@@ -35,6 +35,11 @@ test.describe("Video playback scenarios", () => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
});
|
||||
|
||||
// Wait for the modal element to be present in DOM before clicking
|
||||
// This ensures event listeners (like VideoModalController's body click delegate)
|
||||
// have likely been initialized by the app boot sequence.
|
||||
await page.locator("#playerModal").waitFor({ state: "attached", timeout: 15000 });
|
||||
|
||||
// When: user clicks the video card
|
||||
const card = page.locator("[data-video-card]").first();
|
||||
await expect(card).toBeVisible();
|
||||
@@ -65,6 +70,9 @@ test.describe("Video playback scenarios", () => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
});
|
||||
|
||||
// Wait for modal presence to ensure app is fully initialized
|
||||
await page.locator("#playerModal").waitFor({ state: "attached", timeout: 15000 });
|
||||
|
||||
await page.locator("[data-video-card]").first().click();
|
||||
|
||||
const playerModal = page.locator("#playerModal");
|
||||
@@ -101,6 +109,8 @@ test.describe("Video playback scenarios", () => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
});
|
||||
|
||||
await page.locator("#playerModal").waitFor({ state: "attached", timeout: 15000 });
|
||||
|
||||
// When: user opens the video
|
||||
await page.locator("[data-video-card]").first().click();
|
||||
|
||||
@@ -147,6 +157,8 @@ test.describe("Video playback scenarios", () => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
});
|
||||
|
||||
await page.locator("#playerModal").waitFor({ state: "attached", timeout: 15000 });
|
||||
|
||||
// When: user opens the video
|
||||
await page.locator("[data-video-card]").first().click();
|
||||
|
||||
@@ -195,15 +207,30 @@ test.describe("Video playback scenarios", () => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
});
|
||||
|
||||
await page.locator("#playerModal").waitFor({ state: "attached", timeout: 15000 });
|
||||
|
||||
await page.locator("[data-video-card]").first().click();
|
||||
|
||||
const playerModal = page.locator("#playerModal");
|
||||
await expect(playerModal).not.toHaveClass(/hidden/, { timeout: 10000 });
|
||||
|
||||
// When: user closes the modal
|
||||
// Try various close mechanisms
|
||||
const closeBtn = page.locator(
|
||||
"#playerModal .modal-close, #playerModal [data-close], #playerModal [data-dismiss], #closePlayerModal",
|
||||
// Use the standard close button ID which is bound in VideoModal.js
|
||||
const closeBtn = page.locator("#closeModal");
|
||||
await closeBtn.waitFor({ state: "visible", timeout: 5000 });
|
||||
await closeBtn.click();
|
||||
|
||||
// Then: modal is hidden again
|
||||
await page.waitForFunction(
|
||||
() => {
|
||||
const modal = document.querySelector("#playerModal");
|
||||
if (!modal) return true;
|
||||
return (
|
||||
modal.classList.contains("hidden") ||
|
||||
modal.getAttribute("data-open") === "false"
|
||||
);
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
if ((await closeBtn.count()) > 0) {
|
||||
await closeBtn.first().click({ force: true });
|
||||
@@ -240,6 +267,8 @@ test.describe("Video playback scenarios", () => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
});
|
||||
|
||||
await page.locator("#playerModal").waitFor({ state: "attached", timeout: 15000 });
|
||||
|
||||
// When: user opens the video
|
||||
await page.locator("[data-video-card]").first().click();
|
||||
|
||||
|
||||
Reference in new issue
Block a user