Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Ditch FBApplication in favour of XCUIApplication extensions #834

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion PrivateHeaders/XCTest/XCUIApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
@property(readonly) id/*XCAccessibilityElement*/ accessibilityElement;

+ (instancetype)applicationWithPID:(pid_t)processID;
/*! DO NOT USE DIRECTLY! Please use fb_activate instead */
- (void)activate;

- (void)dismissKeyboard;
Expand Down
24 changes: 6 additions & 18 deletions WebDriverAgent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
641EE61E2240C5CA00173FCB /* FBExceptionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = EEC088E71CB56DA400B65968 /* FBExceptionHandler.m */; };
641EE61F2240C5CA00173FCB /* FBXCodeCompatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = EE5A24411F136C8D0078B1D9 /* FBXCodeCompatibility.m */; };
641EE6212240C5CA00173FCB /* FBElementTypeTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7901CAEDF0C008C271F /* FBElementTypeTransformer.m */; };
641EE6222240C5CA00173FCB /* FBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7671CAEDF0C008C271F /* FBApplication.m */; };
641EE6232240C5CA00173FCB /* FBScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 715AFAC01FFA29180053896D /* FBScreen.m */; };
641EE6242240C5CA00173FCB /* FBXCTestDaemonsProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = EE35AD7A1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m */; };
641EE6262240C5CA00173FCB /* FBMathUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1888391DA661C400307AA8 /* FBMathUtils.m */; };
Expand Down Expand Up @@ -142,7 +141,6 @@
641EE64B2240C5CA00173FCB /* XCTAsyncActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACCB1E3B77D600A02D78 /* XCTAsyncActivity.h */; settings = {ATTRIBUTES = (Public, ); }; };
641EE64C2240C5CA00173FCB /* XCTestMisuseObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACDF1E3B77D600A02D78 /* XCTestMisuseObserver.h */; settings = {ATTRIBUTES = (Public, ); }; };
641EE64D2240C5CA00173FCB /* XCTRunnerDaemonSession.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACEF1E3B77D600A02D78 /* XCTRunnerDaemonSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
641EE64E2240C5CA00173FCB /* FBApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7661CAEDF0C008C271F /* FBApplication.h */; settings = {ATTRIBUTES = (Public, ); }; };
641EE64F2240C5CA00173FCB /* XCTestExpectationWaiter.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACDA1E3B77D600A02D78 /* XCTestExpectationWaiter.h */; settings = {ATTRIBUTES = (Public, ); }; };
641EE6502240C5CA00173FCB /* UIGestureRecognizer-RecordingAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACAD1E3B77D600A02D78 /* UIGestureRecognizer-RecordingAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
641EE6512240C5CA00173FCB /* XCKeyboardKeyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = EE35ACBF1E3B77D600A02D78 /* XCKeyboardKeyMap.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -619,8 +617,6 @@
EE158AE91CBD456F00A3E3F0 /* FBElementTypeTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7901CAEDF0C008C271F /* FBElementTypeTransformer.m */; };
EE158AEA1CBD456F00A3E3F0 /* FBRuntimeUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7911CAEDF0C008C271F /* FBRuntimeUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
EE158AEB1CBD456F00A3E3F0 /* FBRuntimeUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7921CAEDF0C008C271F /* FBRuntimeUtils.m */; };
EE158AF51CBD456F00A3E3F0 /* FBApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = EE9AB7661CAEDF0C008C271F /* FBApplication.h */; settings = {ATTRIBUTES = (Public, ); }; };
EE158AF61CBD456F00A3E3F0 /* FBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9AB7671CAEDF0C008C271F /* FBApplication.m */; };
EE158B5A1CBD462100A3E3F0 /* WebDriverAgentLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE158A991CBD452B00A3E3F0 /* WebDriverAgentLib.framework */; };
EE158B5F1CBD47A000A3E3F0 /* WebDriverAgentLib.h in Headers */ = {isa = PBXBuildFile; fileRef = EE158B5E1CBD47A000A3E3F0 /* WebDriverAgentLib.h */; settings = {ATTRIBUTES = (Public, ); }; };
EE18883A1DA661C400307AA8 /* FBMathUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EE1888381DA661C400307AA8 /* FBMathUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -756,7 +752,7 @@
EE55B3271D1D54CF003AAAEC /* FBScrollingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE55B3261D1D54CF003AAAEC /* FBScrollingTests.m */; };
EE5A24421F136D360078B1D9 /* FBXCodeCompatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = EE5A24411F136C8D0078B1D9 /* FBXCodeCompatibility.m */; };
EE6A89261D0B19E60083E92B /* FBSessionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6A89251D0B19E60083E92B /* FBSessionTests.m */; };
EE6A892B1D0B25820083E92B /* FBApplicationDouble.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6A89281D0B257B0083E92B /* FBApplicationDouble.m */; };
EE6A892B1D0B25820083E92B /* XCUIApplicationDouble.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6A89281D0B257B0083E92B /* XCUIApplicationDouble.m */; };
EE6A892D1D0B2AF40083E92B /* FBErrorBuilderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6A892C1D0B2AF40083E92B /* FBErrorBuilderTests.m */; };
EE6A89371D0B35920083E92B /* FBFailureProofTestCaseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6A89361D0B35920083E92B /* FBFailureProofTestCaseTests.m */; };
EE6A893A1D0B38640083E92B /* FBFailureProofTestCase.h in Headers */ = {isa = PBXBuildFile; fileRef = EE6A89381D0B38640083E92B /* FBFailureProofTestCase.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -1254,8 +1250,8 @@
EE5A24401F136C8D0078B1D9 /* FBXCodeCompatibility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBXCodeCompatibility.h; sourceTree = "<group>"; };
EE5A24411F136C8D0078B1D9 /* FBXCodeCompatibility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBXCodeCompatibility.m; sourceTree = "<group>"; };
EE6A89251D0B19E60083E92B /* FBSessionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBSessionTests.m; sourceTree = "<group>"; };
EE6A89271D0B257B0083E92B /* FBApplicationDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBApplicationDouble.h; sourceTree = "<group>"; };
EE6A89281D0B257B0083E92B /* FBApplicationDouble.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBApplicationDouble.m; sourceTree = "<group>"; };
EE6A89271D0B257B0083E92B /* XCUIApplicationDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCUIApplicationDouble.h; sourceTree = "<group>"; };
EE6A89281D0B257B0083E92B /* XCUIApplicationDouble.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCUIApplicationDouble.m; sourceTree = "<group>"; };
EE6A892C1D0B2AF40083E92B /* FBErrorBuilderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBErrorBuilderTests.m; sourceTree = "<group>"; };
EE6A89361D0B35920083E92B /* FBFailureProofTestCaseTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBFailureProofTestCaseTests.m; sourceTree = "<group>"; };
EE6A89381D0B38640083E92B /* FBFailureProofTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBFailureProofTestCase.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1296,8 +1292,6 @@
EE9AB7631CAEDF0C008C271F /* FBTouchIDCommands.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBTouchIDCommands.m; sourceTree = "<group>"; };
EE9AB7641CAEDF0C008C271F /* FBUnknownCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBUnknownCommands.h; sourceTree = "<group>"; };
EE9AB7651CAEDF0C008C271F /* FBUnknownCommands.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBUnknownCommands.m; sourceTree = "<group>"; };
EE9AB7661CAEDF0C008C271F /* FBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBApplication.h; path = WebDriverAgentLib/FBApplication.h; sourceTree = SOURCE_ROOT; };
EE9AB7671CAEDF0C008C271F /* FBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FBApplication.m; path = WebDriverAgentLib/FBApplication.m; sourceTree = SOURCE_ROOT; };
EE9AB7731CAEDF0C008C271F /* WebDriverAgent.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = WebDriverAgent.bundle; sourceTree = "<group>"; };
EE9AB7751CAEDF0C008C271F /* FBCommandHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBCommandHandler.h; sourceTree = "<group>"; };
EE9AB7761CAEDF0C008C271F /* FBCommandStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBCommandStatus.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1615,8 +1609,8 @@
13FFF2F1287DBEE600E561E4 /* XCElementSnapshotDouble.m */,
ADBC39961D07842800327304 /* XCUIElementDouble.h */,
ADBC39971D07842800327304 /* XCUIElementDouble.m */,
EE6A89271D0B257B0083E92B /* FBApplicationDouble.h */,
EE6A89281D0B257B0083E92B /* FBApplicationDouble.m */,
EE6A89271D0B257B0083E92B /* XCUIApplicationDouble.h */,
EE6A89281D0B257B0083E92B /* XCUIApplicationDouble.m */,
);
path = Doubles;
sourceTree = "<group>";
Expand Down Expand Up @@ -2096,8 +2090,6 @@
EE158B5E1CBD47A000A3E3F0 /* WebDriverAgentLib.h */,
AD6C26921CF2379700F8B5FF /* FBAlert.h */,
AD6C26931CF2379700F8B5FF /* FBAlert.m */,
EE9AB7661CAEDF0C008C271F /* FBApplication.h */,
EE9AB7671CAEDF0C008C271F /* FBApplication.m */,
EE3A18641CDE734B00DE4205 /* FBKeyboard.h */,
EE3A18651CDE734B00DE4205 /* FBKeyboard.m */,
EE158B5D1CBD479000A3E3F0 /* Info.plist */,
Expand Down Expand Up @@ -2283,7 +2275,6 @@
641EE64D2240C5CA00173FCB /* XCTRunnerDaemonSession.h in Headers */,
714E14B929805CAE00375DD7 /* XCAXClient_iOS+FBSnapshotReqParams.h in Headers */,
64B2650B228CE4FF002A5025 /* FBTVNavigationTracker-Private.h in Headers */,
641EE64E2240C5CA00173FCB /* FBApplication.h in Headers */,
641EE64F2240C5CA00173FCB /* XCTestExpectationWaiter.h in Headers */,
13DE7A5C287CA444003243C6 /* FBXCElementSnapshotWrapper+Helpers.h in Headers */,
641EE6502240C5CA00173FCB /* UIGestureRecognizer-RecordingAdditions.h in Headers */,
Expand Down Expand Up @@ -2515,7 +2506,6 @@
EE35AD601E3B77D600A02D78 /* XCTRunnerDaemonSession.h in Headers */,
71414ED62670A1EE003A8C5D /* LRUCacheNode.h in Headers */,
64B2650A228CE4FF002A5025 /* FBTVNavigationTracker-Private.h in Headers */,
EE158AF51CBD456F00A3E3F0 /* FBApplication.h in Headers */,
71B155DF23080CA600646AFB /* FBProtocolHelpers.h in Headers */,
EE35AD4B1E3B77D600A02D78 /* XCTestExpectationWaiter.h in Headers */,
EE35AD1E1E3B77D600A02D78 /* UIGestureRecognizer-RecordingAdditions.h in Headers */,
Expand Down Expand Up @@ -3158,7 +3148,6 @@
641EE61F2240C5CA00173FCB /* FBXCodeCompatibility.m in Sources */,
71E75E70254824230099FC87 /* XCUIElementQuery+FBHelpers.m in Sources */,
641EE6212240C5CA00173FCB /* FBElementTypeTransformer.m in Sources */,
641EE6222240C5CA00173FCB /* FBApplication.m in Sources */,
13DE7A5E287CA444003243C6 /* FBXCElementSnapshotWrapper+Helpers.m in Sources */,
641EE6232240C5CA00173FCB /* FBScreen.m in Sources */,
71D04DCB25356C43008A052C /* XCUIElement+FBCaching.m in Sources */,
Expand Down Expand Up @@ -3292,7 +3281,6 @@
E444DC9D249131D40060D7EB /* HTTPMessage.m in Sources */,
E444DCB024913C220060D7EB /* RouteResponse.m in Sources */,
71D3B3D7267FC7260076473D /* XCUIElement+FBResolve.m in Sources */,
EE158AF61CBD456F00A3E3F0 /* FBApplication.m in Sources */,
715AFAC21FFA29180053896D /* FBScreen.m in Sources */,
71B155DC230711E900646AFB /* FBCommandStatus.m in Sources */,
EE35AD7C1E3B80C000A02D78 /* FBXCTestDaemonsProxy.m in Sources */,
Expand Down Expand Up @@ -3360,7 +3348,7 @@
EE9B76591CF7987800275851 /* FBRouteTests.m in Sources */,
7139145C1DF01A12005896C2 /* NSExpressionFBFormatTests.m in Sources */,
71A224E81DE326C500844D55 /* NSPredicateFBFormatTests.m in Sources */,
EE6A892B1D0B25820083E92B /* FBApplicationDouble.m in Sources */,
EE6A892B1D0B25820083E92B /* XCUIApplicationDouble.m in Sources */,
716F0DA62A17323300CDD977 /* NSDictionaryFBUtf8SafeTests.m in Sources */,
EE6A892D1D0B2AF40083E92B /* FBErrorBuilderTests.m in Sources */,
712A0C851DA3E459007D02E5 /* FBXPathTests.m in Sources */,
Expand Down
38 changes: 38 additions & 0 deletions WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,44 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSArray<NSDictionary<NSString *, NSString*> *> *)fb_performAccessibilityAuditWithAuditTypes:(uint64_t)auditTypes
error:(NSError **)error;
/**
Constructor used to get current active application
*/
+ (instancetype)fb_activeApplication;

/**
Constructor used to get current active application

@param bundleId The bundle identifier of an app, which should be selected as active by default
if it is present in the list of active applications
*/
+ (instancetype)fb_activeApplicationWithDefaultBundleId:(nullable NSString *)bundleId;

/**
Constructor used to get the system application (e.g. Springboard on iOS)
*/
+ (instancetype)fb_systemApplication;

/**
Retrieves the list of all currently active applications
*/
+ (NSArray<XCUIApplication *> *)fb_activeApplications;

/**
Switch to system app (called Springboard on iOS)

@param error If there is an error, upon return contains an NSError object that describes the problem.
@return YES if the operation succeeds, otherwise NO.
*/
+ (BOOL)fb_switchToSystemApplicationWithError:(NSError **)error;

/**
Determines whether the other app is the same as the current one

@param otherApp Other app instance
@return YES if the other app has the same identifier
*/
- (BOOL)fb_isSameAppAs:(nullable XCUIApplication *)otherApp;

@end

Expand Down
Loading