Skip to content

feat: fillField supports rich text editors#5527

Open
DavertMik wants to merge 4 commits into4.xfrom
feat/fill-field-editor
Open

feat: fillField supports rich text editors#5527
DavertMik wants to merge 4 commits into4.xfrom
feat/fill-field-editor

Conversation

@DavertMik
Copy link
Copy Markdown
Contributor

Summary

  • Extends fillField in Playwright, Puppeteer, and WebDriver helpers to detect and fill rich text editors automatically — no per-editor selectors hardcoded
  • Detection covers three structural shapes: contenteditable (incl. descendants), hidden-textarea (editor-owned inputs), and iframe-based editors; standard <input>/<textarea> stays on the original fast path
  • Verified against 12 real-world editors: ProseMirror, Quill, CKEditor 4/5, TinyMCE inline/legacy, CodeMirror 5/6, Monaco, ACE, Trix, Summernote
  • Shared logic lives in lib/helper/extras/richTextEditor.js; cross-helper primitives (evaluate, focus, typeText, selectAllAndDelete, inIframe) added to WebElement so a single implementation serves all three helpers
  • 48 scenarios added to test/helper/webapi.js (4 scenarios × 12 editors) — fill, rewrite pre-populated content, preserve special characters, fill multi-paragraph content — automatically exercised by Playwright/Puppeteer/WebDriver helper test suites

Test plan

  • BROWSER=chromium node_modules/.bin/mocha test/helper/Playwright_test.js --grep "rich text editors" — 48/48 passing
  • Puppeteer helper suite picks up the same scenarios via webApiTests.tests()
  • WebDriver helper suite picks up the same scenarios via webApiTests.tests()
  • No regression in existing Playwright acceptance suite

🤖 Generated with Claude Code

DavertMik and others added 4 commits April 20, 2026 01:40
Extends fillField in Playwright, Puppeteer, and WebDriver helpers to
detect and fill rich text editors automatically. Works with
contenteditable, hidden-textarea, and iframe-based editors — verified
against ProseMirror, Quill, CKEditor 4/5, TinyMCE inline/legacy,
CodeMirror 5/6, Monaco, ACE, Trix, and Summernote.

Detection and filling logic is centralized in
lib/helper/extras/richTextEditor.js and built on new WebElement
primitives (evaluate, focus, typeText, selectAllAndDelete, inIframe),
so all three helpers share one implementation.

Adds 48 rich text scenarios to the shared webapi.js test suite
(4 scenarios × 12 editors) covering basic fill, rewriting
pre-populated content, special-character preservation, and large
multi-paragraph content.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
webdriverio keys() lives on browser, not element. Route typeText and
selectAllAndDelete through helper.browser.keys() for the WebDriver
path so rich-text scenarios (hidden-textarea + iframe editors) work.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use switchFrame() instead of removed switchToFrame/switchToParentFrame.
Split typed text on \n and emit Enter keypress (\uE007) between
segments so multi-paragraph content reaches Trix and other
keystroke-driven editors.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
selectAllInEditable already focuses the body via JS; the extra click
was only there to mimic Playwright's force-click semantics. In WebDriver
the click resolved viewport coords through the iframe, so CKEditor 4's
parent-scope notification overlay intercepted it. Removing the click
makes all 48 iframe tests pass in WebDriver without affecting Playwright
or Puppeteer.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
HIDDEN_TEXTAREA: 'hidden-textarea',
}

function detectAndMark(el, opts) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks too broad for hidden elements: it climbs up to document.body and can accidentally bind an unrelated hidden field to any editor on the page

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