From ff1f2e976068d8524de28835b6a38c30d1fb93bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 1 Jun 2026 15:52:51 +0200 Subject: [PATCH 1/2] fix(ios): classify tapSeries/dragSeries/keyboardReturn as interaction commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tapSeries and dragSeries are the series forms of tap/drag (already interaction commands); keyboardReturn is the sibling of keyboardDismiss (already an interaction command). All three were missing from the historical isInteractionCommand switch — a drift the new CommandTraits table (#642) makes visible. Classifying them as interaction commands gives them the foreground-guard + stabilization preflight that their single-shot/sibling forms already get. Behavior change: these three commands now re-activate a backgrounded target to foreground and pay the stabilization delays before running. Ships separately from the CommandTraits refactor (#642) and should land after that bakes. mouseClick left unchanged: macOS-only and the foreground guard interacts with bespoke macOS activation, so it needs a macOS smoke check first. --- .../RunnerTests+Models.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift b/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift index 105a366fa..6424b0363 100644 --- a/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +++ b/ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift @@ -67,9 +67,12 @@ extension CommandType { var traits: CommandTraits { switch self { // Interaction commands: require the foreground-guard + stabilization preflight. - case .tap, .longPress, .drag, .remotePress, .type, .swipe, + // tapSeries/dragSeries are the series forms of tap/drag; keyboardReturn is the sibling + // of keyboardDismiss — all three were missing from the historical switch (drift the + // table now prevents) and are classified as interactions here. + case .tap, .tapSeries, .longPress, .drag, .dragSeries, .remotePress, .type, .swipe, .back, .backInApp, .backSystem, .rotate, .appSwitcher, - .keyboardDismiss, .pinch, .rotateGesture, .transformGesture: + .keyboardDismiss, .keyboardReturn, .pinch, .rotateGesture, .transformGesture: return CommandTraits(isInteraction: true, readOnly: .never, isLifecycle: false) // Read-only reads: eligible for the session-invalidating retry. @@ -89,12 +92,11 @@ extension CommandType { return CommandTraits(isInteraction: false, readOnly: .never, isLifecycle: true) // Normal preflight, not retried. - // NOTE — pre-existing classifications preserved verbatim (candidates for a later, separate - // normalization PR, not this refactor): mouseClick / tapSeries / dragSeries are NOT interaction - // commands; keyboardReturn is NOT an interaction command (unlike its sibling keyboardDismiss); - // querySelector is NOT read-only; recordStart is NOT a lifecycle command. - case .mouseClick, .tapSeries, .dragSeries, .querySelector, - .home, .keyboardReturn, .recordStart: + // NOTE: mouseClick stays non-interaction for now — it is macOS-only and the foreground + // guard interacts with bespoke macOS activation, so classifying it needs a macOS smoke + // check first (tracked as a follow-up). Also preserved: querySelector is NOT read-only; + // recordStart is NOT a lifecycle command; home/alert remain non-interaction by design. + case .mouseClick, .querySelector, .home, .recordStart: return CommandTraits(isInteraction: false, readOnly: .never, isLifecycle: false) } } From 3bee6f7ca59ff1b1daee6a66fcb41ae0d66364f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Mon, 1 Jun 2026 16:32:43 +0200 Subject: [PATCH 2/2] test: cover iOS runner series commands in perf harness --- scripts/perf/scenario.ts | 85 +++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 9 deletions(-) diff --git a/scripts/perf/scenario.ts b/scripts/perf/scenario.ts index 4d44b82e2..4ba1338c4 100644 --- a/scripts/perf/scenario.ts +++ b/scripts/perf/scenario.ts @@ -53,35 +53,102 @@ export function buildSettingsTour(p: ResolvedProfile, ctx: StepContext): Scenari const textEntry: ScenarioStep[] = p.selectors.searchEditableAtRoot ? [ // iOS: editable search field exists at root; fill it directly (freshRoot resets scroll). - bat('fill search', 'fill', { command: 'fill', positionals: [s.searchFieldEditable, 'general'] }, { freshRoot: true }), + bat( + 'fill search', + 'fill', + { command: 'fill', positionals: [s.searchFieldEditable, 'general'] }, + { freshRoot: true }, + ), bat('type', 'type', { command: 'type', positionals: ['wifi'] }), - bat('get editable text', 'get', { command: 'get', positionals: ['text', s.searchFieldEditable] }), + bat('get editable text', 'get', { + command: 'get', + positionals: ['text', s.searchFieldEditable], + }), + bat('keyboard return', 'keyboard', { command: 'keyboard', positionals: ['return'] }), ] : [ // Android: tap the search entry first to reveal the editable, then type/fill it. - bat('press search field', 'press', { command: 'press', positionals: [s.searchField] }, { freshRoot: true }), + bat( + 'press search field', + 'press', + { command: 'press', positionals: [s.searchField] }, + { freshRoot: true }, + ), bat('type', 'type', { command: 'type', positionals: ['wifi'] }), - bat('fill search', 'fill', { command: 'fill', positionals: [s.searchFieldEditable, 'general'] }), - bat('get editable text', 'get', { command: 'get', positionals: ['text', s.searchFieldEditable] }), + bat('fill search', 'fill', { + command: 'fill', + positionals: [s.searchFieldEditable, 'general'], + }), + bat('get editable text', 'get', { + command: 'get', + positionals: ['text', s.searchFieldEditable], + }), ]; + // These iOS-only repeated gesture forms route to dedicated XCTest runner commands: + // press --count > 1 -> tapSeries; swipe --count > 1 -> dragSeries. + const iosRunnerSeries: ScenarioStep[] = + p.platform === 'ios' + ? [ + bat( + 'press series (tapSeries)', + 'press', + { command: 'press', positionals: ['200', '95'], flags: { count: 2, intervalMs: 50 } }, + { freshRoot: true }, + ), + bat( + 'swipe series (dragSeries)', + 'swipe', + { + command: 'swipe', + positionals: ['200', '650', '200', '450', '120'], + flags: { count: 2, pauseMs: 50, pattern: 'ping-pong' }, + }, + { freshRoot: true }, + ), + ] + : []; + return [ // --- reset to root via relaunch --- std('open (relaunch → root)', 'open', ['open', p.appTarget, '--relaunch']), // --- reads on the root tree (snapshots first; anchor label is visible here) --- - bat('snapshot -i (root)', 'snapshot', { command: 'snapshot', flags: { snapshotInteractiveOnly: true } }, { isSnapshot: true }), + bat( + 'snapshot -i (root)', + 'snapshot', + { command: 'snapshot', flags: { snapshotInteractiveOnly: true } }, + { isSnapshot: true }, + ), bat('snapshot (root)', 'snapshot', { command: 'snapshot' }, { isSnapshot: true }), // --- navigate into a sub-screen from a fresh root (freshRoot resets scroll so the // deep-screen row is in view), read it, then return --- - bat('press → deep screen', 'press', { command: 'press', positionals: [s.deepScreen] }, { freshRoot: true }), + bat( + 'press → deep screen', + 'press', + { command: 'press', positionals: [s.deepScreen] }, + { freshRoot: true }, + ), bat('snapshot (deep)', 'snapshot', { command: 'snapshot' }, { isSnapshot: true }), - bat('snapshot -i (deep)', 'snapshot', { command: 'snapshot', flags: { snapshotInteractiveOnly: true } }, { isSnapshot: true }), + bat( + 'snapshot -i (deep)', + 'snapshot', + { command: 'snapshot', flags: { snapshotInteractiveOnly: true } }, + { isSnapshot: true }, + ), bat('back', 'back', { command: 'back' }), + // --- iOS runner series commands surfaced by PR #643 --- + ...iosRunnerSeries, + // --- targeted reads against the visible anchor (freshRoot so the anchor is on screen) --- - bat('wait text', 'wait', { command: 'wait', positionals: ['text', s.anchorText, '3000'] }, { freshRoot: true }), + bat( + 'wait text', + 'wait', + { command: 'wait', positionals: ['text', s.anchorText, '3000'] }, + { freshRoot: true }, + ), bat('find', 'find', { command: 'find', positionals: [s.anchorText] }), bat('get text', 'get', { command: 'get', positionals: ['text', s.anchorLabel] }), bat('is visible', 'is', { command: 'is', positionals: ['visible', s.anchorLabel] }),