Skip to content

test: add BlockNote shared notes e2e tests - #25165

Merged
ramonlsouza merged 5 commits into
bigbluebutton:v4.0.x-developfrom
Tainan404:i-25125
Jul 15, 2026
Merged

ramonlsouza merged 5 commits into
bigbluebutton:v4.0.x-developfrom
Tainan404:i-25125

Conversation

@Tainan404

Copy link
Copy Markdown
Member

What does this PR do?

Add e2e tests for BlockNote shared notes (8 tests mirroring the Etherpad suite)

Closes Issue(s)

Closes #25125

@Tainan404
Tainan404 requested review from GuiLeme and Copilot and removed request for Copilot May 26, 2026 16:18
@coderabbitai

coderabbitai Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds comprehensive Playwright coverage for BlockNote shared notes, including editing, formatting, PDF export, whiteboard conversion, collaboration, permissions, and pinning. It adds BlockNote-specific selectors and utilities, attaches videos for failing tests, and refactors Etherpad tests to use per-test initialization.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: imdt-claudiop, guileme

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The Playwright fixture video-attachment change is general test infrastructure and is not required by the BlockNote shared notes testing objective. Split the fixture update into a separate PR or explain why failed-test video attachments are needed for this issue.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding BlockNote shared notes end-to-end tests.
Description check ✅ Passed The description matches the changeset and accurately summarizes the new BlockNote shared notes e2e tests.
Linked Issues check ✅ Passed The PR implements #25125 by adding BlockNote shared notes test coverage and mirroring the Etherpad suite.
✨ 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.

Copilot AI 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.

Pull request overview

