mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix: initialize video modal share popover with correct arguments
- Update `js/ui/components/VideoModal.js` to correctly initialize the modal share popover using the `createPopover(trigger, renderFn, options)` signature instead of a single config object. - Fix the flaky e2e test `tests/e2e/search-and-filter.spec.ts` by increasing the test timeout from 15s to 30s to allow more time for feed items to be retrieved from the network. - Update `tests/e2e/video-modal-share-bug.spec.ts` to attach an `#uiOverlay` wrapper element for the popover so the DOM doesn't crash on tests. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
524dc2b3eb
commit
f7712f51a9
3 files changed
+44
-28
No files matched your search
@@ -75,7 +75,7 @@ test.describe("Search and filtering", () => {
|
||||
|
||||
// Wait for all videos to load
|
||||
await page.evaluate(() => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(3, 20000);
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(3, 30000);
|
||||
});
|
||||
|
||||
// When: user searches for "Cooking"
|
||||
@@ -118,7 +118,7 @@ test.describe("Search and filtering", () => {
|
||||
await loginAs(page);
|
||||
|
||||
await page.evaluate(() => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 30000);
|
||||
});
|
||||
|
||||
// When: user searches for something that doesn't match
|
||||
@@ -154,7 +154,7 @@ test.describe("Search and filtering", () => {
|
||||
await loginAs(page);
|
||||
|
||||
await page.evaluate(() => {
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 15000);
|
||||
return (window as any).__bitvidTest__.waitForFeedItems(1, 30000);
|
||||
});
|
||||
|
||||
const searchInput = page.locator('[data-testid="search-input"]');
|
||||
|
||||
@@ -30,19 +30,23 @@ test.describe("video modal share button", () => {
|
||||
// Force loaded state and hydrate
|
||||
const playerModal = document.getElementById("playerModal");
|
||||
if (playerModal) {
|
||||
videoModal.document = document;
|
||||
videoModal.loaded = true;
|
||||
videoModal.hydrate(playerModal);
|
||||
|
||||
// Mock an active video so the share menu has data
|
||||
videoModal.activeVideo = {
|
||||
const activeVideo = {
|
||||
id: "test-video-id",
|
||||
title: "Test Video",
|
||||
url: "https://example.com/video.mp4",
|
||||
magnet: "magnet:?xt=urn:btih:test",
|
||||
};
|
||||
|
||||
videoModal.shareNostrAuthState = { isLoggedIn: true, hasSigner: true };
|
||||
|
||||
// Open the modal
|
||||
videoModal.open(videoModal.activeVideo);
|
||||
videoModal.open(activeVideo);
|
||||
videoModal.setShareEnabled(true);
|
||||
}
|
||||
|
||||
window.__videoModal = videoModal;
|
||||
@@ -53,9 +57,10 @@ test.describe("video modal share button", () => {
|
||||
const modal = page.locator("#playerModal");
|
||||
await expect(modal).not.toHaveClass(/hidden/);
|
||||
|
||||
// Click share button
|
||||
// Ensure modal is visible and click share button
|
||||
const shareBtn = page.locator("#shareBtn");
|
||||
await expect(shareBtn).toBeVisible();
|
||||
|
||||
await shareBtn.click();
|
||||
|
||||
// Expect popover to be open
|
||||
|
||||
Reference in new issue
Block a user