Skip to content

Commit 5dae723

Browse files
committed
test(ios-runner): branch the busy-app assertion on what the command answered
The label check ran twice over the same response: it always expected `First actions: 1`, and the block after it expected `First actions: 0` only when the answer was a deadline failure, so the second could never pass and a correct refusal failed anyway. Now the assertion follows the answer — an accepted alert must show the button press, a refused one must not — and the comment said "main thread busy" where the fixture runs a repeating animation with the main thread free. The test also joins the targeted list in `.github/workflows/ios.yml`, which is where the alert regressions it guards are selected.
1 parent cdea575 commit 5dae723

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎.github/workflows/ios.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ jobs:
187187
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testAlertCannotProveAnIdenticalReplacementAndDoesNotActivateIt \
188188
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testAlertDeadlineBeforeActivationLeavesTheOriginalUntouched \
189189
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testAlertHittableProbeCompletingAfterDeadlineLeavesTheOriginalUntouched \
190+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testAlertActivationIgnoresAnAppThatNeverSettlesBeforeTheDeadline \
190191
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testSystemModalProbeSliceSharesAndClampsToPlanDeadline \
191192
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testDispatchRecoverySkipsBookkeepingWhileXCTestChannelOccupied \
192193
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testBoundedSystemModalProbeTimeoutRecoversThenReleasesOnDrain \

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertObservationTests.swift‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,17 @@ extension RunnerTests {
7575
let response = handleAlert(alert, action: "accept", deadline: deadline)
7676
let elapsed = Date().timeIntervalSince(startedAt)
7777

78-
// The fixture keeps its main thread busy until a button is answered, so this only comes back
79-
// early because activation refused to wait for an app that has no intention of settling (#2546).
78+
// The fixture keeps an animation in flight, which is what XCTest waits out before it synthesises
79+
// an event, so this comes back early only because activation refused to wait for an app that has
80+
// no intention of settling (#2546).
8081
XCTAssertLessThan(elapsed, 9, "activation waited \(elapsed)s for a busy app to idle")
8182
XCTAssertTrue(response.ok, String(describing: response.error))
82-
XCTAssertEqual(app.staticTexts["agent-device-alert-actions"].label, "First actions: 1; replacement actions: 0")
83-
if !response.ok, response.error?.code == "ALERT_DEADLINE_EXCEEDED" {
83+
let recordedActions = app.staticTexts["agent-device-alert-actions"].label
84+
if response.ok {
85+
XCTAssertEqual(recordedActions, "First actions: 1; replacement actions: 0")
86+
} else {
8487
XCTAssertEqual(
85-
app.staticTexts["agent-device-alert-actions"].label,
88+
recordedActions,
8689
"First actions: 0; replacement actions: 0",
8790
"a caller told about an expired deadline must not have a button activated behind it"
8891
)

0 commit comments

Comments
 (0)