Adds an end-to-end Playwright test suite for the BlockNote shared-notes editor that mirrors the existing Etherpad suite (closes #25125), refactors the Etherpad suite away from beforeEach to per-test initialization, and extends Playwright infrastructure to record/attach per-context videos. A single product-code change adds a data-test="blockNoteToolbar" attribute used by the new selectors.

Changes:

  • New sharednotes/blocknote/ Playwright suite (8 tests) using SharedNotesBlockNote, plus BlockNote-specific selectors in core/elements.ts.
  • Etherpad spec refactored to instantiate SharedNotes and call initializePages per test (matching the new BlockNote pattern).
  • Playwright infrastructure: initializePages now records video into testInfo.outputDir, and the auto fixture in fixtures.ts collects/attaches videos after each test.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.spec.ts New spec defining 8 BlockNote shared-notes tests with per-test initialization.
bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts New SharedNotesBlockNote class implementing the BlockNote variants of each scenario.
bigbluebutton-tests/playwright/sharednotes/blocknote/util.ts Helpers for opening BlockNote shared notes and locating its editable/read-only editors.
bigbluebutton-tests/playwright/sharednotes/etherpad/sharednotes.spec.ts Refactor to per-test SharedNotes instantiation and a shared CREATE_PARAMETER constant.
bigbluebutton-tests/playwright/core/elements.ts Adds BlockNote selectors (container, editable/read-only editors, toolbar, PDF export, etc.).
bigbluebutton-tests/playwright/core/helpers.ts initializePages now configures recordVideo on the new context when testInfo is provided.
bigbluebutton-tests/playwright/core/setup/fixtures.ts Auto fixture collects all context page videos and attaches them to testInfo after each test.
bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx Adds data-test="blockNoteToolbar" to the static formatting toolbar to support new selectors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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.

Actionable comments posted: 3

🤖 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.

Inline comments:
In `@bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts`:
- Line 136: Replace the fixed 1s sleeps used via
this.modPage.page.waitForTimeout(1000) with state-based waits: instead of
sleeping in sharednotes.ts (the occurrences around waitForTimeout at lines 136
and 258), wait for a concrete observable condition on the page such as a
selector appearing or specific text syncing using Playwright APIs (e.g.,
page.waitForSelector, page.waitForFunction, or expect(locator).toHaveText) tied
to the SharedNotes UI element or text you expect to be present/updated; update
the code that currently calls this.modPage.page.waitForTimeout to wait for that
selector/text or a DOM attribute change on the shared notes component before
proceeding so tests are deterministic under CI and load.
- Around line 112-119: The request predicate used in
modPage.page.context().waitForEvent is too broad and can match unrelated
document requests; update the predicate so it only resolves for the PDF export
endpoint (e.g., require req.url().includes('/export/pdf') or both
'/hocuspocus/api/documents/' and '/export/pdf') so the wait corresponds to the
click that triggers export (related symbols:
modPage.page.context().waitForEvent, the predicate function, request.url(), and
e.exportNotesAsPDF); adjust the subsequent assertion if needed to rely on the
captured request url matching '/export/pdf'.

In `@bigbluebutton-tests/playwright/sharednotes/etherpad/sharednotes.spec.ts`:
- Line 21: The test title string contains a typo: change the test declaration
test('Formate text in shared notes', ...) to use the correct spelling
test('Format text in shared notes', ...) so the test name is accurate; update
only the string in the test(...) call in sharednotes.spec.ts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0af8da50-76b3-47f6-bd2b-30e86918104a

📥 Commits

Reviewing files that changed from the base of the PR and between bb67ab1 and 91e7f79.

📒 Files selected for processing (8)
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-tests/playwright/core/elements.ts
  • bigbluebutton-tests/playwright/core/helpers.ts
  • bigbluebutton-tests/playwright/core/setup/fixtures.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.spec.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/util.ts
  • bigbluebutton-tests/playwright/sharednotes/etherpad/sharednotes.spec.ts

@antobinary antobinary added this to the Release 4.0 milestone May 27, 2026

@GuiLeme GuiLeme 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.

Quick comment here: In order to properly run these tests, we need to first install the package bbb-shared-notes-server, running apt install bbb-shared-notes-server. I'd say it's important to be in the PR description.

Outside of that, the PR is running fine, I tested locally and all tests passes. I just agree with 2 small comments from code-rabbit and github copilot, please, check those out.

- narrow PDF export request predicate to /export/pdf; use ELEMENT_WAIT_EXTRA_LONG_TIME
- replace fixed waitForTimeout sleeps with state-based toContainText waits
- attach context videos only for failed tests
- fix "Formate" typo in Etherpad spec
@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@GuiLeme
GuiLeme self-requested a review June 22, 2026 19:20

@GuiLeme GuiLeme 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.

LGTM!

Reviewed the code and tested locally.

Tainan404 and others added 2 commits July 14, 2026 11:52
Conflict resolution:
- bn-shared-notes/component.tsx: keep upstream's ToolbarWithAccessibleMenus
  wrapper and Escape handling, re-add data-test="blockNoteToolbar"
- core/helpers.ts: keep upstream's opt-in recordVideo flag
- core/elements.ts: drop duplicated exportNotesAsPDF key
- blocknote tests: merge upstream's empty-notes export regression test
  (issue 25122) into this branch's suite under upstream's
  BlockNoteSharedNotes class name; fix stale e.sharedNotes reference

Co-Authored-By: Claude Fable 5 <[email protected]>
…5125

Resolve import conflict in blocknote/sharednotes.ts: keep both
ELEMENT_WAIT_LONGER_TIME (empty-notes export test from upstream merge)
and ELEMENT_WAIT_EXTRA_LONG_TIME (review feedback on PDF export wait).

Co-Authored-By: Claude Fable 5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
17.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts (1)

149-151: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Narrow the response predicate to the documents export path. The wait can match unrelated /export/pdf responses; include /hocuspocus/api/documents/ here too, matching the request assertion above.

🤖 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/sharednotes/blocknote/sharednotes.ts` around
lines 149 - 151, Update the waitForEvent response predicate in the shared notes
export flow to require both the documents API path “/hocuspocus/api/documents/”
and the “/export/pdf” endpoint, matching the preceding request assertion and
excluding unrelated PDF responses.
🧹 Nitpick comments (2)
bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts (2)

136-141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse startSharedNotesBlockNote instead of re-implementing the open-panel flow.

This manually replays a subset of startSharedNotesBlockNote (click sidebar button, wait for panel) but checks e.sharedNotesBackground instead of e.blockNoteEditable/hideNotesLabel. Since no typing is needed here, the shared utility works just as well and keeps the "notes are open" contract consistent across all flows in this file.

♻️ Proposed refactor
-    // Open the (empty) BlockNote shared notes panel. Nothing is typed, so the
-    // document stays empty.
-    await this.modPage.waitAndClick(e.sharedNotesSidebarButton, ELEMENT_WAIT_LONGER_TIME);
-    await this.modPage.hasElement(
-      e.sharedNotesBackground,
-      'should display the shared notes panel',
-      ELEMENT_WAIT_LONGER_TIME,
-    );
+    // Open the (empty) BlockNote shared notes panel. Nothing is typed, so the
+    // document stays empty.
+    await startSharedNotesBlockNote(this.modPage);
🤖 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/sharednotes/blocknote/sharednotes.ts` around
lines 136 - 141, Replace the manual sidebar click and background-element
assertion with the existing startSharedNotesBlockNote utility in the affected
flow. Reuse that helper’s established notes-open contract, without adding typing
or duplicating panel-opening logic.

386-390: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: hardcoded selection length (5) and duplicated countdown loop.

Both loops assume e.message splits into 5-letter words ("Hello"/"World"); if that shared constant ever changes, this silently mis-selects text. Optional: derive lengths from e.message.split(' ') and extract a small selectBackwards(page, count) helper to remove the duplicated loop.

Also applies to: 399-403

🤖 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/sharednotes/blocknote/sharednotes.ts` around
lines 386 - 390, Replace the hardcoded selection length and duplicated countdown
loops around the message-selection steps with a shared selectBackwards helper
that accepts the page and count. Derive each count from the actual word lengths
in e.message.split(' '), preserving the existing backward-selection behavior for
both message words.
🤖 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.

Inline comments:
In `@bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts`:
- Around line 212-223: Replace the hardcoded 20000/30000 waits in sharednotes.ts
at lines 212-223, 300, and 341-344 with one appropriately sized
MULTIPLIER-scaled constant, adding it to core/constants.ts or reusing an
existing wait constant; also apply the same timeout to the attendee assertion at
line 348. Update the related hasText and toContainText calls without changing
their assertions.

---

Outside diff comments:
In `@bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts`:
- Around line 149-151: Update the waitForEvent response predicate in the shared
notes export flow to require both the documents API path
“/hocuspocus/api/documents/” and the “/export/pdf” endpoint, matching the
preceding request assertion and excluding unrelated PDF responses.

---

Nitpick comments:
In `@bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts`:
- Around line 136-141: Replace the manual sidebar click and background-element
assertion with the existing startSharedNotesBlockNote utility in the affected
flow. Reuse that helper’s established notes-open contract, without adding typing
or duplicating panel-opening logic.
- Around line 386-390: Replace the hardcoded selection length and duplicated
countdown loops around the message-selection steps with a shared selectBackwards
helper that accepts the page and count. Derive each count from the actual word
lengths in e.message.split(' '), preserving the existing backward-selection
behavior for both message words.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2a7e78e7-d742-445c-884e-3e42576f876c

📥 Commits

Reviewing files that changed from the base of the PR and between 13608f5 and 48d21d4.

📒 Files selected for processing (4)
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-tests/playwright/core/elements.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.spec.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • bigbluebutton-tests/playwright/core/elements.ts
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.spec.ts

Comment on lines +212 to +223
await this.modPage.hasText(
e.currentSlideText,
/test/,
'should the slide contain the text "test" for the moderator',
30000,
);
await this.userPage.hasText(
e.currentSlideText,
/test/,
'should the slide contain the text "test" for the attendee',
20000,
);

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Raw 20000/30000 timeouts bypass the file's MULTIPLIER-scaled wait constants. All three sites hardcode timeout values instead of using the ELEMENT_WAIT_TIME/ELEMENT_WAIT_LONGER_TIME/ELEMENT_WAIT_EXTRA_LONG_TIME constants (which scale via MULTIPLIER for slower CI). One missing constant is the root cause.

  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts#L212-L223: replace the raw 30000/20000 timeouts in the hasText calls with a named, MULTIPLIER-scaled constant (e.g. add ELEMENT_WAIT_LONG_TIME to core/constants.ts or reuse an existing one sized appropriately).
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts#L300-L300: replace the raw 20000 timeout in the read-only toContainText assertion with the same constant.
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts#L341-L344: replace the raw 20000 timeout with the same constant (and add a matching timeout to the attendee-side assertion at L348, per the separate comment on that line).
📍 Affects 1 file
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts#L212-L223 (this comment)
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts#L300-L300
  • bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts#L341-L344
🤖 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/sharednotes/blocknote/sharednotes.ts` around
lines 212 - 223, Replace the hardcoded 20000/30000 waits in sharednotes.ts at
lines 212-223, 300, and 341-344 with one appropriately sized MULTIPLIER-scaled
constant, adding it to core/constants.ts or reusing an existing wait constant;
also apply the same timeout to the attendee assertion at line 348. Update the
related hasText and toContainText calls without changing their assertions.

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@ramonlsouza
ramonlsouza merged commit a9c0cd5 into bigbluebutton:v4.0.x-develop Jul 15, 2026
36 of 37 checks passed
ramonlsouza pushed a commit that referenced this pull request Jul 20, 2026
Backport of #25165 (merged on v4.0.x-develop) to v3.0.x-develop, bringing the
BlockNote shared-notes e2e coverage to the 3.0 line.

Cherry-picked a9c0cd5 with two conflicts resolved:
- core/elements.ts: added the BlockNote selectors block at the shared-notes
  export insertion point.
- sharednotes/blocknote/util.ts (add/add): merged the new 4.0 helpers
  (startSharedNotesBlockNote, getBlockNoteReadOnlyLocator) with the existing 3.0
  helpers already present from #25225, keeping a single getBlockNoteEditorLocator.

3.0 adaptations in sharednotes.ts for element renames that only exist on 4.0:
- sharedNotesSidebarButton to sharedNotes
- messagesSidebarButton to chatButton
- lock flow uses manageUsers + lockViewersButton (the 3.0 lock modal has no
  participant permissions tab)
- make-presenter uses userListItem instead of usersListSidebarButton +
  moreOptionsUserItemButton

The "Pin and unpin notes onto whiteboard" scenario is marked fixme on 3.0: a
viewer whiteboard does not re-sync to the presenter presentation state after the
presenter unpins shared notes (the canvas is not restored). That sync behavior
only exists on 4.0.
ramonlsouza added a commit that referenced this pull request Jul 20, 2026
test: add BlockNote shared notes e2e tests (backport of #25165)
antobinary added a commit to antobinary/bigbluebutton that referenced this pull request Aug 7, 2026
…right suite

Both files auto-merged without a conflict but ended up with duplicate top-level
declarations, which is a hard SyntaxError for the playwright loader. The whole
suite collected 0 tests in 0 files — every spec failed to import, not just the
shared-notes ones.

sharednotes/blocknote/util.ts
  3.0's backport of bigbluebutton#25165 appended its own startSharedNotesBlockNote and
  getBlockNoteReadOnlyLocator to a file that already defined both. The 3.0
  copies open the panel via e.sharedNotes, which does not exist in 4.0's
  elements.ts at all (renamed to sharedNotesSidebarButton), so they were dead
  on arrival as well as duplicated. Removed them; the 4.0 definitions at the top
  of the file already do the same job with the right selectors.

whiteboard/whiteboard.spec.ts
  `import { linkIssue } from '../core/helpers';` landed twice, once from each
  side, at different points in the import block.

This is the same failure mode as 5840bc2 ("restore BlockNote shared-notes
helpers dropped in 3.0->4.0 merge") from the previous 3.0 merge: git resolves
these files happily because the additions are textually far apart, and nothing
in the merge output hints that the result does not parse.

Not fixed here, because they predate this merge and are identical on
v4.0.x-develop (verified by running tsc against a worktree at 5fa28d6):
e.userListToggleBtn in accessibility/document-title.spec.ts,
ELEMENT_WAIT_EXTRA_LONG_TIME in presentation/presentation.ts, and e.sharedNotes
in sharednotes/blocknote/blocknote.ts.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.

5 participants