Repository navigation
test(e2e): pin desktop window size; route AceEditor through activeEditor - #17788
Merged
Merged
Conversation
avoids dualwindowlayoutpanel auto-snapping the left column to maximize on the small (~1024x645) macos gh actions virtual display, which was hiding the source pane and breaking edit_suggestions tests.
empty-marker AceEditor was scanning .ace_editor DOM nodes and picking the first non-console match -- same stale-editor bug fixed in ad175dc (#17775) for openFile/getEditorContent and f84e454 (#17784) for autocomplete actions. on tests with a single open file the marker '' would trivially match, but the matched node could be a stale editor left in the DOM after a tab close rather than the live active editor. route empty marker through window.rstudio.documents.activeEditor() and keep the DOM-walk path for non-empty markers (still useful when a test needs a specific non-active tab).
the previous shape stringified the user's callback via fn.toString() and
reconstituted it in the browser with (0, eval)('(' + fnSource + ')').
that was the only way to ferry an arbitrary user function across the
node->browser boundary through page.evaluate's single-arg form.
replace it with page.evaluateHandle to resolve the editor once, then call
handle.evaluate with the user's function natively (playwright serializes
the function itself, no eval). overload run() so callers that pass no arg
stay typed; callers that need multiple args wrap in an object.
no behavior change for callers; the eval was a workaround the bridge has
since obsoleted.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
Two related fixes for flakes surfaced by the full e2e run on #17785 (3 unique edit_suggestions failures on macOS GH Actions).
desktop.fixture.ts. The schema default (1200x900) gets clamped bypositionAndEnsureVisibleto the runner's small virtual display (~1024x645), which drops the left column's source pane underDualWindowLayoutPanel's 60px snap threshold. The layout then promotes the Console to MAXIMIZE state and the source pane visually disappears, breaking any test that types into it.positionAndEnsureVisibleaccepts requested bounds that intersect any display.workArea as-is, so 1400x900 at the origin sticks even on narrow virtual displays.AceEditorthrough thewindow.rstudio.documents.activeEditor()bridge. Same stale-editor bug fixed foropenFile/getEditorContent(ad175dc / test(e2e): expose active ace editor via automation bridge #17775) andgetCompletionsInEditor(test(e2e): use activeEditor bridge in autocomplete actions #17784). Empty marker would trivially match any editor's value, so the DOM walk could land on a stale editor left in the DOM after a tab close. Non-empty markers keep the DOM-walk path (still needed for targeting non-active tabs).eval-basedrunOnEditorwhile in there. The previous shape stringified the user callback viafn.toString()and reconstituted it in the browser with(0, eval)('(' + fnSource + ')')to work aroundpage.evaluate's single-arg signature. Replace withpage.evaluateHandle+handle.evaluate, which serializes the function natively.Test plan
panes/editor/edit_suggestions.test.ts >> ghost text suggestions can be prefix-matchedpanes/editor/edit_suggestions.test.ts >> ghost text moves on document editpanes/editor/edit_suggestions.test.ts >> ghost text is cleared from old row when newline inserted abovepanes/layout/panes.test.tsratio-based width assertions still pass with a wider viewport (10% tolerance).new AceEditor(page, '')callers intests/panes/editor/reformat.test.tsandtests/panes/editor/rmarkdown.test.ts.npm run typecheckpasses locally.