diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 64d36fe..b553632 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,5 +73,8 @@ jobs: sudo xcodebuild -downloadPlatform iOS fi + # UI_TEST_ITERATIONS opts this run into xcodebuild's retry-on-failure (see + # the Makefile): a flaky simulator launch gets a second attempt instead of + # failing the merge, while a real regression still fails both. - name: Run UI tests - run: make test-ui + run: make test-ui UI_TEST_ITERATIONS=2 diff --git a/Makefile b/Makefile index 84a0010..4f5bf15 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,16 @@ SIMULATOR_NAME ?= iPhone 17 # of the same simulator. DESTINATION ?= platform=iOS Simulator,name=$(SIMULATOR_NAME),arch=arm64 +# XCUITests drive a booted simulator, so a single failure is as often the runner +# having a bad minute as it is a real regression β€” a cold first launch on a +# loaded runner has timed out on its own. `-retry-tests-on-failure` re-runs only +# the tests that failed and lets the run pass if the retry passes; a genuinely +# broken test still fails every attempt, so this hides flake without hiding +# regressions. Empty by default so a local run reports the first failure +# straight away β€” CI opts in. +UI_TEST_ITERATIONS ?= +UI_RETRY_FLAGS := $(if $(UI_TEST_ITERATIONS),-retry-tests-on-failure -test-iterations $(UI_TEST_ITERATIONS),) + # On-device deploy (paid Apple Developer Program membership). Profiles are good # for a year, so `make deploy` is only needed when you want new code on the # phone β€” plugged in, or paired over Wi-Fi. DEVICE_ID comes from @@ -206,7 +216,8 @@ test-ui: set -o pipefail; $(XCODEBUILD) test \ -project $(PROJECT) -scheme $(SCHEME) \ -destination '$(DESTINATION)' \ - -only-testing:$(UI_TARGET) $(FORMATTER) + -only-testing:$(UI_TARGET) \ + $(UI_RETRY_FLAGS) $(FORMATTER) ## test-all: run unit + UI tests together .PHONY: test-all diff --git a/MemoryEchoUITests/MemoryEchoUITests.swift b/MemoryEchoUITests/MemoryEchoUITests.swift deleted file mode 100644 index 6b7a4ec..0000000 --- a/MemoryEchoUITests/MemoryEchoUITests.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// MemoryEchoUITests.swift -// MemoryEchoUITests -// -// Created by Matt Nitzken on 6/24/26. -// - -import XCTest - -final class MemoryEchoUITests: XCTestCase { - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests - // before they run. The setUp method is a good place to do this. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - @MainActor - func testExample() { - // UI tests must launch the application that they test. - let app = XCUIApplication() - app.launch() - - // Use XCTAssert and related functions to verify your tests produce the correct results. - // XCUIAutomation Documentation - // https://developer.apple.com/documentation/xcuiautomation - } - - @MainActor - func testLaunchPerformance() { - // This measures how long it takes to launch your application. - measure(metrics: [XCTApplicationLaunchMetric()]) { - XCUIApplication().launch() - } - } -}