Skip to content

test(tabs): drive the tab reorder tests with a gesture the strip can receive - #2546

Merged
datlechin merged 1 commit into
mainfrom
fix/tab-reorder-ui-tests
Aug 27, 2026
Merged

test(tabs): drive the tab reorder tests with a gesture the strip can receive#2546
datlechin merged 1 commit into
mainfrom
fix/tab-reorder-ui-tests

Conversation

@datlechin

Copy link
Copy Markdown
Member

EditorTabReorderUITests has failed on every CI run since it landed in #2472, whose own run was
cancelled, so it has never passed. All four cases fail on CI and one fails locally.

The strip itself is fine. The suite drove it in a way that cannot work.

What was wrong

The drag started outside the viewport. testDraggingATabReordersAnOverflowingStrip opens eight
tables so the track scrolls, then dragged before[0]. Once the track scrolls, the leading and
trailing tabs are half outside the viewport and stay in the accessibility tree at frames the pointer
cannot land on, so the press never reached the strip. That is what the local failure reported, in
its own words: "The dragged tab must be hittable".

Measured with temporary logging inside updateReorder, over a full run of the suite:

drag callbacks commits
before, non-overflowing (tabWidth 186) 172 3
before, overflowing (tabWidth 120) 0 0
after, overflowing 55 4

Zero callbacks is the whole story: the gesture never began, so nothing downstream could have
reordered anything.

The assertion raced the animation. Every case slept a flat second after the gesture and then
compared the order once. The strip animates the move and commits on release, so on a loaded machine
that read the pre-drag order and reported a working reorder as broken. That fits the CI signature
exactly: the three non-overflowing cases pass locally and fail on CI with the order unchanged.

What changed

  • Drag interior tabs, never the ones at the edges of a scrolled track.
  • Wait for the order to change (waitForTabOrder(toChangeFrom:in:)) instead of sleeping. A sleep
    long enough for CI is dead time on every local run; one short enough locally reads the wrong
    order on CI.
  • Choose the source and target from tabs that are actually hittable, which is what fixes the
    original failure.

Also fixed

TextLayoutManager.layoutLines built its invalidation rect with layoutView?.frame.width ?? 0, and
CGRect.union returns the other operand when one is empty. An unparented or zero-width layout view
therefore left the rect null and silently skipped the repaint, which is the defect that
invalidation exists to prevent. It now accumulates a vertical span and builds the rect once, from
the view it is about to invalidate. Found by an audit of #2542 rather than by a failure.

Verification

  • EditorTabReorderUITests: 8 executed, 8 passed, 0 failed.
  • swift test --package-path LocalPackages/CodeEditTextView: 190 passed.
  • The before-and-after callback counts above come from instrumentation that was removed before
    this branch was cut.

@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 890a634 into main Aug 27, 2026
3 checks passed
@datlechin
datlechin deleted the fix/tab-reorder-ui-tests branch August 27, 2026 03:06
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