mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
test(e2e): fix video card selectors and modal wait logic
- Updated `js/testHarness.js` to read `data-video-title` attribute instead of `textContent` to avoid marquee duplication issues. - Updated `tests/e2e/video-upload-flow.spec.ts` to query title attribute on the correct child element. - Updated `tests/e2e/video-upload-flow.spec.ts` to use `toBeVisible()` for modal wait instead of fragile `data-open` attribute check. - Updated `tests/e2e/video-playback-scenarios.spec.ts` to include `style.display` check for modal closing. - Verified `feed-pagination-stress.spec.ts` passes with these fixes. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
e9ca94e89d
commit
d0f10d3ab7
3 files changed
+7
-10
No files matched your search
+3
-1
@@ -472,7 +472,9 @@ function getAppState() {
|
||||
function getFeedItems() {
|
||||
const cards = document.querySelectorAll("[data-video-card]");
|
||||
return Array.from(cards).map((card) => ({
|
||||
title: card.querySelector("[data-video-title]")?.textContent?.trim() || "",
|
||||
title:
|
||||
card.querySelector("[data-video-title]")?.getAttribute("data-video-title") ||
|
||||
"",
|
||||
pubkey: card.getAttribute("data-video-pubkey") || "",
|
||||
dTag: card.getAttribute("data-video-dtag") || "",
|
||||
hasUrl: Boolean(card.getAttribute("data-play-url")),
|
||||
|
||||
@@ -215,6 +215,7 @@ test.describe("Video playback scenarios", () => {
|
||||
if (!modal) return true;
|
||||
return (
|
||||
modal.classList.contains("hidden") ||
|
||||
modal.style.display === "none" ||
|
||||
modal.getAttribute("data-open") === "false"
|
||||
);
|
||||
},
|
||||
|
||||
@@ -31,14 +31,7 @@ test.describe("Video upload and discovery", () => {
|
||||
|
||||
// Then: upload modal becomes visible with expected form fields
|
||||
const modal = page.locator('[data-testid="upload-modal"]');
|
||||
await page.waitForFunction(() => {
|
||||
const m = document.querySelector('[data-testid="upload-modal"]');
|
||||
if (!(m instanceof HTMLElement)) return false;
|
||||
return (
|
||||
m.getAttribute("data-open") === "true" &&
|
||||
!m.classList.contains("hidden")
|
||||
);
|
||||
}, { timeout: 10000 });
|
||||
await expect(modal).toBeVisible({ timeout: 10000 });
|
||||
|
||||
await expect(
|
||||
page.locator('[data-testid="upload-title"]'),
|
||||
@@ -204,7 +197,8 @@ test.describe("Video upload and discovery", () => {
|
||||
const card = page.locator("[data-video-card]").first();
|
||||
await expect(card).toBeVisible();
|
||||
|
||||
const title = await card.getAttribute("data-video-title");
|
||||
const titleEl = card.locator("[data-video-title]");
|
||||
const title = await titleEl.getAttribute("data-video-title");
|
||||
expect(title).toBe("Attributed Video");
|
||||
|
||||
const pubkey = await card.getAttribute("data-video-pubkey");
|
||||
|
||||
Reference in new issue
Block a user