From d0f10d3ab7c1950eb9f0fb62d950e5626a1db2cb Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 22 Feb 2026 15:48:22 +0000 Subject: [PATCH] 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 <53631862+PR0M3TH3AN@users.noreply.github.com> --- js/testHarness.js | 4 +++- tests/e2e/video-playback-scenarios.spec.ts | 1 + tests/e2e/video-upload-flow.spec.ts | 12 +++--------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/js/testHarness.js b/js/testHarness.js index b2e5052a..c905fbc4 100644 --- a/js/testHarness.js +++ b/js/testHarness.js @@ -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")), diff --git a/tests/e2e/video-playback-scenarios.spec.ts b/tests/e2e/video-playback-scenarios.spec.ts index 800c3e81..f2c0eeb4 100644 --- a/tests/e2e/video-playback-scenarios.spec.ts +++ b/tests/e2e/video-playback-scenarios.spec.ts @@ -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" ); }, diff --git a/tests/e2e/video-upload-flow.spec.ts b/tests/e2e/video-upload-flow.spec.ts index bb42aedc..15ec9e7c 100644 --- a/tests/e2e/video-upload-flow.spec.ts +++ b/tests/e2e/video-upload-flow.spec.ts @@ -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");