Skip to content

fix (ci/tests): Stabilize cross-page slide comparison - #25052

Merged
gustavotrott merged 2 commits into
bigbluebutton:v3.0.x-developfrom
gustavotrott:improve-tests-upload
May 9, 2026
Merged

gustavotrott merged 2 commits into
bigbluebutton:v3.0.x-developfrom
gustavotrott:improve-tests-upload

Conversation

@gustavotrott

Copy link
Copy Markdown
Contributor

Poll the user page until it matches the moderator side, fixing flaky uploads in CI.

Attempt to avoid this error that occurs often:

Strip per-user auth query params from slide HTML and poll the user
page until it matches the moderator side, fixing flaky uploads in CI.
@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR refactors presentation test utilities by introducing a shared expectSlidesEqualBetweenPages helper function in util.ts that encapsulates slide HTML comparison and polling logic. The new helper is imported in presentation.ts and used to replace manual slide comparison code in three test functions: uploadMultiplePresentationsTest, uploadAndRemoveAllPresentations, and removePreviousPresentationFromPreviousPresenter. Additionally, the imports in util.ts are reformatted, and the uploadMultiplePresentations test flow is corrected to properly structure the uploadDoneIcon assertion within its try/catch block.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: stabilizing cross-page slide comparison by polling the user page until it matches the moderator side, which directly addresses the flaky test issue.
Description check ✅ Passed The description is related to the changeset, explaining the polling mechanism to fix flaky uploads in CI and referencing a specific error scenario with a supporting image.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented May 9, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
bigbluebutton-tests/playwright/presentation/util.ts (2)

30-40: 💤 Low value

Consider checking for null/undefined moderator slide

The function captures the moderator slide HTML once at line 38, then polls the user page until it matches. While getSlideOuterHtml waits for the element, document.querySelector(...).outerHTML could theoretically return undefined if a race condition occurs between the wait and the evaluate.

