mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-30 17:32:26 +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
+1
-1
@@ -481,7 +481,7 @@ 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")),
|
||||
|
||||
@@ -805,7 +805,9 @@ export class UploadModal {
|
||||
|
||||
|
||||
updateVideoProgress(fraction, text) {
|
||||
if (text) this.statusText.uploadMain.textContent = text;
|
||||
if (text && this.statusText?.uploadMain) {
|
||||
this.statusText.uploadMain.textContent = text;
|
||||
}
|
||||
|
||||
if (fraction === null) {
|
||||
// Indeterminate or error
|
||||
@@ -813,18 +815,28 @@ export class UploadModal {
|
||||
}
|
||||
|
||||
const pct = Math.round(fraction * 100);
|
||||
this.inputs.progress.value = pct;
|
||||
this.statusText.uploadPercent.textContent = `${pct}%`;
|
||||
if (this.inputs?.progress) {
|
||||
this.inputs.progress.value = pct;
|
||||
}
|
||||
if (this.statusText?.uploadPercent) {
|
||||
this.statusText.uploadPercent.textContent = `${pct}%`;
|
||||
}
|
||||
}
|
||||
|
||||
updateThumbnailProgress(fraction, text) {
|
||||
if (text) this.statusText.thumbnailMain.textContent = text;
|
||||
if (text && this.statusText?.thumbnailMain) {
|
||||
this.statusText.thumbnailMain.textContent = text;
|
||||
}
|
||||
|
||||
if (fraction === null) return;
|
||||
|
||||
const pct = Math.round(fraction * 100);
|
||||
this.inputs.thumbnailProgress.value = pct;
|
||||
this.statusText.thumbnailPercent.textContent = `${pct}%`;
|
||||
if (this.inputs?.thumbnailProgress) {
|
||||
this.inputs.thumbnailProgress.value = pct;
|
||||
}
|
||||
if (this.statusText?.thumbnailPercent) {
|
||||
this.statusText.thumbnailPercent.textContent = `${pct}%`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -911,6 +923,9 @@ export class UploadModal {
|
||||
}
|
||||
|
||||
toggleStorageView(viewName) {
|
||||
if (!this.storageViews?.summary || !this.storageViews?.empty) {
|
||||
return;
|
||||
}
|
||||
if (viewName === "summary") {
|
||||
this.storageViews.summary.classList.remove("hidden");
|
||||
this.storageViews.empty.classList.add("hidden");
|
||||
@@ -968,11 +983,11 @@ export class UploadModal {
|
||||
|
||||
updateLockUi() {
|
||||
const locked = !this.isStorageUnlocked;
|
||||
if (this.statusText.storageLock) {
|
||||
if (this.statusText?.storageLock) {
|
||||
this.statusText.storageLock.textContent = locked ? "Locked 🔒" : "Unlocked 🔓";
|
||||
this.statusText.storageLock.className = locked ? "text-xs text-critical" : "text-xs text-success";
|
||||
}
|
||||
if (this.toggles.storageUnlock) {
|
||||
if (this.toggles?.storageUnlock) {
|
||||
// Show unlock button only if locked AND we have a configuration to unlock
|
||||
if (locked && this.storageConfigured) {
|
||||
this.toggles.storageUnlock.classList.remove("hidden");
|
||||
|
||||
@@ -40,7 +40,8 @@ const IGNORED_GLOBS = [
|
||||
'test_logs/**',
|
||||
'context/**',
|
||||
'decisions/**',
|
||||
'todo/**'
|
||||
'todo/**',
|
||||
'docs/**'
|
||||
];
|
||||
|
||||
const gitArgs = [
|
||||
|
||||
@@ -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