Skip to content

test(hig): skip the inspector toolbar placement test on a screen too narrow to host it - #2231

Merged
datlechin merged 1 commit into
mainfrom
fix/inspector-toolbar-test-preconditions
Aug 19, 2026
Merged

test(hig): skip the inspector toolbar placement test on a screen too narrow to host it#2231
datlechin merged 1 commit into
mainfrom
fix/inspector-toolbar-test-preconditions

Conversation

@datlechin

Copy link
Copy Markdown
Member

What this fixes

InspectorToolbarPlacementUITests fails on every CI run with "No inspector toggle in the toolbar", and has never passed there. It arrived with #2221, whose own and only CI run failed on it, and it has failed on every pull request since, including ones that do not touch the toolbar. It passes on a real display.

Root cause

Measured from the runner's own element tree, exported from the macos-ui-test-results artifact of run 32221079561 rather than inferred:

  • The runner is a virtual machine with a 1024x768 screen: MenuBar, {{0.0, 0.0}, {1024.0, 30.0}}.
  • The test pins the window to 1512x861, which does not fit, so AppKit places it at x = -244: Toolbar, {{-244.0, 31.0}, {1512.0, 52.0}}.
  • The toolbar's trailing items collapse into the overflow menu. Its last visible children are Button label: 'Open Quickly' and then PopUpButton label: 'more toolbar items'.
  • The whole tree contains exactly one "Inspector": MenuItem, identifier: 'shortcut.toggleInspector', title: 'Show Inspector', which is the View menu. There is no toggle in the toolbar to find.

So the pin meant to stop the toolbar overflowing is what causes it, because it is wider than the screen it runs on. The test's own comment anticipated the failure mode ("a restored frame narrow enough to overflow the toolbar would move the last item") without noticing that pinning a frame the screen cannot hold produces exactly that.

The fix

Skip when the screen cannot hold the pinned window. The requirement is derived from the same constant that builds the pin, so the two cannot drift, and it is width only: the failure is horizontal, and the menu bar and Dock take height rather than toolbar room. On a display wide enough the test runs exactly as before; on the CI runner it reports a skip that says what it needs and why.

This is a precondition, not a quarantine: nothing is added to .github/macos-ui-test-quarantine.txt, and the test starts running again by itself the day the runner gets a wider screen.

Also fixed: the language pin never worked

The test pinned AppleLanguages because the only handle on the toggle is the label AppKit gives its own standard item, which is localized. It passed it in launchEnvironment, where nothing reads it: AppleLanguages is a defaults key and only takes effect as a launch argument. The match worked only because both machines happened to be running in English.

UITestCase.launchApp and launchWithSampleDatabase now take arguments: alongside environment:, and the test passes -AppleLanguages (en) there. Both parameters default to empty, so no other suite changes.

Verified

  • verify.sh uitest InspectorToolbarPlacementUITests on unmodified origin/main: PASS, 2 cases. That is the measurement behind "runner-only".
  • Same after the change: PASS, 2 cases, with -AppleLanguages now actually applied.
  • The skip path was exercised rather than assumed: an intermediate version required the screen's visible frame to fit, which this display misses by two points in height, and the run reported Test skipped - Needs a screen that fits a 1512x861 window; this one is 1512x859. That is what showed the height half of the check was wrong, and it is now width only.
  • verify.sh test AppStorageEnvironmentTests MainWindowToolbarLayoutTests: PASS, 9 cases. The first is the guard that scans TableProUITests sources for suites that bypass UITestCase, which the signature change had to keep satisfying.
  • swiftlint --strict over both changed files: clean.

No CHANGELOG entry: this changes test preconditions only, and nothing about it is user-facing.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin
datlechin merged commit d3830ba into main Aug 19, 2026
8 checks passed
@datlechin
datlechin deleted the fix/inspector-toolbar-test-preconditions branch August 19, 2026 07:46
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