mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
fix(test): resolve CI timeout in webseed-playback e2e test
- Switched from `waitUntil: 'networkidle'` to `domcontentloaded` + explicit selector wait to avoid flakiness from background polling. - Added fail-fast logic to detect "Failed to load content" view states. - Added error logging to capture page state if the test times out. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
87f7ae7616
commit
8d116af35f
1 file changed
+19
-4
@@ -7,10 +7,25 @@ test.describe("Webseed Stream Playback", () => {
|
||||
const MAGNET_URI = `magnet:?xt=urn:btih:${INFO_HASH}`;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto("/", { waitUntil: "networkidle" });
|
||||
await page.waitForFunction(() => {
|
||||
return !!document.getElementById('videoList');
|
||||
});
|
||||
// networkidle can be flaky if background polling/relays are active.
|
||||
// We rely on explicit selector waits instead.
|
||||
await page.goto("/", { waitUntil: "domcontentloaded" });
|
||||
|
||||
try {
|
||||
// Wait for either the video list (success) or the error message (failure)
|
||||
await Promise.race([
|
||||
page.waitForSelector('#videoList', { timeout: 30000 }),
|
||||
page.waitForSelector('.text-critical-strong', { timeout: 30000 }).then(async (el) => {
|
||||
const text = await el?.innerText();
|
||||
throw new Error(`View load failed with message: ${text}`);
|
||||
})
|
||||
]);
|
||||
} catch (error) {
|
||||
// If timeout occurs, capture page content for debugging
|
||||
const body = await page.innerHTML('body');
|
||||
console.error('Test failed to load video list. Body content:', body.substring(0, 500));
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
test("plays directly from HTML link (CDN mode)", async ({ page }) => {
|
||||
|
||||
Reference in new issue
Block a user