Skip to content

Commit 32bf98d

Browse files
thymikeeclaude
andauthored
refactor(ios): keep the modal-scope capture out of the packaged runner (#4127)
The modal-scope capture from #4124 has one caller, the alert surface corpus capture test, yet its ObjC reader, the Swift acquisition, and the bridge's internal header shipped in the runner source. They move under UnitTests/, which the packager drops, and compile only under AGENT_DEVICE_RUNNER_UNIT_TESTS. The bridging header imports the capture header only when it exists, since OTHER_CFLAGS defines do not reach Swift's clang importer. Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent f032409 commit 32bf98d

6 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
#import "RunnerSynthesizedGesture.h"
44
#import "RunnerSynthesizedTextEntry.h"
55
#import "RunnerXCTestEventBridge.h"
6-
#import "RunnerAXModalScopeCapture.h"
6+
// The packaged runner omits UnitTests/. OTHER_CFLAGS defines do not reach this header.
7+
#if __has_include("UnitTests/RunnerAXModalScopeCapture.h")
8+
#import "UnitTests/RunnerAXModalScopeCapture.h"
9+
#endif

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "RunnerAXSnapshotBridge+Internal.h"
1+
#import "RunnerAXSnapshotBridge.h"
22

33
#import <CoreGraphics/CoreGraphics.h>
44
#import <objc/message.h>

apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXModalScopeCapture.h renamed to apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerAXModalScopeCapture.h

File renamed without changes.

apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXModalScopeCapture.m renamed to apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerAXModalScopeCapture.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if defined(AGENT_DEVICE_RUNNER_UNIT_TESTS)
12
#import "RunnerAXModalScopeCapture.h"
23

34
#import <objc/message.h>
@@ -248,3 +249,4 @@ + (nullable NSString *)modalScopeIdentityForElement:(nullable id)element
248249
}
249250

250251
@end
252+
#endif

apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge+Internal.h renamed to apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerAXSnapshotBridge+Internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
NS_ASSUME_NONNULL_BEGIN
44

5-
/// The bridge's client, target, request, and attribute plumbing, shared with the other AX reads
6-
/// so each private call has one implementation.
5+
/// The bridge's client, target, request, and attribute plumbing, shared with the modal-scope
6+
/// capture so each private call has one implementation.
77
@interface RunnerAXSnapshotBridge ()
88

99
+ (nullable id)accessibilityApplicationForApplication:(XCUIApplication *)application axClient:(id)axClient;

apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerModalScopeAcquisition.swift renamed to apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerModalScopeAcquisition.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import XCTest
22
import AgentDeviceSnapshotPresentation
33

4+
#if AGENT_DEVICE_RUNNER_UNIT_TESTS
45
enum ModalScopeAcquisitionFailure: Equatable {
56
case clientUnavailable
67
case targetUnresolved
@@ -77,3 +78,4 @@ enum ModalScopeAcquisition {
7778
tree.nodes.map { ModalScopeNode(element: $0.element, parentElement: $0.parentElement, frame: $0.frame) }
7879
}
7980
}
81+
#endif

0 commit comments

Comments
 (0)