mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Fix E2E CI failures: Harden UploadModal and fix login modal waiter
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
5c944199d9
commit
2122a257c8
5 files changed
+38
-19
No files matched your search
@@ -83,10 +83,17 @@ 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");
|
||||
|
||||
// Then: login modal opens
|
||||
// Wait for the modal to be attached to the DOM first (it might be loaded dynamically)
|
||||
await page.waitForSelector('[data-testid="login-modal"]', {
|
||||
state: "attached",
|
||||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page.waitForFunction(
|
||||
() => {
|
||||
const modal = document.querySelector(
|
||||
@@ -273,10 +280,7 @@ test.describe("Accessibility and keyboard navigation", () => {
|
||||
'[data-testid="upload-modal"]',
|
||||
);
|
||||
if (!(modal instanceof HTMLElement)) return false;
|
||||
return (
|
||||
modal.getAttribute("data-open") === "true" &&
|
||||
!modal.classList.contains("hidden")
|
||||
);
|
||||
return !modal.classList.contains("hidden");
|
||||
},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
|
||||
@@ -34,10 +34,7 @@ test.describe("Video upload and discovery", () => {
|
||||
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")
|
||||
);
|
||||
return !m.classList.contains("hidden");
|
||||
}, { timeout: 10000 });
|
||||
|
||||
await expect(
|
||||
@@ -204,7 +201,9 @@ 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");
|
||||
// The title attribute is on the h3 element inside the card
|
||||
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