Repository navigation
test: cover webContents editing commands, device emulation and menu roles - #55903
Merged
Merged
Conversation
…oles Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
dsanders11
approved these changes
Nov 18, 2026
dsanders11
marked this pull request as ready for review
November 18, 2026 07:19
- Make sampleColor() report 'red' or 'green' only for a clearly red or green pixel, independent of BGRA/RGBA channel order, so an unpainted page no longer counts as a frame. - Wait for the first frame before sampling the noAnimation case, and fail it only if the green frame is ever painted. - Run setImageAnimationPolicy() serially since it captures the screen. - Give the toggleDevTools() and worker inspection tests a fresh persisted partition each, so they never inherit an undocked dock state from the default session's Preferences and always dock into the hidden window. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
Contributor
Author
There was a problem hiding this comment.
LGTM. I reviewed this from a standalone clone, and commit 7b9594c fixes all three issues from my earlier review. I found nothing new.
setImageAnimationPolicy()is now in a{ tags: ['serial'] }suite.sampleColornow counts a pixel as 'red' or 'green' only when the other channels are low, so unpainted white comes back as 'other'. The 'noAnimation' test also waits for the red frame before it starts sampling.toggleDevTools()tests now use a freshpersist:<name>-<uuid>partition, so they start without an inherited undocked state. Every other new test that needs focus, the clipboard orcapturePageis in a serial suite.- I did not run the specs. Whether the new DevTools and pixel-sampling tests are reliable on every platform will only show in CI.
Extended reasoning...
The change only adds tests: about 546 lines across spec/api-web-contents.spec.ts and spec/api-menu-item.spec.ts, with no production code or security-sensitive code. The latest commit addresses the three inline comments from my earlier review: the serial tag on the image animation suite, stricter color classification, and persisted per-test DevTools partitions. No CODEOWNERS entry covers spec/, and the bug hunt finished with no findings.
jkleinsc
approved these changes
Nov 18, 2026
|
No Release Notes |
Contributor
|
I have automatically backported this PR to "46-x-y", please check out #55925 |
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by David Babenko-Sanders · Slack thread
Description of Change
These specs cover the
webContentsediting commands, device emulation, image animation policy and menu role actions that the C++ coverage report showed as unexercised. A new serial "editing commands" suite inapi-web-contents.spec.tsdrives a focused textarea and checks its value and selection afterselectAll(),unselect(),delete(),undo()/redo(),cut(),copy(),paste()andreplace()(both with a selection and with only a caret inside a word), checks thatpasteAndMatchStyle()drops the bold markup thatpaste()keeps in a contenteditable, and checks thatscrollToBottom()andscrollToTop()move a tall page to its end and back. A device emulation test checks thatenableDeviceEmulation()with a mobile screen changes the screen size,devicePixelRatioand layout viewport the page sees and thatdisableDeviceEmulation()restores them, and twosetImageAnimationPolicy()tests capture a looping red/green GIF to show it animates by default and stays on its first frame with'noAnimation'. Inapi-menu-item.spec.ts, the "MenuItem role execution" suite now runs the undo, redo, cut, copy, paste, pasteAndMatchStyle, delete and selectAll roles against a textarea, and checks that the close role closes the window, togglefullscreen enters and leaves fullscreen, zoomIn/zoomOut/resetZoom change the zoom level and toggleSpellChecker flips the session's spellchecker setting; the edit and window roles are skipped on macOS, where they are handled natively. The minimize role is left out because minimizing does not work on Linux CI (the existing Windows-only test still covers it), andreplaceMisspelling()because it could not be validated in this environment.centerSelection()is covered by the fix PR #55909, which makes it work on Windows and Linux and adds a cross-platform test for it. For DevTools, new tests check thattoggleDevTools()opens closed DevTools and closes open ones, thatisDevToolsFocused()is false while DevTools are closed, true once detached or docked DevTools take focus in a shown window and false again after they close (in a serial suite), and thatinspectSharedWorker()andinspectServiceWorker()open DevTools for a shared worker and a service worker started from a page on a local HTTP server. Because DevTools specs time out under the spec runner in this container (an existingsetDevToolsTitle()test does too), these were validated with a standalone Electron script that makes the same calls and assertions. The new specs were validated passing 3× in a row against 47.0.0-nightly.20261117, with no regressions in the rest ofapi-web-contents.spec.tsorapi-menu-item.spec.ts.Checklist
Release Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm
Notes: none