Skip to content

mcp-server.spec.ts opens the canvas-controls menu unconditionally — the last site of the #997 class #1087

Description

@Victor-w-Madeira

Follow-up of #1053, which extracted tests/helpers/ui/canvas-controls.ts and
adopted it at the four helper/POM sites. This is the fifth site of the same
defect class, and the only one that lives in a spec — deliberately left out of
that PR: it is @stable MCP coverage, so touching it means validating an MCP
server flow E2E, a cost that does not belong to a helper refactor (one issue, one
PR).

The site

tests/tests-automations/regression/mcp/server/mcp-server.spec.ts:643-648:

await page.getByTestId("canvas_controls_dropdown").click();   // ← unconditional open

await page.getByTestId("fit_view").click();

await zoomOut(page, 3);

// zoomOut() already toggles the canvas-controls menu closed. The previous
// extra click({ force: true }) here re-opened it, leaving the Radix zoom
// menu overlay on screen where it intercepted the mcp-server-dropdown click
// ("<html> intercepts pointer events"). Ensure the menu is fully closed
// before interacting with the MCP node.
await page.keyboard.press("Escape");
await expect(page.getByTestId("zoom_out")).toBeHidden();

Two things are worth noting about it:

  1. The open is unconditional — the same shape upload-file.ts carried
    (Three more canvas-controls toggles carry the #997 defect — extract the postcondition helper #1053). If the menu is already open on entry, that first click closes it,
    fit_view is then gone, and the spec dies on a click timeout.
  2. The comment documents a real past breakage of the Fix mcp-server.spec.ts: canvas-controls menu left open intercepts mcp-server-dropdown click #576 class, and the
    Escape + toBeHidden() pair is the workaround that was left behind. It also
    encodes an assumption that is no longer the contract: zoomOut() no longer
    toggles anything — after Three more canvas-controls toggles carry the #997 defect — extract the postcondition helper #1053 it asserts a postcondition (menu closed,
    whoever opened it), read off the trigger's data-state.

What the fix looks like

The whole sequence — open if needed, fit the view, zoom out N, leave the menu
closed — is exactly one call:

await adjustScreenView(page, { numberOfZoomOut: 3 });

That removes the unconditional open, the duplicated fit-view step, and makes the
Escape + toBeHidden() belt-and-braces redundant. Whether to delete those two
lines or keep them as a cheap explicit gate is a judgement call for whoever picks
this up — they cost little and they guard a failure that actually happened.

Done when

  • The hand-rolled sequence is replaced by adjustScreenView
  • A decision is recorded on the trailing Escape + toBeHidden() (kept or dropped, with the reason)
  • The spec is validated E2E against the current nightly, --retries=0, and keeps @stable

Notes

  • Read tests/helpers/ui/canvas-controls.ts first — the live-verified DOM
    contract (Radix data-state, controls rendered inside DropdownMenuContent,
    plain Buttons that do not dismiss the menu) and the rejected alternatives are
    written down there.
  • This is the last known site of the class; a repo-wide grep for
    canvas_controls_dropdown after Three more canvas-controls toggles carry the #997 defect — extract the postcondition helper #1053 returns only this spec plus the three
    readiness gates (setup-blank-flow, setup-playground,
    load-template-by-name) that wait on the testid without ever clicking it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upApproved exception: follow-up of merged work (ROADMAP Intake)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions