Skip to content

Commit c47fcd5

Browse files
committed
docs(ios): state the macOS helper dismiss rules accurately and keep narration out of the alert fixtures
1 parent 002b871 commit c47fcd5

4 files changed

Lines changed: 7 additions & 10 deletions

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,10 @@ - (void)presentAlertFixtureReplacement:(BOOL)replacement {
389389
[self presentViewController:alert animated:NO completion:nil];
390390
}
391391

392-
// The App Tracking Transparency prompt's button order, which is what `alert dismiss` got wrong:
393-
// the affirmative button is last, so a fallback to it answers "Allow" (#3627). The answer label
394-
// says which button the app really took, so a test does not trust the command's own report.
395-
// `--agent-device-alert-affirmative-only` shows the same alert with no decline button at all,
396-
// where `dismiss` must refuse without activating anything.
392+
// Mirrors the App Tracking Transparency prompt's real button order: the affirmative button is
393+
// last (#3627). The answer label records which button the app actually took, so a test asserts
394+
// the app's answer instead of the command's own report. `--agent-device-alert-affirmative-only`
395+
// shows the same alert with no decline button at all.
397396
- (void)presentAlertDeclineChoiceFixture {
398397
BOOL affirmativeOnly =
399398
[NSProcessInfo.processInfo.arguments containsObject:@"--agent-device-alert-affirmative-only"];

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertButtonChoice.swift‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import Foundation
88
/// — iOS localizes the App Tracking Transparency prompt's "Allow", consent copy is open-ended,
99
/// and no list closes either set — and answering such a button while reporting `dismissed` is
1010
/// exactly the failure #3627 reports. So an unrecognized decline is refused with
11-
/// `ALERT_BUTTON_NOT_FOUND` and no tap rather than guessed at. Unknown wording stays reachable:
12-
/// `alert get` shows the labels, and `snapshot` + `press @ref` names the button instead of
13-
/// inferring it.
11+
/// `ALERT_BUTTON_NOT_FOUND` and no tap rather than guessed at.
1412
///
1513
/// The one recognized decline outside the list is a dismiss-popup surface itself: its native
1614
/// accessibility marker is the app's own declaration that the surface closes the popover, so

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extension RunnerTests {
6565
if action == "accept" || action == "dismiss" {
6666
guard let button = chooseAlertButton(alert, action: action) else {
6767
// The choice refused before any activation, so this discloses dispatched: no like the
68-
// runner's other pre-run refusals; naming an affirmative button here is what #3627 is about.
68+
// runner's other pre-run refusals.
6969
return Response(ok: false, error: ErrorPayload(
7070
code: RunnerWireErrorCode.alertButtonNotFound,
7171
message: "alert \(action) button not found",

‎website/docs/docs/commands.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ agent-device alert dismiss
387387
- `alert` (same as `alert get`) inspects or handles system alerts on iOS simulator, macOS desktop, and Android permission dialogs. On iOS it also covers app-owned modal popups with native blocking markers.
388388
- Use `alert get` for a quick check, and `alert wait <short-ms>` only when a prompt may appear after async work. Don't use `settings permission` to answer a dialog already on screen; it is for setup before a flow.
389389
- `accept` and `dismiss` are sent once on every platform and never replayed, even if the response is lost. On iOS the runner activates the button once, then only observes until the alert disappears, changes, or the deadline expires. A changed alert does not prove a permission was granted; verify the app outcome.
390-
- On the Apple XCUITest runner, `dismiss` activates only a button its decline list recognizes (`Cancel`, `Don't Allow`, `Ask App Not to Track`, and similar English labels), or the close button of a popover whose native marker reads "dismiss popup". It never taps anything else: unknown, reworded, or fully localized decline copy fails with `error.code: ALERT_BUTTON_NOT_FOUND` and `details.dispatched: no`, tapping nothing, rather than guessing at an affirmative ([#3627](https://github.com/callstack/agent-device/issues/3627)). A button choice that finds no button to name answers with that code and `dispatched: no` for `accept` too. To answer a prompt with unrecognized wording, read the labels with `alert get`, then press the button by label through `snapshot` + `press @ref`. The macOS helper's `dismiss` keeps its own first/last-button behavior.
390+
- On the Apple XCUITest runner, `dismiss` activates only a button its decline list recognizes (`Cancel`, `Don't Allow`, `Ask App Not to Track`, and similar English labels), or the close button of a popover whose native marker reads "dismiss popup". It never taps anything else: unknown, reworded, or fully localized decline copy fails with `error.code: ALERT_BUTTON_NOT_FOUND` and `details.dispatched: no`, tapping nothing, rather than guessing at an affirmative ([#3627](https://github.com/callstack/agent-device/issues/3627)). A button choice that finds no button to name answers with that code and `dispatched: no` for `accept` too. To answer a prompt with unrecognized wording, read the labels with `alert get`, then press the button by label through `snapshot` + `press @ref`. The macOS helper's `dismiss` keeps its own rules (the app's cancel-button attribute, its label list, and a last-button fallback).
391391
- An unreadable or ambiguous capture after the action fails with `error.details.runnerErrorCode: ALERT_CONFIRMATION_UNAVAILABLE`; an expired runner deadline fails with `ALERT_DEADLINE_EXCEEDED`. Neither proves the alert is gone or that nothing happened. Run `alert get` before acting again.
392392
- iOS runner refusals carry `error.details.reason`: `runner_busy` means the runner ran nothing (`dispatched: no`); `runner_main_thread_timeout` means the action may still land (`dispatched: unknown`).
393393
- If a sheet or permission prompt is visible but `alert` reports none, treat it as app UI: run `snapshot -i -s "<visible label>"`, then `press @ref`. Android alert support is snapshot-derived, and not every iOS simulator permission surface is a native alert.

0 commit comments

Comments
 (0)