SWTBot Tests Failing on GitHub Actions macOS Because of “Welcome to Mac” (Setup Assistant Analytics)

My SWTBot UI tests recently started failing on GitHub Actions macOS runners.

The application under test is an Eclipse-based application, so at first I expected the failure to be caused by some SWTBot timing issue, focus issue, or maybe a regression in my own code.

However, the screenshot captured by the failed test showed something completely unrelated to my application:

That is not Eclipse. That is macOS Setup Assistant.

More specifically, it was the macOS Analytics screen asking whether to share analytics data with Apple and app developers. Since SWTBot drives the UI that currently has focus, this dialog was stealing focus from Eclipse and making the test interact with the wrong window.

The first workaround

My first attempt was to dismiss the Analytics dialog before starting the SWTBot tests:

This looked reasonable, but then the failure changed.

The new screenshot showed another Setup Assistant page:

This time it was the “Welcome to Mac” screen.

So the script was managing to click something, but Setup Assistant was still not completely gone. SWTBot was still losing focus before the actual Eclipse application could be tested.

The final workaround

The most robust fix was to avoid heredocs entirely and pass the AppleScript using repeated osascript -e arguments.

Here is the workflow step I now use:

This does three things:

  1. It checks whether Setup Assistant is running.
  2. It tries to press the visible Continue button.
  3. If Setup Assistant still refuses to disappear, it kills the process before the UI tests start.

After adding this step before launching Eclipse, the SWTBot tests started passing again.

Why this matters for SWTBot

SWTBot tests are particularly sensitive to focus problems.

They do not just test some isolated backend logic. They drive a real UI. If another native macOS window appears in front of the Eclipse workbench, the test can fail in confusing ways:

The actual problem may have nothing to do with SWTBot or Eclipse. The test may simply be interacting with the wrong application.

That is why screenshots from failed UI tests are invaluable. Without the screenshot, I would probably have spent a lot more time debugging Eclipse, SWTBot, or my own application.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.