🛡️ Optional: Add assertion that moderator slide HTML was captured
 export async function expectSlidesEqualBetweenPages(
   modPage: Page,
   userPage: Page,
   description: string,
   timeout = ELEMENT_WAIT_LONGER_TIME,
 ) {
   const modSlide = await getSlideOuterHtml(modPage);
+  if (!modSlide) {
+    throw new Error('Failed to capture moderator slide HTML');
+  }
   await expect.poll(() => getSlideOuterHtml(userPage), { message: description, timeout }).toBe(modSlide);
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bigbluebutton-tests/playwright/presentation/util.ts` around lines 30 - 40,
The code captures the moderator slide HTML into modSlide in
expectSlidesEqualBetweenPages but doesn't guard against it being null/undefined;
after calling getSlideOuterHtml(modPage) add an explicit check/assert that
modSlide is defined (e.g., throw or use
expect(modSlide).toBeDefined()/toBeTruthy()) before starting the poll so the
test fails fast with a clear message if the moderator slide wasn't captured;
reference the function expectSlidesEqualBetweenPages, the variable modSlide, and
the helper getSlideOuterHtml when making this change.

130-148: ⚡ Quick win

Clarify the retry logic for upload done icon check

The current try/catch pattern duplicates the uploadDoneIcon check: it appears both inside the try block (line 138-141) and in the catch block (line 143-147). This provides retry behavior if processing completes too quickly to observe or if the first uploadDoneIcon check times out, but the duplication obscures the intent.

♻️ Clearer alternative: separate concerns and avoid duplication
   try {
     await testPage.hasNElements(
       e.processingPresentationItem,
       fileNames.length,
       'should display the presentation status info element with converting label after confirmation to upload the new file',
     );
-
+  } catch {
+    // Processing may complete too quickly to observe; this is acceptable
+  }
+  // Always verify upload completion
+  await testPage.hasNElements(
+    e.uploadDoneIcon,
+    fileNames.length,
+    'should display the upload done icon after all presentations are successfully uploaded',
+  );
+  // Fallback retry if upload still in progress
+  try {
     await testPage.hasNElements(
       e.uploadDoneIcon,
       fileNames.length,
       'should display the upload done icon after all presentations are successfully uploaded',
     );
   } catch {
-    await testPage.hasNElements(
-      e.uploadDoneIcon,
-      fileNames.length,
-      'should display the upload done icon after all presentations are successfully uploaded',
-    );
+    // Final attempt with implicit timeout from hasNElements
   }

Or more simply:

   try {
     await testPage.hasNElements(
       e.processingPresentationItem,
       fileNames.length,
       'should display the presentation status info element with converting label after confirmation to upload the new file',
     );
-
-    await testPage.hasNElements(
-      e.uploadDoneIcon,
-      fileNames.length,
-      'should display the upload done icon after all presentations are successfully uploaded',
-    );
   } catch {
-    await testPage.hasNElements(
-      e.uploadDoneIcon,
-      fileNames.length,
-      'should display the upload done icon after all presentations are successfully uploaded',
-    );
+    // Processing completed too quickly; this is acceptable in CI
   }
+  await testPage.hasNElements(
+    e.uploadDoneIcon,
+    fileNames.length,
+    'should display the upload done icon after all presentations are successfully uploaded',
+  );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bigbluebutton-tests/playwright/presentation/util.ts` around lines 130 - 148,
The duplicated upload-done check should be clarified: remove the second
(duplicate) call inside the try/catch and either (a) call
testPage.hasNElements(e.uploadDoneIcon, fileNames.length, ...) once after
awaiting the processing check (so the flow is: await
hasNElements(e.processingPresentationItem...) then await
hasNElements(e.uploadDoneIcon...)), or (b) replace the try/catch duplication
with a small retry wrapper around testPage.hasNElements for e.uploadDoneIcon
(e.g. a loop with short delays that retries until success or timeout) so the
retry intent is explicit; update references to testPage.hasNElements,
e.processingPresentationItem and e.uploadDoneIcon accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@bigbluebutton-tests/playwright/presentation/util.ts`:
- Around line 30-40: The code captures the moderator slide HTML into modSlide in
expectSlidesEqualBetweenPages but doesn't guard against it being null/undefined;
after calling getSlideOuterHtml(modPage) add an explicit check/assert that
modSlide is defined (e.g., throw or use
expect(modSlide).toBeDefined()/toBeTruthy()) before starting the poll so the
test fails fast with a clear message if the moderator slide wasn't captured;
reference the function expectSlidesEqualBetweenPages, the variable modSlide, and
the helper getSlideOuterHtml when making this change.
- Around line 130-148: The duplicated upload-done check should be clarified:
remove the second (duplicate) call inside the try/catch and either (a) call
testPage.hasNElements(e.uploadDoneIcon, fileNames.length, ...) once after
awaiting the processing check (so the flow is: await
hasNElements(e.processingPresentationItem...) then await
hasNElements(e.uploadDoneIcon...)), or (b) replace the try/catch duplication
with a small retry wrapper around testPage.hasNElements for e.uploadDoneIcon
(e.g. a loop with short delays that retries until success or timeout) so the
retry intent is explicit; update references to testPage.hasNElements,
e.processingPresentationItem and e.uploadDoneIcon accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4e259285-73ec-4e20-9c4e-c0521994268d

📥 Commits

Reviewing files that changed from the base of the PR and between ddd2512 and 5d74e06.

📒 Files selected for processing (2)
  • bigbluebutton-tests/playwright/presentation/presentation.ts
  • bigbluebutton-tests/playwright/presentation/util.ts

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown

✅ Automated tests have passed!

@gustavotrott
gustavotrott merged commit 7434f50 into bigbluebutton:v3.0.x-develop May 9, 2026
34 checks passed
@antobinary antobinary added this to the Release 3.0 milestone May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants