Skip to content

test: add BlockNote shared notes e2e tests (backport of #25165) - #25444

Merged
ramonlsouza merged 1 commit into
bigbluebutton:v3.0.x-developfrom
imdt-claudiop:backport-25165-to-v3.0
Jul 20, 2026
Merged

ramonlsouza merged 1 commit into
bigbluebutton:v3.0.x-developfrom
imdt-claudiop:backport-25165-to-v3.0

Conversation

@imdt-claudiop

Copy link
Copy Markdown
Contributor

What does this PR do?

Backports #25165 (merged on v4.0.x-develop) to v3.0.x-develop, bringing the BlockNote shared-notes e2e coverage to the 3.0 line. Adds 8 e2e tests mirroring the Etherpad suite (open, type, format, export PDF, export empty PDF, convert to presentation, multi-user edit, view without edit permission), plus the one-line data-test="blockNoteToolbar" attribute on the toolbar that the suite selects on.

Closes #25125 (the same issue the 4.0 PR closed, now for the 3.0 line).

Conflicts resolved (semantic, 2 of 7 files)

The cherry-pick of a9c0cd5438 produced two conflicts, both resolved by merging rather than overwriting:

  1. core/elements.ts (content): the BlockNote selectors block was added at the shared-notes export insertion point present on 3.0. No pre-existing duplicates.
  2. sharednotes/blocknote/util.ts (add/add): this file already existed on 3.0 from BlockNote - if someone clicks on a link, their name is embedded in the link #25225 with its own helpers (startBlockNoteSharedNotes, getBlockNoteEditorLocator -> BLOCKNOTE_EDITOR, enableMarkdownNotesOptions, readLinkAndCursorState, getBlockNoteLinkLocator). The two new 4.0 helpers (startSharedNotesBlockNote, getBlockNoteReadOnlyLocator) were added alongside them, keeping a single getBlockNoteEditorLocator since [data-test="notes"] .bn-editor and #bn-notes-scroll-container .bn-editor resolve to the same element on 3.0.

3.0 adaptations in sharednotes.ts

Element selectors that only exist under their 4.0 names were mapped to the 3.0 client conventions (verified against the 3.0 html5 source): sharedNotesSidebarButton -> sharedNotes, messagesSidebarButton -> chatButton, the lock flow uses manageUsers + lockViewersButton (the 3.0 lock-viewers modal has no participant-permissions tab), and the make-presenter flow uses userListItem -> makePresenter.

Validation

Validated against a BBB 3.0 from-source environment running the branch:

  • typecheck: 0 errors
  • eslint: clean
  • new BlockNote suite: 8 of 9 tests pass
  • existing 3.0 blocknote suites (link/cursor + 12 markdown): pass, no regression from the util.ts merge

Known limitation (pin/unpin test)

The 9th test, "Pin and unpin notes onto whiteboard", is kept as test.fixme on 3.0. The viewer whiteboard is not restored to the presenter presentation state after the presenter unpins the shared notes (observed consistently across 3 runs on 3.0, while the same scenario passes on 4.0). Whether this is a genuine 3.0 sync gap or a test-adaptation issue is not yet determined, so the scenario is reported as a known limitation rather than a passing case. The make-presenter / second-unpin path in the test body is therefore not exercised while the test is skipped.

…#25165)

Backport of bigbluebutton#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 bigbluebutton#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.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds BlockNote-specific selectors and toolbar targeting, expands shared-notes Playwright coverage, and refactors BlockNote and Etherpad suites to initialize pages per test. New scenarios cover formatting, PDF export, collaboration, read-only access, whiteboard conversion, and pinning. Failed tests now attach browser videos before contexts close.

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

Sequence Diagram(s)

sequenceDiagram
  participant PlaywrightTest
  participant BlockNoteSharedNotes
  participant SharedNotesUI
  participant ExportEndpoint
  participant Whiteboard

  PlaywrightTest->>BlockNoteSharedNotes: Initialize BlockNote shared notes
  BlockNoteSharedNotes->>SharedNotesUI: Open and edit notes
  SharedNotesUI-->>BlockNoteSharedNotes: Return editor content and formatting state
  BlockNoteSharedNotes->>ExportEndpoint: Request PDF export
  ExportEndpoint-->>BlockNoteSharedNotes: Return export request
  BlockNoteSharedNotes->>Whiteboard: Convert or pin notes
  Whiteboard-->>BlockNoteSharedNotes: Show slide or pinned text
Loading

Suggested reviewers: guileme

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The video-attachment fixture change and Etherpad spec refactor are not required by #25125. Move the generic fixture change and Etherpad refactor to a separate PR unless they are needed for this backport.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: backported BlockNote shared notes e2e tests.
Description check ✅ Passed The description matches the changeset and explains the BlockNote backport and selector update.
Linked Issues check ✅ Passed The PR adds and adapts shared-notes tests for BlockNote, satisfying the linked issue's goal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.9% 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: 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/core/setup/fixtures.ts`:
- Around line 9-21: Update the auto fixture callback to depend on the Playwright
context fixture, ensuring teardown runs while the test context is available.
Replace the browser.contexts() discovery in the video collection flow with the
injected context while preserving video collection before context closure and
subsequent cleanup.

In `@bigbluebutton-tests/playwright/sharednotes/blocknote/sharednotes.ts`:
- Around line 248-263: Update the assertions on modEditorLocator and
userEditorLocator to verify the editors’ complete normalized text equals
“Jello,” rather than merely containing it. Preserve the existing synchronization
and timeout behavior while ensuring a failed Control+A replacement, such as
“HelloJello,” does not pass.
- Around line 107-114: Update the PDF export flow around the current request
wait and export click to wait for the matching response instead of only request
dispatch. Follow the validation pattern used by exportEmptyNotesAsPDF(),
asserting a successful response status and PDF content type while preserving the
existing endpoint matching and click behavior.
🪄 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: e729d01c-8268-4fb9-adcf-5cfa6285dae7

📥 Commits

Reviewing files that changed from the base of the PR and between 771cee6 and 9ccf337.

📒 Files selected for processing (7)
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-tests/playwright/core/elements.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

Comment on lines +9 to 21
async ({ browser }, use, testInfo) => {
// Before test
await use();
// After test
// After test — collect video refs before closing (videos finalize on context close)
const contexts = browser.contexts();
const videos: Video[] = [];
for (const ctx of contexts) {
for (const pg of ctx.pages()) {
const v = pg.video();
if (v) videos.push(v);
}
}
await Promise.all(contexts.map((context) => context.close()));

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
ast-grep outline bigbluebutton-tests/playwright/core/setup/fixtures.ts --view expanded
rg -nP --type=ts -C2 \
  "from ['\"].*/core/setup/fixtures['\"]|async\s*\(\{[^}]*\b(page|context)\b" \
  bigbluebutton-tests/playwright

Repository: bigbluebutton/bigbluebutton

Length of output: 50384


🏁 Script executed:

sed -n '1,120p' bigbluebutton-tests/playwright/core/setup/fixtures.ts

Repository: bigbluebutton/bigbluebutton

Length of output: 1407


🌐 Web query:

Playwright test fixture teardown order auto fixture depends on context browser context pages video attachment teardown order

💡 Result:

In Playwright, fixture execution follows a strict dependency-based order [1][2][3]. For any given fixture, the setup phase occurs before the test or hook that requires it, and the teardown phase occurs after the fixture is no longer needed [1][4]. Key principles governing the teardown order: 1. Dependency Ordering: If fixture A depends on fixture B, B is set up before A, and B is torn down after A [1][5]. 2. LIFO (Last-In, First-Out) Teardown: Teardown generally proceeds in the reverse order of setup [2]. When multiple fixtures are torn down, those with narrower scopes (e.g., test-scoped) are typically torn down before those with broader scopes (e.g., worker-scoped) if they were initialized later [1][4]. 3. Scope Impact: - Test-scoped fixtures (like page and context) are torn down after each test [1][6]. - Worker-scoped fixtures (like browser) are torn down only when the worker process finishes [1][6]. Relationship to Context, Pages, and Videos: - Browser Context and Pages: The page fixture depends on the context fixture [7]. Consequently, the page is torn down before the context is torn down [1][4]. - Video Attachments: Video files are finalized and saved upon the closure of the browserContext [8]. Because the context fixture's teardown is responsible for closing the context, the video is generated and finalized as part of that teardown process [8]. - Auto Fixtures: Automatic fixtures (fixtures with auto: true) are set up before any test-specific or hook-specific fixtures [4][2]. During teardown, they are processed in the reverse order, meaning they are torn down after manual fixtures that were requested by the test [2]. Standard Teardown Sequence (Simplified): 1. Test body finishes [2]. 2. afterEach hooks run [2]. 3. Manual test-scoped fixtures are torn down [2]. 4. Auto test-scoped fixtures are torn down [2]. 5. context fixture is torn down (which closes the context and finalizes associated videos) [1][4][8]. 6. afterAll hooks run [2]. 7. Worker-scoped fixtures (e.g., browser) are torn down when the worker shuts down [4][2].

Citations:


🌐 Web query:

Playwright fixtures teardown order dependency auto fixture context page browser docs

💡 Result:

In Playwright, fixture execution and teardown follow a deterministic, dependency-based order. Execution Order and Dependency Rules: 1. Setup and Teardown: Each fixture is defined by a setup phase (before await use) and a teardown phase (after await use) [1][2][3]. The teardown code runs regardless of whether the test passes or fails [3]. 2. Dependency Order: If fixture A depends on fixture B, Playwright ensures B is set up before A [1][2][4]. Consequently, teardown occurs in the reverse order: A is torn down before B [1][5][3]. 3. Lazy Initialization: Non-automatic fixtures are initialized lazily, only when they are requested by a test or another active fixture [1][2][4]. 4. Scoping: Test-scoped fixtures are torn down after each test [1][2][4]. Worker-scoped fixtures (like the browser) are torn down only when the worker process finishes [1][2][3]. Automatic (Auto) Fixtures: Automatic fixtures (configured with { auto: true }) are set up for every test or worker, even if not explicitly requested by the test [1][2][3]. However, a known behavior is that an auto-fixture must be connected to the active fixture graph to execute—meaning it must either depend on a core fixture (like context or page) or be part of a dependency chain linked to the test [6]. Context, Page, and Browser: These are built-in fixtures [7][8]. - Browser (Worker-scoped): Initialized once per worker process and torn down at the end [1][8]. - Context and Page (Test-scoped): A new BrowserContext and Page are created for every test to ensure isolation, and they are torn down after each test finishes [7][8]. When multiple fixtures (including auto and manual) are used, Playwright resolves the entire graph, initializes all dependencies in the correct order, and tears them down in the exact reverse order [5][3]. Always ensure that teardown code following await use is properly awaited; failure to do so can result in race conditions or state leakage [9].

Citations:


Make this fixture depend on context.
Without that dependency, Playwright can tear down the test context before this auto fixture runs, so browser.contexts() may be empty and failed-test videos won't attach.

🤖 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/core/setup/fixtures.ts` around lines 9 - 21,
Update the auto fixture callback to depend on the Playwright context fixture,
ensuring teardown runs while the test context is available. Replace the
browser.contexts() discovery in the video collection flow with the injected
context while preserving video collection before context closure and subsequent
cleanup.

Comment on lines +107 to +114
const [request] = await Promise.all([
this.modPage.page.context().waitForEvent('request', {
predicate: (req) => req.url().includes('/hocuspocus/api/documents/') && req.url().includes('/export/pdf'),
timeout: ELEMENT_WAIT_EXTRA_LONG_TIME,
}),
this.modPage.waitAndClick(e.exportNotesAsPDF),
]);
await expect(request.url(), 'should request the PDF export endpoint').toContain('/export/pdf');

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Validate the PDF response, not only request dispatch.

This passes even when export returns an error or non-PDF body. Wait for the matching response and assert its status and content type, as already done by exportEmptyNotesAsPDF().

Proposed fix
-    const [request] = await Promise.all([
-      this.modPage.page.context().waitForEvent('request', {
-        predicate: (req) => req.url().includes('/hocuspocus/api/documents/') && req.url().includes('/export/pdf'),
+    const [response] = await Promise.all([
+      this.modPage.page.context().waitForEvent('response', {
+        predicate: (res) => res.url().includes('/hocuspocus/api/documents/')
+          && res.url().includes('/export/pdf'),
         timeout: ELEMENT_WAIT_EXTRA_LONG_TIME,
       }),
       this.modPage.waitAndClick(e.exportNotesAsPDF),
     ]);
-    await expect(request.url(), 'should request the PDF export endpoint').toContain('/export/pdf');
+    expect(response.status(), 'PDF export should succeed').toBe(200);
+    expect(response.headers()['content-type'] || '').toContain('application/pdf');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const [request] = await Promise.all([
this.modPage.page.context().waitForEvent('request', {
predicate: (req) => req.url().includes('/hocuspocus/api/documents/') && req.url().includes('/export/pdf'),
timeout: ELEMENT_WAIT_EXTRA_LONG_TIME,
}),
this.modPage.waitAndClick(e.exportNotesAsPDF),
]);
await expect(request.url(), 'should request the PDF export endpoint').toContain('/export/pdf');
const [response] = await Promise.all([
this.modPage.page.context().waitForEvent('response', {
predicate: (res) => res.url().includes('/hocuspocus/api/documents/') && res.url().includes('/export/pdf'),
timeout: ELEMENT_WAIT_EXTRA_LONG_TIME,
}),
this.modPage.waitAndClick(e.exportNotesAsPDF),
]);
expect(response.status(), 'PDF export should succeed').toBe(200);
expect(response.headers()['content-type'] || '').toContain('application/pdf');
🤖 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 107 - 114, Update the PDF export flow around the current request wait and
export click to wait for the matching response instead of only request dispatch.
Follow the validation pattern used by exportEmptyNotesAsPDF(), asserting a
successful response status and PDF content type while preserving the existing
endpoint matching and click behavior.

Comment on lines +248 to +263
// user waits for mod's text to sync, then selects all and replaces
await expect(userEditorLocator, 'should sync mod content to user before editing').toContainText('Hello', {
timeout: ELEMENT_WAIT_TIME,
});
await userEditorLocator.click();
await userEditorLocator.press('Control+A');
await userEditorLocator.pressSequentially('Jello');

await expect(modEditorLocator, 'should the shared notes contain the text "Jello" for the moderator').toContainText(
/Jello/,
{ timeout: ELEMENT_WAIT_TIME },
);
await expect(userEditorLocator, 'should the shared notes contain the text "Jello" for the attendee').toContainText(
/Jello/,
{ timeout: ELEMENT_WAIT_TIME },
);

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that the content was replaced completely.

toContainText(/Jello/) also passes for HelloJello, so a failed Control+A replacement remains undetected. Assert exact normalized text on both editors.

Proposed fix
-    ).toContainText(
-      /Jello/,
+    ).toHaveText(
+      'Jello',
       { timeout: ELEMENT_WAIT_TIME },
     );
🤖 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 248 - 263, Update the assertions on modEditorLocator and userEditorLocator
to verify the editors’ complete normalized text equals “Jello,” rather than
merely containing it. Preserve the existing synchronization and timeout behavior
while ensuring a failed Control+A replacement, such as “HelloJello,” does not
pass.

@antobinary antobinary added this to the Release 3.0 milestone Jul 17, 2026
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@ramonlsouza
ramonlsouza merged commit 19bd7e5 into bigbluebutton:v3.0.x-develop Jul 20, 2026
35 of 36 checks passed
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.

BlockNote shared notes tests

3 participants