Skip to content

test(connections): cover reaching a saved connection without opening a window - #2624

Merged
datlechin merged 1 commit into
mainfrom
test/grouped-switcher-uitest
Sep 3, 2026
Merged

test(connections): cover reaching a saved connection without opening a window#2624
datlechin merged 1 commit into
mainfrom
test/grouped-switcher-uitest

Conversation

@datlechin

Copy link
Copy Markdown
Member

#2620 shipped the grouped switcher with no UI automation, on the grounds that seeding a fixture
needed a launch hook the app does not have. That was half wrong, so here is the half that works.

Connections are seedable: AppStorageEnvironment redirects the Application Support root into the
sandbox UITestCase prepares, and ConnectionStorage adopts a store with no integrity tag beside
it rather than refusing it, which is the path an install predating the tag takes. Writing
connections.json into the sandbox before launch is enough.

The test opens Switch Connection, activates a saved connection, and asserts the window count did
not change. That is what #1311 asked for and what #2097 promised, and nothing was covering it.

What this test does not cover, and why it cannot from here

The group the connections belong to is not seeded. Groups live in a UserDefaults suite, and the
suite name resolves per process container: the runner is sandboxed, the app is not, so the same
name is <runner container>/Data/Library/Preferences/com.TablePro.uitest.plist for the test and
~/Library/Preferences/com.TablePro.uitest.plist for the app. Both files exist on this machine.
Anything the runner writes there, the app never reads.

ConnectionSwitcherSectionsTests covers the grouping itself, and it covers it better than a UI
test would: section order, the path title of a nested group, the accent colour, the collapse under
a filter, and a group whose connections are all open.

Two things found while writing it

Every search field in the app answers to sidebar-filter.
NativeSearchField.accessibilityIdentifier defaults to that string, and 18 of its 30 call sites
take the default, including the switcher's own field, the database switcher, the welcome window and
several Settings panes. The captured element tree shows the switcher's field as
identifier: 'sidebar-filter', placeholderValue: 'Search connections'.

This is not theoretical. The first version of this test waited on app.searchFields.firstMatch,
matched the object browser's filter field, and passed while asserting nothing: the panel it
meant to drive never had to open. It only came to light because the other assertion in the same
test failed for a real reason. This test now matches on the placeholder, the way
SwitcherEscapeUITests already did.

UI test isolation for UserDefaults does not work.
UITestCase.setUpWithError clears com.TablePro.uitest so that "one test cannot read what the
last one wrote", but it clears the runner's copy while the app reads and writes its own. The app's
copy currently holds com.TablePro.sample.openedCount => 229 along with per-connection history
panel state, accumulated across every UI test run this machine has ever done. Every UI test shares
one growing defaults domain, and any test that depends on a clean one is silently reading the
previous run's.

Neither is fixed here. The first is a shared component and its 18 adopters; the second can only be
repaired from the app side, since a sandboxed runner cannot reach the domain the app uses, and that
means production code changed for a test. Both are worth their own change.

Verification

  • verify.sh generate: PASS
  • verify.sh uitest GroupedConnectionSwitcherUITests: PASS
  • swiftlint --strict on the new file: clean

No CHANGELOG entry: nothing here changes what the app does.

https://claude.ai/code/session_01L81TaoPWxkLd15CGw2riPq

@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 a5b8ae1 into main Sep 3, 2026
7 checks passed
@datlechin
datlechin deleted the test/grouped-switcher-uitest branch September 3, 2026 08:34
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