Skip to content

stabilize layoutZoomEnvironment e2e test and break the zoom cascade - #17832

Merged
kevinushey merged 1 commit into
mainfrom
test/stabilize-layout-zoom-e2e
Jun 3, 2026
Merged

kevinushey merged 1 commit into
mainfrom
test/stabilize-layout-zoom-e2e

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Intent

Stabilize the layoutZoomEnvironment Playwright spec and stop it from
poisoning later specs in the same worker. Three desktop e2e failures were
observed together:

  • tabs.test.ts -> layoutZoomEnvironment zoom/toggle poll timeout
  • packages_pane.test.ts -> checkbox click timeout ("not visible")
  • packages_pane.test.ts -> initial checkbox state

There is no tracking issue; this addresses CI flakiness only. No product
behavior changes for users -- the only product-side addition is an
automation-only bridge surface (window.rstudio.layout.reset()), active just
under --automation-agent.

Root cause

The Playwright suite runs with workers: 1 and a worker-scoped
rstudioPage, so every spec shares one RStudio window. resetForNextTest
reset modals, debug mode, and the source pane, but never cleared pane
zoom
. When the layoutZoomEnvironment spec failed before toggling the zoom
back off, the Environment pane stayed maximized -- which collapses the
Packages pane (same right column) to <50px. The following packages_pane
specs then ran against a zero-size checkbox, so click() / toBeVisible()
timed out. The three failures were one cascade, not three bugs.

Separately, the layoutZoomEnvironment assertions themselves were fragile:
envWidth > initialEnvWidth * 1.5 couples the assertion to the default column
proportions. On a CI display where the Source/Console column starts narrow
(the snap-threshold case the 1400x900 window-bounds pin guards against), the
Environment column is already wide, so zooming grows < 1.5x and the poll's
predicate is simply never true. PaneManager has not changed since this test
last passed, so this is a test-assertion issue, not a product regression.

Changes

  • Bridge: add window.rstudio.layout.reset() (in ApplicationAutomation).
    It delegates to PaneManager.endZoomIfActive, which ends any active
    pane/window or column zoom only when something is zoomed (a non-zoomed
    layout keeps its custom column widths). It returns a Promise that resolves
    once the relayout has settled -- the restore flushes on a later animation
    frame even under reduced_motion -- by threading a completion callback
    through restoreLayout -> restoreSavedLayout / restorePaneLayout.
  • Reset: resetForNextTest now un-zooms via the bridge, and tabs.test.ts
    un-zooms in an afterEach, so a failed zoom spec can't poison the next one.
  • Assertions: rewrite the layoutZoomEnvironment test to verify the zoom
    invariants -- the deterministic command-checked state, the collapse of the
    Console / TabSet2 panes, and a tolerance-based restore -- instead of a growth
    ratio (matching how panes.test.ts verifies its column-zoom tests). Adds a
    loud precondition so a contaminated/too-small starting layout fails clearly
    at setup rather than as a mystery poll timeout.

Validation

  • tsc --noEmit clean (e2e)
  • ant javac clean (GWT)
  • End-to-end run of the affected specs deferred to CI (the bridge change needs
    a GWT + desktop build to exercise).

The worker-scoped automation session shares one RStudio window across all
specs, and resetForNextTest never cleared pane zoom. A layoutZoomEnvironment
test that failed before toggling back left the Environment pane maximized,
which squeezed the Packages pane to near-zero and made the following
packages_pane specs' checkbox clicks time out as "not visible".

- add window.rstudio.layout.reset() to the automation bridge; it ends any
  active pane/column zoom only when something is zoomed (so non-zoomed layouts
  keep their column widths) and returns a Promise that resolves once the
  relayout settles (the restore flushes on a later animation frame even under
  reduced_motion). PaneManager.endZoomIfActive threads a completion callback
  through restoreLayout.
- call it from resetForNextTest and from an afterEach in tabs.test.ts so a
  leaked zoom can't poison the next spec.
- rewrite the layoutZoomEnvironment assertions to test the zoom invariants
  (command-checked state + collapse of the other panes + tolerance restore)
  instead of a 1.5x growth ratio that coupled the test to the default column
  proportions and failed on smaller CI displays.
@kevinushey kevinushey added this to the Blue Plumbago milestone Jun 2, 2026
@kevinushey
kevinushey merged commit 03549ec into main Jun 3, 2026
8 checks passed
@kevinushey
kevinushey deleted the test/stabilize-layout-zoom-e2e branch June 3, 2026 17:48
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.

1 participant