├── .azure-pipelines.yml ├── .eslintignore ├── .eslintrc.json ├── .github ├── ISSUE_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── functional-test.yml │ ├── pr-title.yml │ ├── publish.js.yml │ ├── unit-test.yml │ └── wda-package.yml ├── .gitignore ├── .mocharc.js ├── .npmrc ├── .releaserc ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Configurations ├── IOSSettings.xcconfig ├── IOSTestSettings.xcconfig ├── TVOSSettings.xcconfig └── TVOSTestSettings.xcconfig ├── Fastlane └── Fastfile ├── Gemfile ├── Introduction ├── FailID.png ├── README_zh.md ├── bundleId.png ├── chooseScheme.png ├── connectDevice.jpg ├── ios-airtestIDE.gif ├── ios-inspector.gif ├── login.png ├── question.md ├── question_zh.md ├── signing.png ├── trust_dev.png ├── trust_dev2.png ├── untrusted.jpg ├── version_not_match.png ├── version_not_match2.png └── versions.png ├── LICENSE ├── PATENTS ├── PrivateHeaders ├── AccessibilityUtilities │ └── AXSettings.h ├── MobileCoreServices │ └── LSApplicationWorkspace.h ├── TextInput │ └── TIPreferencesController.h ├── UIKitCore │ └── UIKeyboardImpl.h └── XCTest │ ├── CDStructures.h │ ├── NSString-XCTAdditions.h │ ├── NSValue-XCTestAdditions.h │ ├── UIGestureRecognizer-RecordingAdditions.h │ ├── UILongPressGestureRecognizer-RecordingAdditions.h │ ├── UIPanGestureRecognizer-RecordingAdditions.h │ ├── UIPinchGestureRecognizer-RecordingAdditions.h │ ├── UISwipeGestureRecognizer-RecordingAdditions.h │ ├── UITapGestureRecognizer-RecordingAdditions.h │ ├── XCAXClient_iOS.h │ ├── XCActivityRecord.h │ ├── XCApplicationMonitor.h │ ├── XCApplicationMonitor_iOS.h │ ├── XCApplicationQuery.h │ ├── XCDebugLogDelegate-Protocol.h │ ├── XCDeviceEvent.h │ ├── XCEventGenerator.h │ ├── XCKeyMappingPath.h │ ├── XCKeyboardInputSolver.h │ ├── XCKeyboardKeyMap.h │ ├── XCKeyboardLayout.h │ ├── XCPointerEvent.h │ ├── XCPointerEventPath.h │ ├── XCSourceCodeRecording.h │ ├── XCSourceCodeTreeNode.h │ ├── XCSourceCodeTreeNodeEnumerator.h │ ├── XCSymbolicationRecord.h │ ├── XCSymbolicatorHolder.h │ ├── XCSynthesizedEventRecord.h │ ├── XCTAXClient-Protocol.h │ ├── XCTAsyncActivity-Protocol.h │ ├── XCTAsyncActivity.h │ ├── XCTAutomationTarget-Protocol.h │ ├── XCTDarwinNotificationExpectation.h │ ├── XCTElementSetTransformer-Protocol.h │ ├── XCTKVOExpectation.h │ ├── XCTMetric.h │ ├── XCTNSNotificationExpectation.h │ ├── XCTNSPredicateExpectation.h │ ├── XCTNSPredicateExpectationObject-Protocol.h │ ├── XCTRunnerAutomationSession.h │ ├── XCTRunnerDaemonSession.h │ ├── XCTRunnerIDESession.h │ ├── XCTTestRunSession.h │ ├── XCTTestRunSessionDelegate-Protocol.h │ ├── XCTUIApplicationMonitor-Protocol.h │ ├── XCTWaiter.h │ ├── XCTWaiterDelegate-Protocol.h │ ├── XCTWaiterDelegatePrivate-Protocol.h │ ├── XCTWaiterManagement-Protocol.h │ ├── XCTWaiterManager.h │ ├── XCTest.h │ ├── XCTestCase.h │ ├── XCTestCaseRun.h │ ├── XCTestCaseSuite.h │ ├── XCTestConfiguration.h │ ├── XCTestContext.h │ ├── XCTestContextScope.h │ ├── XCTestDriver.h │ ├── XCTestDriverInterface-Protocol.h │ ├── XCTestExpectation.h │ ├── XCTestExpectationDelegate-Protocol.h │ ├── XCTestExpectationWaiter.h │ ├── XCTestLog.h │ ├── XCTestManager_IDEInterface-Protocol.h │ ├── XCTestManager_ManagerInterface-Protocol.h │ ├── XCTestManager_TestsInterface-Protocol.h │ ├── XCTestMisuseObserver.h │ ├── XCTestObservation-Protocol.h │ ├── XCTestObservationCenter.h │ ├── XCTestObserver.h │ ├── XCTestProbe.h │ ├── XCTestRun.h │ ├── XCTestSuite.h │ ├── XCTestSuiteRun.h │ ├── XCTestWaiter.h │ ├── XCUIApplication.h │ ├── XCUIApplicationImpl.h │ ├── XCUIApplicationProcess.h │ ├── XCUICoordinate.h │ ├── XCUIDevice.h │ ├── XCUIElement.h │ ├── XCUIElementAsynchronousHandlerWrapper.h │ ├── XCUIElementHitPointCoordinate.h │ ├── XCUIElementQuery.h │ ├── XCUIHitPointResult.h │ ├── XCUIRecorderNodeFinder.h │ ├── XCUIRecorderNodeFinderMatch.h │ ├── XCUIRecorderTimingMessage.h │ ├── XCUIRecorderUtilities.h │ ├── XCUIScreen.h │ ├── XCUIScreenDataSource-Protocol.h │ ├── _XCInternalTestRun.h │ ├── _XCKVOExpectationImplementation.h │ ├── _XCTDarwinNotificationExpectationImplementation.h │ ├── _XCTNSNotificationExpectationImplementation.h │ ├── _XCTNSPredicateExpectationImplementation.h │ ├── _XCTWaiterImpl.h │ ├── _XCTestCaseImplementation.h │ ├── _XCTestCaseInterruptionException.h │ ├── _XCTestExpectationImplementation.h │ ├── _XCTestImplementation.h │ ├── _XCTestObservationCenterImplementation.h │ └── _XCTestSuiteImplementation.h ├── README.md ├── Scripts ├── build-webdriveragent.js ├── build.sh ├── ci │ ├── build-real.sh │ └── build-sim.sh └── fetch-prebuilt-wda.js ├── WebDriverAgent.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── IntegrationApp.xcscheme │ ├── IntegrationTests_1.xcscheme │ ├── IntegrationTests_2.xcscheme │ ├── IntegrationTests_3.xcscheme │ ├── WebDriverAgentLib.xcscheme │ ├── WebDriverAgentLib_tvOS.xcscheme │ ├── WebDriverAgentRunner-nodebug.xcscheme │ ├── WebDriverAgentRunner.xcscheme │ └── WebDriverAgentRunner_tvOS.xcscheme ├── WebDriverAgentLib ├── Categories │ ├── FBXCElementSnapshotWrapper+Helpers.h │ ├── FBXCElementSnapshotWrapper+Helpers.m │ ├── NSDictionary+FBUtf8SafeDictionary.h │ ├── NSDictionary+FBUtf8SafeDictionary.m │ ├── NSExpression+FBFormat.h │ ├── NSExpression+FBFormat.m │ ├── NSString+FBVisualLength.h │ ├── NSString+FBVisualLength.m │ ├── NSString+FBXMLSafeString.h │ ├── NSString+FBXMLSafeString.m │ ├── XCAXClient_iOS+FBSnapshotReqParams.h │ ├── XCAXClient_iOS+FBSnapshotReqParams.m │ ├── XCTIssue+FBPatcher.h │ ├── XCTIssue+FBPatcher.m │ ├── XCUIApplication+FBAlert.h │ ├── XCUIApplication+FBAlert.m │ ├── XCUIApplication+FBFocused.h │ ├── XCUIApplication+FBHelpers.h │ ├── XCUIApplication+FBHelpers.m │ ├── XCUIApplication+FBQuiescence.h │ ├── XCUIApplication+FBQuiescence.m │ ├── XCUIApplication+FBTouchAction.h │ ├── XCUIApplication+FBTouchAction.m │ ├── XCUIApplication+FBUIInterruptions.h │ ├── XCUIApplication+FBUIInterruptions.m │ ├── XCUIApplicationProcess+FBQuiescence.h │ ├── XCUIApplicationProcess+FBQuiescence.m │ ├── XCUIDevice+FBHealthCheck.h │ ├── XCUIDevice+FBHealthCheck.m │ ├── XCUIDevice+FBHelpers.h │ ├── XCUIDevice+FBHelpers.m │ ├── XCUIDevice+FBRotation.h │ ├── XCUIDevice+FBRotation.m │ ├── XCUIElement+FBAccessibility.h │ ├── XCUIElement+FBAccessibility.m │ ├── XCUIElement+FBCaching.h │ ├── XCUIElement+FBCaching.m │ ├── XCUIElement+FBClassChain.h │ ├── XCUIElement+FBClassChain.m │ ├── XCUIElement+FBFind.h │ ├── XCUIElement+FBFind.m │ ├── XCUIElement+FBForceTouch.h │ ├── XCUIElement+FBForceTouch.m │ ├── XCUIElement+FBIsVisible.h │ ├── XCUIElement+FBIsVisible.m │ ├── XCUIElement+FBPickerWheel.h │ ├── XCUIElement+FBPickerWheel.m │ ├── XCUIElement+FBResolve.h │ ├── XCUIElement+FBResolve.m │ ├── XCUIElement+FBScrolling.h │ ├── XCUIElement+FBScrolling.m │ ├── XCUIElement+FBSwiping.h │ ├── XCUIElement+FBSwiping.m │ ├── XCUIElement+FBTVFocuse.h │ ├── XCUIElement+FBTVFocuse.m │ ├── XCUIElement+FBTyping.h │ ├── XCUIElement+FBTyping.m │ ├── XCUIElement+FBUID.h │ ├── XCUIElement+FBUID.m │ ├── XCUIElement+FBUtilities.h │ ├── XCUIElement+FBUtilities.m │ ├── XCUIElement+FBWebDriverAttributes.h │ ├── XCUIElement+FBWebDriverAttributes.m │ ├── XCUIElementQuery+FBHelpers.h │ └── XCUIElementQuery+FBHelpers.m ├── Commands │ ├── FBAlertViewCommands.h │ ├── FBAlertViewCommands.m │ ├── FBCustomCommands.h │ ├── FBCustomCommands.m │ ├── FBDebugCommands.h │ ├── FBDebugCommands.m │ ├── FBElementCommands.h │ ├── FBElementCommands.m │ ├── FBFindElementCommands.h │ ├── FBFindElementCommands.m │ ├── FBOrientationCommands.h │ ├── FBOrientationCommands.m │ ├── FBScreenshotCommands.h │ ├── FBScreenshotCommands.m │ ├── FBSessionCommands.h │ ├── FBSessionCommands.m │ ├── FBTouchActionCommands.h │ ├── FBTouchActionCommands.m │ ├── FBTouchIDCommands.h │ ├── FBTouchIDCommands.m │ ├── FBUnknownCommands.h │ ├── FBUnknownCommands.m │ ├── FBVideoCommands.h │ └── FBVideoCommands.m ├── FBAlert.h ├── FBAlert.m ├── Info.plist ├── Routing │ ├── FBCommandHandler.h │ ├── FBCommandStatus.h │ ├── FBCommandStatus.m │ ├── FBElement.h │ ├── FBElementCache.h │ ├── FBElementCache.m │ ├── FBElementUtils.h │ ├── FBElementUtils.m │ ├── FBExceptionHandler.h │ ├── FBExceptionHandler.m │ ├── FBExceptions.h │ ├── FBExceptions.m │ ├── FBHTTPStatusCodes.h │ ├── FBResponseJSONPayload.h │ ├── FBResponseJSONPayload.m │ ├── FBResponsePayload.h │ ├── FBResponsePayload.m │ ├── FBRoute.h │ ├── FBRoute.m │ ├── FBRouteRequest-Private.h │ ├── FBRouteRequest.h │ ├── FBRouteRequest.m │ ├── FBScreenRecordingContainer.h │ ├── FBScreenRecordingContainer.m │ ├── FBScreenRecordingPromise.h │ ├── FBScreenRecordingPromise.m │ ├── FBScreenRecordingRequest.h │ ├── FBScreenRecordingRequest.m │ ├── FBSession-Private.h │ ├── FBSession.h │ ├── FBSession.m │ ├── FBTCPSocket.h │ ├── FBTCPSocket.m │ ├── FBWebServer.h │ ├── FBWebServer.m │ ├── FBXCAccessibilityElement.h │ ├── FBXCAccessibilityElement.m │ ├── FBXCDeviceEvent.h │ ├── FBXCDeviceEvent.m │ ├── FBXCElementSnapshot.h │ ├── FBXCElementSnapshot.m │ ├── FBXCElementSnapshotWrapper.h │ └── FBXCElementSnapshotWrapper.m ├── Utilities │ ├── FBActiveAppDetectionPoint.h │ ├── FBActiveAppDetectionPoint.m │ ├── FBAlertsMonitor.h │ ├── FBAlertsMonitor.m │ ├── FBBaseActionsParser.m │ ├── FBBaseActionsSynthesizer.h │ ├── FBBaseActionsSynthesizer.m │ ├── FBCapabilities.h │ ├── FBCapabilities.m │ ├── FBClassChainQueryParser.h │ ├── FBClassChainQueryParser.m │ ├── FBConfiguration.h │ ├── FBConfiguration.m │ ├── FBDebugLogDelegateDecorator.h │ ├── FBDebugLogDelegateDecorator.m │ ├── FBElementTypeTransformer.h │ ├── FBElementTypeTransformer.m │ ├── FBErrorBuilder.h │ ├── FBErrorBuilder.m │ ├── FBFailureProofTestCase.h │ ├── FBFailureProofTestCase.m │ ├── FBImageProcessor.h │ ├── FBImageProcessor.m │ ├── FBImageUtils.h │ ├── FBImageUtils.m │ ├── FBKeyboard.h │ ├── FBKeyboard.m │ ├── FBLogger.h │ ├── FBLogger.m │ ├── FBMacros.h │ ├── FBMathUtils.h │ ├── FBMathUtils.m │ ├── FBMjpegServer.h │ ├── FBMjpegServer.m │ ├── FBNotificationsHelper.h │ ├── FBNotificationsHelper.m │ ├── FBPasteboard.h │ ├── FBPasteboard.m │ ├── FBProtocolHelpers.h │ ├── FBProtocolHelpers.m │ ├── FBReflectionUtils.h │ ├── FBReflectionUtils.m │ ├── FBRunLoopSpinner.h │ ├── FBRunLoopSpinner.m │ ├── FBRuntimeUtils.h │ ├── FBRuntimeUtils.m │ ├── FBScreen.h │ ├── FBScreen.m │ ├── FBScreenshot.h │ ├── FBScreenshot.m │ ├── FBSettings.h │ ├── FBSettings.m │ ├── FBTVNavigationTracker-Private.h │ ├── FBTVNavigationTracker.h │ ├── FBTVNavigationTracker.m │ ├── FBUnattachedAppLauncher.h │ ├── FBUnattachedAppLauncher.m │ ├── FBW3CActionsHelpers.h │ ├── FBW3CActionsHelpers.m │ ├── FBW3CActionsSynthesizer.h │ ├── FBW3CActionsSynthesizer.m │ ├── FBXCAXClientProxy.h │ ├── FBXCAXClientProxy.m │ ├── FBXCTestDaemonsProxy.h │ ├── FBXCTestDaemonsProxy.m │ ├── FBXCodeCompatibility.h │ ├── FBXCodeCompatibility.m │ ├── FBXMLGenerationOptions.h │ ├── FBXMLGenerationOptions.m │ ├── FBXPath-Private.h │ ├── FBXPath.h │ ├── FBXPath.m │ ├── LRUCache │ │ ├── LRUCache.h │ │ ├── LRUCache.m │ │ ├── LRUCacheNode.h │ │ └── LRUCacheNode.m │ ├── NSPredicate+FBFormat.h │ ├── NSPredicate+FBFormat.m │ ├── XCTestPrivateSymbols.h │ ├── XCTestPrivateSymbols.m │ ├── XCUIApplicationProcessDelay.h │ └── XCUIApplicationProcessDelay.m ├── Vendor │ ├── CocoaAsyncSocket │ │ ├── GCDAsyncSocket.h │ │ ├── GCDAsyncSocket.m │ │ ├── GCDAsyncUdpSocket.h │ │ └── GCDAsyncUdpSocket.m │ ├── CocoaHTTPServer │ │ ├── Categories │ │ │ ├── DDNumber.h │ │ │ ├── DDNumber.m │ │ │ ├── DDRange.h │ │ │ └── DDRange.m │ │ ├── HTTPConnection.h │ │ ├── HTTPConnection.m │ │ ├── HTTPLogging.h │ │ ├── HTTPMessage.h │ │ ├── HTTPMessage.m │ │ ├── HTTPResponse.h │ │ ├── HTTPServer.h │ │ ├── HTTPServer.m │ │ ├── LICENSE │ │ └── Responses │ │ │ ├── HTTPDataResponse.h │ │ │ ├── HTTPDataResponse.m │ │ │ ├── HTTPErrorResponse.h │ │ │ └── HTTPErrorResponse.m │ └── RoutingHTTPServer │ │ ├── HTTPResponseProxy.h │ │ ├── HTTPResponseProxy.m │ │ ├── LICENSE │ │ ├── Route.h │ │ ├── Route.m │ │ ├── RouteRequest.h │ │ ├── RouteRequest.m │ │ ├── RouteResponse.h │ │ ├── RouteResponse.m │ │ ├── RoutingConnection.h │ │ ├── RoutingConnection.m │ │ ├── RoutingHTTPServer.h │ │ └── RoutingHTTPServer.m └── WebDriverAgentLib.h ├── WebDriverAgentRunner ├── Info.plist └── UITestingUITests.m ├── WebDriverAgentTests ├── IntegrationApp │ ├── Classes │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── FBAlertViewController.h │ │ ├── FBAlertViewController.m │ │ ├── FBNavigationController.h │ │ ├── FBNavigationController.m │ │ ├── FBScrollViewController.h │ │ ├── FBScrollViewController.m │ │ ├── FBTableDataSource.h │ │ ├── FBTableDataSource.m │ │ ├── TouchSpotView.h │ │ ├── TouchSpotView.m │ │ ├── TouchViewController.h │ │ ├── TouchViewController.m │ │ ├── TouchableView.h │ │ ├── TouchableView.m │ │ ├── ViewController.h │ │ └── ViewController.m │ ├── Info.plist │ ├── Resources │ │ └── Base.lproj │ │ │ └── Main.storyboard │ └── main.m ├── IntegrationTests │ ├── FBAlertTests.m │ ├── FBAutoAlertsHandlerTests.m │ ├── FBConfigurationTests.m │ ├── FBElementAttributeTests.m │ ├── FBElementSwipingTests.m │ ├── FBElementVisibilityTests.m │ ├── FBFailureProofTestCaseTests.m │ ├── FBForceTouchTests.m │ ├── FBImageProcessorTests.m │ ├── FBIntegrationTestCase.h │ ├── FBIntegrationTestCase.m │ ├── FBKeyboardTests.m │ ├── FBPasteboardTests.m │ ├── FBPickerWheelSelectTests.m │ ├── FBSafariAlertTests.m │ ├── FBScreenTests.m │ ├── FBScrollingTests.m │ ├── FBSessionIntegrationTests.m │ ├── FBTapTest.m │ ├── FBTestMacros.h │ ├── FBTypingTest.m │ ├── FBVideoRecordingTests.m │ ├── FBW3CMultiTouchActionsIntegrationTests.m │ ├── FBW3CTouchActionsIntegrationTests.m │ ├── FBW3CTypeActionsTests.m │ ├── FBXPathIntegrationTests.m │ ├── Info.plist │ ├── XCElementSnapshotHelperTests.m │ ├── XCElementSnapshotHitPointTests.m │ ├── XCUIApplicationHelperTests.m │ ├── XCUIDeviceHealthCheckTests.m │ ├── XCUIDeviceHelperTests.m │ ├── XCUIDeviceRotationTests.m │ ├── XCUIElementAttributesTests.m │ ├── XCUIElementFBFindTests.m │ └── XCUIElementHelperIntegrationTests.m ├── UnitTests │ ├── Doubles │ │ ├── XCElementSnapshotDouble.h │ │ ├── XCElementSnapshotDouble.m │ │ ├── XCUIApplicationDouble.h │ │ ├── XCUIApplicationDouble.m │ │ ├── XCUIElementDouble.h │ │ └── XCUIElementDouble.m │ ├── FBClassChainTests.m │ ├── FBConfigurationTests.m │ ├── FBElementCacheTests.m │ ├── FBElementTypeTransformerTests.m │ ├── FBElementUtilitiesTests.m │ ├── FBErrorBuilderTests.m │ ├── FBExceptionHandlerTests.m │ ├── FBLRUCacheTests.m │ ├── FBMathUtilsTests.m │ ├── FBProtocolHelpersTests.m │ ├── FBRouteTests.m │ ├── FBRunLoopSpinnerTests.m │ ├── FBRuntimeUtilsTests.m │ ├── FBSDKVersionTests.m │ ├── FBSessionTests.m │ ├── FBXMLSafeStringTests.m │ ├── FBXPathTests.m │ ├── Info.plist │ ├── NSDictionaryFBUtf8SafeTests.m │ ├── NSExpressionFBFormatTests.m │ ├── NSPredicateFBFormatTests.m │ └── XCUIElementHelpersTests.m └── UnitTests_tvOS │ ├── Doubles │ ├── XCUIElementDouble.h │ └── XCUIElementDouble.m │ ├── FBTVNavigationTrackerTests.m │ └── Info.plist ├── azure-templates ├── base_job.yml ├── bootstrap_steps.yml └── node_setup_steps.yml ├── ci-jobs ├── scripts │ ├── azure-print-tag-name.js │ └── build-webdriveragents.js └── templates │ └── build.yml ├── index.js ├── lib ├── check-dependencies.js ├── constants.js ├── logger.js ├── no-session-proxy.js ├── utils.js ├── webdriveragent.js └── xcodebuild.js ├── package.json ├── test ├── functional │ ├── desired.js │ ├── helpers │ │ └── simulator.js │ └── webdriveragent-e2e-specs.js └── unit │ ├── utils-specs.js │ └── webdriveragent-specs.js └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | Resources 2 | coverage 3 | build 4 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@appium/eslint-config-appium-ts"], 3 | "overrides": [ 4 | { 5 | "files": "test/**/*.js", 6 | "rules": { 7 | "func-names": "off", 8 | "@typescript-eslint/no-var-requires": "off" 9 | } 10 | }, 11 | { 12 | "files": "Scripts/**/*.js", 13 | "parserOptions": {"sourceType": "script"}, 14 | "rules": { 15 | "@typescript-eslint/no-var-requires": "off" 16 | } 17 | }, 18 | { 19 | "files": "ci-jobs/scripts/*.js", 20 | "parserOptions": {"sourceType": "script"}, 21 | "rules": { 22 | "@typescript-eslint/no-var-requires": "off" 23 | } 24 | } 25 | ], 26 | "rules": { 27 | "require-await": "error" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Warning:** 2 | 3 | These issues are not tracked. Please create new issues in the main Appium 4 | repository: https://github.com/appium/appium/issues/new 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "11:00" 8 | open-pull-requests-limit: 10 9 | commit-message: 10 | prefix: "chore" 11 | include: "scope" 12 | -------------------------------------------------------------------------------- /.github/workflows/functional-test.yml: -------------------------------------------------------------------------------- 1 | name: Functional Tests 2 | 3 | on: [pull_request] 4 | 5 | 6 | jobs: 7 | test: 8 | env: 9 | CI: true 10 | _FORCE_LOGS: 1 11 | XCODE_VERSION: 13.4 12 | DEVICE_NAME: iPhone 11 13 | PLATFORM_VERSION: 15.5 14 | # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md 15 | runs-on: macos-12 16 | steps: 17 | - uses: actions/checkout@v3 18 | - uses: actions/setup-node@v3 19 | with: 20 | node-version: lts/* 21 | - uses: maxim-lobanov/setup-xcode@v1 22 | with: 23 | xcode-version: "${{ env.XCODE_VERSION }}" 24 | - run: | 25 | npm install 26 | mkdir -p ./Resources/WebDriverAgent.bundle 27 | name: Install dev dependencies 28 | 29 | - run: | 30 | target_sim_id=$(xcrun simctl list devices available | grep "$DEVICE_NAME (" | cut -d "(" -f2 | cut -d ")" -f1) 31 | open -Fn "$(xcode-select -p)/Applications/Simulator.app" 32 | xcrun simctl bootstatus $target_sim_id -b 33 | name: Preboot Simulator 34 | 35 | - run: npm run e2e-test 36 | name: Run functional tests 37 | -------------------------------------------------------------------------------- /.github/workflows/pr-title.yml: -------------------------------------------------------------------------------- 1 | name: Conventional Commits 2 | on: 3 | pull_request: 4 | 5 | 6 | jobs: 7 | lint: 8 | name: https://www.conventionalcommits.org 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: beemojs/conventional-pr-action@v2 12 | with: 13 | config-preset: angular 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/unit-test.yml: -------------------------------------------------------------------------------- 1 | name: Unit Tests 2 | 3 | on: [pull_request, push] 4 | 5 | 6 | jobs: 7 | prepare_matrix: 8 | runs-on: ubuntu-latest 9 | outputs: 10 | versions: ${{ steps.generate-matrix.outputs.versions }} 11 | steps: 12 | - name: Select 3 most recent LTS versions of Node.js 13 | id: generate-matrix 14 | run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:3] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT" 15 | 16 | test: 17 | needs: 18 | - prepare_matrix 19 | strategy: 20 | matrix: 21 | node-version: ${{ fromJSON(needs.prepare_matrix.outputs.versions) }} 22 | runs-on: macos-latest 23 | steps: 24 | - uses: actions/checkout@v3 25 | - uses: actions/setup-node@v3 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | - run: npm install --no-package-lock 29 | name: Install dev dependencies 30 | - run: npm run lint 31 | name: Run linter 32 | - run: npm run test 33 | name: Run unit tests 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | # 6 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 7 | 8 | ## Build generated 9 | build/ 10 | clang/ 11 | DerivedData 12 | 13 | ## Various settings 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | 24 | ## Other 25 | *.xccheckout 26 | *.moved-aside 27 | *.xcuserstate 28 | *.xcscmblueprint 29 | 30 | ## Obj-C/Swift specific 31 | *.hmap 32 | *.ipa 33 | 34 | # AppCode 35 | .idea/ 36 | 37 | # Modules map recreated on each build 38 | Modules/module.modulemap 39 | 40 | # test run 41 | *.trace 42 | 43 | # node stuff 44 | node_modules 45 | 46 | # webdriveragent zip bundles 47 | bundles/ 48 | webdriveragent-*.tar.gz 49 | uncompressed/ 50 | prebuilt-agents/ 51 | WebDriverAgentRunner-Runner.app.zip 52 | WebDriverAgentRunner-Runner.app/ 53 | 54 | # Ruby 55 | Gemfile.lock 56 | -------------------------------------------------------------------------------- /.mocharc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | require: ['ts-node/register'], 3 | forbidOnly: Boolean(process.env.CI) 4 | }; 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to WebDriverAgent 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Pull Requests 6 | We actively welcome your pull requests. 7 | 8 | 1. Fork the repo and create your branch from `master`. 9 | 2. If you've added code that should be tested, add tests 10 | 3. If you've changed APIs, update the documentation. 11 | 4. Ensure the test suite passes. 12 | 5. Make sure your code lints. 13 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 14 | 15 | ## Contributor License Agreement ("CLA") 16 | In order to accept your pull request, we need you to submit a CLA. You only need 17 | to do this once to work on any of Facebook's open source projects. 18 | 19 | Complete your CLA here: 20 | 21 | ## Issues 22 | We use GitHub issues to track public bugs. Please ensure your description is 23 | clear and has sufficient instructions to be able to reproduce the issue. 24 | 25 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe 26 | disclosure of security bugs. In those cases, please go through the process 27 | outlined on that page and do not file a public issue. 28 | 29 | ## Coding Style 30 | * 2 spaces for indentation rather than tabs 31 | * 80 character line length 32 | 33 | ## License 34 | By contributing to WebDriverAgent, you agree that your contributions will be licensed 35 | under its [BSD license](LICENSE). 36 | -------------------------------------------------------------------------------- /Configurations/IOSTestSettings.xcconfig: -------------------------------------------------------------------------------- 1 | EXCLUDED_ARCHS = i386 2 | -------------------------------------------------------------------------------- /Configurations/TVOSTestSettings.xcconfig: -------------------------------------------------------------------------------- 1 | EXCLUDED_ARCHS = i386 2 | 3 | -------------------------------------------------------------------------------- /Fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | XC_PROJECT = File.absolute_path('../WebDriverAgent.xcodeproj') 2 | 3 | lane :test do 4 | # https://docs.fastlane.tools/actions/scan/ 5 | run_tests( 6 | project: XC_PROJECT, 7 | fail_build: true, 8 | scheme: ENV['SCHEME'], 9 | sdk: ENV['SDK'], 10 | destination: ENV['DEST'], 11 | number_of_retries: 3 12 | ) 13 | end 14 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "fastlane", '2.217.0' 4 | -------------------------------------------------------------------------------- /Introduction/FailID.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/FailID.png -------------------------------------------------------------------------------- /Introduction/bundleId.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/bundleId.png -------------------------------------------------------------------------------- /Introduction/chooseScheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/chooseScheme.png -------------------------------------------------------------------------------- /Introduction/connectDevice.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/connectDevice.jpg -------------------------------------------------------------------------------- /Introduction/ios-airtestIDE.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/ios-airtestIDE.gif -------------------------------------------------------------------------------- /Introduction/ios-inspector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/ios-inspector.gif -------------------------------------------------------------------------------- /Introduction/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/login.png -------------------------------------------------------------------------------- /Introduction/signing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/signing.png -------------------------------------------------------------------------------- /Introduction/trust_dev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/trust_dev.png -------------------------------------------------------------------------------- /Introduction/trust_dev2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/trust_dev2.png -------------------------------------------------------------------------------- /Introduction/untrusted.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/untrusted.jpg -------------------------------------------------------------------------------- /Introduction/version_not_match.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/version_not_match.png -------------------------------------------------------------------------------- /Introduction/version_not_match2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/version_not_match2.png -------------------------------------------------------------------------------- /Introduction/versions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AirtestProject/iOS-Tagent/c0bf1303c14668b83370b82b39b5e0a50e4cfef6/Introduction/versions.png -------------------------------------------------------------------------------- /PrivateHeaders/AccessibilityUtilities/AXSettings.h: -------------------------------------------------------------------------------- 1 | 2 | /* Generated by RuntimeBrowser 3 | Image: /System/Library/PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities 4 | */ 5 | 6 | @interface AXSettings : NSObject 7 | 8 | @property bool reduceMotionEnabled; 9 | 10 | + (id)sharedInstance; 11 | 12 | - (void)setReduceMotionEnabled:(bool)arg1; 13 | - (bool)reduceMotionEnabled; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /PrivateHeaders/TextInput/TIPreferencesController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * iOS-Runtime-Headers/PrivateFrameworks/TextInput.framework. 3 | * Text Input preferences controller to modify the keyboard preferences for iOS 8+. 4 | * 5 | * Note: 6 | * "autocorrection" will be PrivateFrameworks/TextInput.framework/TIKeyboardState.h in the future? 7 | */ 8 | @interface TIPreferencesController : NSObject 9 | 10 | /** 11 | * Whether the autocorrection is enabled. 12 | */ 13 | @property BOOL autocorrectionEnabled; 14 | 15 | /** 16 | * Whether the predication is enabled. 17 | * */ 18 | @property BOOL predictionEnabled; 19 | 20 | /** 21 | The shared singleton instance. 22 | */ 23 | + (instancetype)sharedPreferencesController; 24 | 25 | /** 26 | Synchronise the change to save it on disk. 27 | */ 28 | - (void)synchronizePreferences; 29 | 30 | /** 31 | * Modify the preference @c value by the @c key 32 | * 33 | * @param value The value to set it to @c key 34 | * @param key The key name to set @c value to 35 | */ 36 | - (void)setValue:(NSValue *)value forPreferenceKey:(NSString *)key; 37 | 38 | /** 39 | * Get the preferenve by @c key 40 | * 41 | * @param key The key name to get the value 42 | * @return Whether the @c key is enabled 43 | */ 44 | - (BOOL)boolForPreferenceKey:(NSString *)key; 45 | @end 46 | -------------------------------------------------------------------------------- /PrivateHeaders/UIKitCore/UIKeyboardImpl.h: -------------------------------------------------------------------------------- 1 | #if TARGET_OS_SIMULATOR 2 | /** 3 | * iOS-Runtime-Headers/PrivateFrameworks/UIKitCore.framework/UIKeyboardImpl.h 4 | */ 5 | @interface UIKeyboardImpl 6 | + (instancetype)sharedInstance; 7 | /** 8 | * Modify software keyboard condition on simulators for over Xcode 6 9 | * This setting is global. The change applies to all instances of UIKeyboardImpl. 10 | * 11 | * Idea: https://chromium.googlesource.com/chromium/src/base/+/ababb4cf8b6049a642a2f361b1006a07561c2d96/test/test_support_ios.mm#41 12 | * 13 | * @param enabled Whether turn setAutomaticMinimizationEnabled on 14 | */ 15 | - (void)setAutomaticMinimizationEnabled:(BOOL)enabled; 16 | 17 | /** 18 | * Modify software keyboard condition on simulators for over Xcode 6 19 | * This setting is global. The change applies to all instances of UIKeyboardImpl. 20 | * 21 | * Idea: https://chromium.googlesource.com/chromium/src/base/+/ababb4cf8b6049a642a2f361b1006a07561c2d96/test/test_support_ios.mm#41 22 | * 23 | * @param enabled Whether turn setSoftwareKeyboardShownByTouch on 24 | */ 25 | - (void)setSoftwareKeyboardShownByTouch:(BOOL)enabled; 26 | @end 27 | #endif // TARGET_IPHONE_SIMULATOR 28 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/CDStructures.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #pragma mark Blocks 8 | 9 | typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown 10 | 11 | typedef struct { 12 | unsigned int _field1; 13 | unsigned int _field2; 14 | unsigned int _field3; 15 | unsigned int _field4; 16 | unsigned int _field5; 17 | unsigned int _field6; 18 | unsigned int _field7; 19 | } CDStruct_a561fd19; 20 | 21 | typedef struct { 22 | unsigned short _field1; 23 | unsigned short _field2; 24 | unsigned short _field3[1]; 25 | } CDStruct_27a325c0; 26 | 27 | int _XCTSetApplicationStateTimeout(double timeout); 28 | double _XCTApplicationStateTimeout(void); 29 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/NSString-XCTAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface NSString (XCTAdditions) 10 | - (id)xct_quotedSwiftStringRepresentation; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/NSValue-XCTestAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface NSValue (XCTestAdditions) 10 | - (id)xct_contentDescription; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/UIGestureRecognizer-RecordingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface UIGestureRecognizer (RecordingAdditions) 10 | - (id)_automationName; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/UILongPressGestureRecognizer-RecordingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface UILongPressGestureRecognizer (RecordingAdditions) 10 | - (id)_automationName; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/UIPanGestureRecognizer-RecordingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface UIPanGestureRecognizer (RecordingAdditions) 10 | - (id)_automationName; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/UIPinchGestureRecognizer-RecordingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface UIPinchGestureRecognizer (RecordingAdditions) 10 | - (id)_automationName; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/UISwipeGestureRecognizer-RecordingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface UISwipeGestureRecognizer (RecordingAdditions) 10 | - (id)_automationName; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/UITapGestureRecognizer-RecordingAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface UITapGestureRecognizer (RecordingAdditions) 10 | - (id)_automationName; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCApplicationMonitor_iOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface XCApplicationMonitor_iOS : XCApplicationMonitor 10 | { 11 | } 12 | 13 | - (void)_terminateApplicationProcess:(id)arg1; 14 | - (id)monitoredApplicationWithProcessIdentifier:(int)arg1; 15 | - (void)_beginMonitoringApplication:(id)arg1; 16 | - (id)init; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCApplicationQuery.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class XCUIApplication; 10 | 11 | @interface XCApplicationQuery : XCUIElementQuery 12 | { 13 | XCUIApplication *_application; 14 | id/*XCElementSnapshot*/ _lastSnapshot; 15 | } 16 | 17 | @property(retain) id/*XCElementSnapshot*/ lastSnapshot; // @synthesize lastSnapshot=_lastSnapshot; 18 | - (id)matchingSnapshotsWithError:(id *)arg1; 19 | - (id)application; 20 | - (id)initWithApplication:(id)arg1; 21 | 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCDebugLogDelegate-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSString; 8 | 9 | @protocol XCDebugLogDelegate 10 | - (void)logDebugMessage:(NSString *)arg1; 11 | @end 12 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCDeviceEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @interface XCDeviceEvent : NSObject 8 | { 9 | unsigned int _eventPage; 10 | unsigned int _usage; 11 | double _duration; 12 | unsigned long long _type; 13 | double _rotation; 14 | } 15 | @property unsigned long long type; // @synthesize type=_type; 16 | @property double rotation; // @synthesize rotation=_rotation; 17 | @property double duration; // @synthesize duration=_duration; 18 | @property unsigned int usage; // @synthesize usage=_usage; 19 | @property unsigned int eventPage; // @synthesize eventPage=_eventPage; 20 | @property(readonly) BOOL isButtonHoldEvent; 21 | 22 | + (id)deviceEventForDigitalCrownRotation:(double)arg1 velocity:(double)arg2; 23 | + (id)deviceEventWithPage:(unsigned int)arg1 usage:(unsigned int)arg2 duration:(double)arg3; 24 | 25 | - (void)dispatch; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCKeyboardLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSArray, NSData, NSString, XCKeyboardKeyMap; 8 | 9 | @interface XCKeyboardLayout : NSObject 10 | { 11 | struct __GSKeyboard *_source; 12 | NSString *_identifier; 13 | NSData *_data; 14 | NSArray *_keyMaps; 15 | XCKeyboardKeyMap *_primaryKeyMap; 16 | } 17 | @property(readonly) XCKeyboardKeyMap *primaryKeyMap; // @synthesize primaryKeyMap=_primaryKeyMap; 18 | @property(readonly, copy) NSString *identifier; // @synthesize identifier=_identifier; 19 | 20 | + (id)unicodeHexKeyboardLayout; 21 | + (id)currentKeyboardLayout; 22 | + (void)enumerateKeyboardLayoutsUsingBlock:(CDUnknownBlockType)arg1; 23 | + (id)keyboardLayoutWithInputSource:(struct __GSKeyboard *)arg1; 24 | + (id)keyboardLayoutWithIdentifier:(id)arg1; 25 | 26 | - (BOOL)deactivate:(id)arg1 error:(id *)arg2; 27 | - (id)activateWithError:(id *)arg1; 28 | - (id)_setActiveLayoutState:(id)arg1 error:(id *)arg2; 29 | - (void)enumerateKeyMapsUsingBlock:(CDUnknownBlockType)arg1; 30 | - (id)keyMapForKeyboardType:(unsigned long long)arg1; 31 | 32 | - (id)initWithInputSource:(struct __GSKeyboard *)arg1; 33 | - (id)init; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCPointerEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @interface XCPointerEvent : NSObject 8 | { 9 | unsigned long long _eventType; 10 | unsigned long long _buttonType; 11 | double _pressure; 12 | double _offset; 13 | struct CGPoint _coordinate; 14 | } 15 | @property double offset; // @synthesize offset=_offset; 16 | @property double pressure; // @synthesize pressure=_pressure; 17 | @property struct CGPoint coordinate; // @synthesize coordinate=_coordinate; 18 | @property unsigned long long buttonType; // @synthesize buttonType=_buttonType; 19 | @property unsigned long long eventType; // @synthesize eventType=_eventType; 20 | 21 | + (CDUnknownBlockType)offsetComparator; 22 | + (id)pointerEventWithType:(unsigned long long)arg1 buttonType:(unsigned long long)arg2 coordinate:(struct CGPoint)arg3 pressure:(double)arg4 offset:(double)arg5; 23 | + (id)pointerEventWithType:(unsigned long long)arg1 buttonType:(unsigned long long)arg2 coordinate:(struct CGPoint)arg3 offset:(double)arg4; 24 | // available since Xcode 10.2 25 | + (id)keyboardEventForKeyCode:(unsigned long long)arg1 keyPhase:(unsigned long long)arg2 modifierFlags:(unsigned long long)arg3 offset:(double)arg4; 26 | 27 | 28 | - (id)init; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCSourceCodeTreeNodeEnumerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSMutableArray; 8 | 9 | @interface XCSourceCodeTreeNodeEnumerator : NSObject 10 | { 11 | NSMutableArray *_remainingNodes; 12 | } 13 | 14 | - (id)nextObject; 15 | - (id)initWithNode:(id)arg1; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCSymbolicationRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSString; 8 | 9 | @interface XCSymbolicationRecord : NSObject 10 | { 11 | unsigned long long _lineNumber; 12 | NSString *_filePath; 13 | NSString *_symbolName; 14 | NSString *_symbolOwner; 15 | } 16 | @property(copy) NSString *symbolOwner; // @synthesize symbolOwner=_symbolOwner; 17 | @property(copy) NSString *symbolName; // @synthesize symbolName=_symbolName; 18 | @property(copy) NSString *filePath; // @synthesize filePath=_filePath; 19 | @property unsigned long long lineNumber; // @synthesize lineNumber=_lineNumber; 20 | 21 | + (id)symbolicationRecordFromRemoteServiceForAddress:(unsigned long long)arg1; 22 | + (id)symbolicationRecordForTask:(unsigned int)arg1 address:(unsigned long long)arg2; 23 | + (id)symbolicationRecordForAddress:(unsigned long long)arg1; 24 | + (void)_setCurrentProcessIsRemoteService; 25 | + (id)_symbolicationRecordForSymbolicator:(struct _CSTypeRef)arg1 address:(unsigned long long)arg2; 26 | + (id)failureRecord; 27 | + (BOOL)softLinkCoreSymbolication; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCSymbolicatorHolder.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @interface XCSymbolicatorHolder : NSObject 8 | { 9 | struct _CSTypeRef _symbolicator; 10 | } 11 | 12 | @property struct _CSTypeRef symbolicator; // @synthesize symbolicator=_symbolicator; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCSynthesizedEventRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSArray, NSMutableArray, NSString, XCPointerEventPath; 8 | 9 | @interface XCSynthesizedEventRecord : NSObject 10 | { 11 | NSMutableArray *_eventPaths; 12 | NSString *_name; 13 | #if !TARGET_OS_TV 14 | UIInterfaceOrientation _interfaceOrientation; 15 | #endif 16 | } 17 | #if !TARGET_OS_TV 18 | @property(readonly) UIInterfaceOrientation interfaceOrientation; // @synthesize interfaceOrientation=_interfaceOrientation; 19 | #endif 20 | @property(readonly, copy) NSString *name; // @synthesize name=_name; 21 | @property(readonly) double maximumOffset; 22 | @property(readonly) NSArray *eventPaths; 23 | 24 | - (void)addPointerEventPath:(XCPointerEventPath *)arg1; 25 | #if !TARGET_OS_TV 26 | - (id)initWithName:(NSString *)arg1 interfaceOrientation:(UIInterfaceOrientation)arg2; 27 | #endif 28 | - (id)initWithName:(id)arg1; 29 | - (id)init; 30 | - (BOOL)synthesizeWithError:(NSError **)arg1; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTAXClient-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSData; 10 | 11 | @protocol XCTAXClient 12 | - (void)handleAccessibilityNotification:(int)arg1 withPayload:(NSData *)arg2; 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTAsyncActivity-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSError; 10 | 11 | @protocol XCTAsyncActivity 12 | @property(readonly) BOOL timedOut; 13 | @property(readonly) NSError *error; 14 | - (void)finishWithError:(NSError *)arg1; 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTAsyncActivity.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | #import "XCTAsyncActivity.h" 10 | 11 | @class NSError, NSString; 12 | 13 | @interface XCTAsyncActivity : XCTestExpectation 14 | { 15 | NSError *_error; 16 | BOOL _timedOut; 17 | } 18 | @property BOOL timedOut; // @synthesize timedOut=_timedOut; 19 | @property(retain) NSError *error; // @synthesize error=_error; 20 | 21 | - (void)finishWithError:(id)arg1; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTAutomationTarget-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @protocol XCTAutomationTarget 10 | - (void)requestHostAppExecutableNameWithReply:(void (^)(NSString *))arg1; 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTDarwinNotificationExpectation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSString, _XCTDarwinNotificationExpectationImplementation; 10 | 11 | @interface XCTDarwinNotificationExpectation : XCTestExpectation 12 | { 13 | id _internal; 14 | } 15 | @property(retain) _XCTDarwinNotificationExpectationImplementation *internal; // @synthesize internal=_internal; 16 | @property(copy) CDUnknownBlockType handler; 17 | @property(readonly, copy) NSString *notificationName; 18 | 19 | - (void)cleanup; 20 | - (void)fulfill; 21 | - (id)initWithNotificationName:(id)arg1; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTElementSetTransformer-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard. 5 | // 6 | 7 | @class NSOrderedSet, NSSet, NSString; 8 | @protocol XCTMatchingElementIterator; 9 | 10 | @protocol XCTElementSetTransformer 11 | @property BOOL stopsOnFirstMatch; 12 | @property(readonly) BOOL supportsAttributeKeyPathAnalysis; 13 | @property(copy) NSString *transformationDescription; 14 | @property(readonly) BOOL supportsRemoteEvaluation; 15 | - (NSSet *)requiredKeyPathsOrError:(id *)arg1; 16 | - (id )iteratorForInput:(id/*XCElementSnapshot*/)arg1; 17 | - (NSOrderedSet *)transform:(NSOrderedSet *)arg1 relatedElements:(id *)arg2; 18 | @end 19 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTKVOExpectation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSString, _XCKVOExpectationImplementation; 10 | 11 | @interface XCTKVOExpectation : XCTestExpectation 12 | { 13 | id _internal; 14 | } 15 | @property(retain) _XCKVOExpectationImplementation *internal; // @synthesize internal=_internal; 16 | @property(copy) CDUnknownBlockType handler; 17 | @property(readonly) unsigned long long options; 18 | @property(readonly) id expectedValue; 19 | @property(readonly) id observedObject; 20 | @property(readonly, copy) NSString *keyPath; 21 | 22 | - (void)cleanup; 23 | - (void)fulfill; 24 | - (id)initWithKeyPath:(id)arg1 object:(id)arg2; 25 | - (id)initWithKeyPath:(id)arg1 object:(id)arg2 expectedValue:(id)arg3; 26 | - (id)initWithKeyPath:(id)arg1 object:(id)arg2 expectedValue:(id)arg3 options:(unsigned long long)arg4; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTMetric.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSArray, NSDictionary, NSString; 10 | 11 | @interface XCTMetric : NSObject 12 | { 13 | NSString *_identifier; 14 | NSString *_name; 15 | NSString *_units; 16 | NSDictionary *_baseline; 17 | NSDictionary *_defaultBaseline; 18 | NSArray *_measurements; 19 | } 20 | @property(copy) NSArray *measurements; // @synthesize measurements=_measurements; 21 | @property(copy) NSDictionary *defaultBaseline; // @synthesize defaultBaseline=_defaultBaseline; 22 | @property(copy) NSDictionary *baseline; // @synthesize baseline=_baseline; 23 | @property(copy) NSString *units; // @synthesize units=_units; 24 | @property(copy) NSString *name; // @synthesize name=_name; 25 | @property(copy) NSString *identifier; // @synthesize identifier=_identifier; 26 | 27 | - (id)init; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTNSNotificationExpectation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSNotificationCenter, NSString, _XCTNSNotificationExpectationImplementation; 10 | 11 | @interface XCTNSNotificationExpectation : XCTestExpectation 12 | { 13 | id _internal; 14 | } 15 | @property(retain) _XCTNSNotificationExpectationImplementation *internal; // @synthesize internal=_internal; 16 | @property(copy) CDUnknownBlockType handler; 17 | @property(readonly) NSNotificationCenter *notificationCenter; 18 | @property(readonly, copy) NSString *notificationName; 19 | @property(readonly) id observedObject; 20 | 21 | - (void)cleanup; 22 | - (void)fulfill; 23 | - (id)initWithName:(id)arg1; 24 | - (id)initWithName:(id)arg1 object:(id)arg2; 25 | - (id)initWithName:(id)arg1 object:(id)arg2 notificationCenter:(id)arg3; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTNSPredicateExpectation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSPredicate, _XCTNSPredicateExpectationImplementation; 10 | 11 | @interface XCTNSPredicateExpectation : XCTestExpectation 12 | { 13 | id _internal; 14 | } 15 | @property(retain) _XCTNSPredicateExpectationImplementation *internal; // @synthesize internal=_internal; 16 | @property(copy) CDUnknownBlockType handler; 17 | @property(readonly, copy) NSPredicate *predicate; 18 | @property(readonly) id object; 19 | 20 | - (void)cleanup; 21 | - (void)fulfill; 22 | - (id)initWithPredicate:(id)arg1 object:(id)arg2; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTNSPredicateExpectationObject-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class XCTNSPredicateExpectation; 10 | 11 | @protocol XCTNSPredicateExpectationObject 12 | 13 | @optional 14 | - (BOOL)evaluatePredicateForExpectation:(XCTNSPredicateExpectation *)arg1 debugMessage:(id *)arg2; 15 | @end 16 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTRunnerAutomationSession.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | #import "XCTRunnerAutomationSession.h" 10 | 11 | @class NSString, NSXPCConnection; 12 | 13 | @interface XCTRunnerAutomationSession : NSObject 14 | { 15 | NSXPCConnection *_connection; 16 | } 17 | @property NSXPCConnection *connection; // @synthesize connection=_connection; 18 | 19 | - (id)initWithEndpoint:(id)arg1; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTTestRunSession.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class XCTestConfiguration; 10 | 11 | @interface XCTTestRunSession : NSObject 12 | { 13 | XCTestConfiguration *_testConfiguration; 14 | id _delegate; 15 | } 16 | @property id delegate; // @synthesize delegate=_delegate; 17 | @property(retain) XCTestConfiguration *testConfiguration; // @synthesize testConfiguration=_testConfiguration; 18 | 19 | - (BOOL)runTestsAndReturnError:(id *)arg1; 20 | - (BOOL)_preTestingInitialization; 21 | - (void)resumeAppSleep:(id)arg1; 22 | - (id)suspendAppSleep; 23 | - (id)initWithTestConfiguration:(id)arg1 delegate:(id)arg2; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTTestRunSessionDelegate-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSError, XCTTestRunSession; 10 | 11 | @protocol XCTTestRunSessionDelegate 12 | - (void)testRunSessionDidFinishExecutingTestPlan:(XCTTestRunSession *)arg1 reply:(void (^)(void))arg2; 13 | - (void)testRunSession:(XCTTestRunSession *)arg1 initializationForUITestingDidFailWithError:(NSError *)arg2; 14 | - (void)testRunSessionDidBeginInitializingForUITesting:(XCTTestRunSession *)arg1; 15 | - (void)testRunSessionDidBeginExecutingTestPlan:(XCTTestRunSession *)arg1; 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTUIApplicationMonitor-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSNumber, NSString; 10 | 11 | @protocol XCTUIApplicationMonitor 12 | - (void)applicationWithBundleID:(NSString *)arg1 didUpdatePID:(int)arg2 state:(unsigned long long)arg3; 13 | - (void)processWithToken:(NSNumber *)arg1 exitedWithStatus:(int)arg2; 14 | - (void)stopTrackingProcessWithToken:(NSNumber *)arg1; 15 | - (void)crashInProcessWithBundleID:(NSString *)arg1 path:(NSString *)arg2 pid:(int)arg3 symbol:(NSString *)arg4; 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTWaiterDelegate-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSArray, XCTWaiter, XCTestExpectation; 10 | 11 | @protocol XCTWaiterDelegate 12 | - (void)waiter:(XCTWaiter *)arg1 didFulfillInvertedExpectation:(XCTestExpectation *)arg2; 13 | - (void)waiter:(XCTWaiter *)arg1 fulfillmentDidViolateOrderingConstraintsForExpectation:(XCTestExpectation *)arg2 requiredExpectation:(XCTestExpectation *)arg3; 14 | - (void)waiter:(XCTWaiter *)arg1 didTimeoutWithUnfulfilledExpectations:(NSArray *)arg2; 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTWaiterDelegatePrivate-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class XCTWaiter; 8 | 9 | @protocol XCTWaiterDelegatePrivate 10 | - (void)nestedWaiter:(XCTWaiter *)arg1 wasInterruptedByTimedOutWaiter:(XCTWaiter *)arg2; 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTWaiterManagement-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @protocol XCTWaiterManagement 10 | @property(readonly, getter=isInProgress) BOOL inProgress; 11 | - (void)interruptForWaiter:(id )arg1; 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTWaiterManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSMutableArray, NSObject, NSThread; 10 | 11 | @interface XCTWaiterManager : NSObject 12 | { 13 | NSMutableArray *_waiterStack; 14 | NSThread *_thread; 15 | NSObject *_queue; 16 | } 17 | @property(readonly) NSObject *queue; // @synthesize queue=_queue; 18 | @property NSThread *thread; // @synthesize thread=_thread; 19 | @property(retain) NSMutableArray *waiterStack; // @synthesize waiterStack=_waiterStack; 20 | 21 | + (id)threadLocalManager; 22 | 23 | - (void)waiterDidFinishWaiting:(id)arg1; 24 | - (void)waiterTimedOutWhileWaiting:(id)arg1; 25 | - (void)waiterWillBeginWaiting:(id)arg1; 26 | - (id)init; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSString, XCTestRun; 8 | 9 | @interface XCTest : NSObject 10 | { 11 | id _internal; 12 | } 13 | @property(readonly) NSString *nameForLegacyLogging; 14 | @property(readonly) NSString *languageAgnosticTestMethodName; 15 | @property(readonly) NSString *languageAgnosticTestClassName; 16 | @property(readonly) XCTestRun *testRun; 17 | @property(readonly) Class testRunClass; 18 | @property(readonly) Class _requiredTestRunBaseClass; 19 | @property(readonly, copy) NSString *name; 20 | @property(readonly) unsigned long long testCaseCount; 21 | @property(readonly) NSString *_methodNameForReporting; 22 | @property(readonly) NSString *_classNameForReporting; 23 | 24 | + (id)languageAgnosticTestClassNameForTestClass:(Class)arg1; 25 | 26 | - (void)tearDown; 27 | - (void)setUp; 28 | - (void)runTest; 29 | - (id)run; 30 | - (void)performTest:(id)arg1; 31 | - (id)init; 32 | - (void)removeTestsWithNames:(id)arg1; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestCaseRun.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface XCTestCaseRun : XCTestRun 10 | { 11 | } 12 | 13 | - (void)_recordValues:(id)arg1 forPerformanceMetricID:(id)arg2 name:(id)arg3 unitsOfMeasurement:(id)arg4 baselineName:(id)arg5 baselineAverage:(id)arg6 maxPercentRegression:(id)arg7 maxPercentRelativeStandardDeviation:(id)arg8 maxRegression:(id)arg9 maxStandardDeviation:(id)arg10 file:(id)arg11 line:(unsigned long long)arg12; 14 | - (void)recordFailureInTest:(id)arg1 withDescription:(id)arg2 inFile:(id)arg3 atLine:(unsigned long long)arg4 expected:(BOOL)arg5; 15 | - (void)stop; 16 | - (void)start; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestCaseSuite.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface XCTestCaseSuite : XCTestSuite 10 | { 11 | Class _testCaseClass; 12 | } 13 | 14 | + (id)emptyTestSuiteForTestCaseClass:(Class)arg1; 15 | - (void)tearDown; 16 | - (void)setUp; 17 | - (id)initWithTestCaseClass:(Class)arg1; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSArray, XCTestContextScope; 8 | 9 | @interface XCTestContext : NSObject 10 | { 11 | BOOL _didHandleUIInterruption; 12 | XCTestContextScope *_currentScope; 13 | } 14 | @property BOOL didHandleUIInterruption; // @synthesize didHandleUIInterruption=_didHandleUIInterruption; 15 | @property(retain, nonatomic) XCTestContextScope *currentScope; // @synthesize currentScope=_currentScope; 16 | @property(readonly, copy) NSArray *handlers; 17 | 18 | + (CDUnknownBlockType)defaultAsynchronousUIElementHandler; 19 | 20 | - (BOOL)handleAsynchronousUIElement:(id)arg1; 21 | - (void)removeUIInterruptionMonitor:(id)arg1; 22 | - (id)addUIInterruptionMonitorWithDescription:(id)arg1 handler:(CDUnknownBlockType)arg2; 23 | - (void)performInScope:(CDUnknownBlockType)arg1; 24 | - (id)init; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestContextScope.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSMutableArray; 8 | 9 | @interface XCTestContextScope : NSObject 10 | { 11 | XCTestContextScope *_parentScope; 12 | NSMutableArray *_handlers; 13 | } 14 | @property(copy) NSMutableArray *handlers; // @synthesize handlers=_handlers; 15 | @property(readonly) XCTestContextScope *parentScope; // @synthesize parentScope=_parentScope; 16 | 17 | - (id)initWithParentScope:(id)arg1; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestDriverInterface-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSNumber; 8 | 9 | @protocol XCTestDriverInterface 10 | - (id)_IDE_processWithToken:(NSNumber *)arg1 exitedWithStatus:(NSNumber *)arg2; 11 | - (id)_IDE_stopTrackingProcessWithToken:(NSNumber *)arg1; 12 | - (id)_IDE_processWithBundleID:(NSString *)arg1 path:(NSString *)arg2 pid:(NSNumber *)arg3 crashedUnderSymbol:(NSString *)arg4; 13 | - (id)_IDE_startExecutingTestPlanWithProtocolVersion:(NSNumber *)arg1; 14 | @end 15 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestExpectation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | 8 | 9 | @class _XCTestExpectationImplementation; 10 | 11 | @interface XCTestExpectation : NSObject 12 | { 13 | id _internalImplementation; 14 | } 15 | @property BOOL hasBeenWaitedOn; 16 | @property id delegate; 17 | @property(readonly, copy) NSArray *fulfillCallStackReturnAddresses; 18 | @property(readonly) BOOL fulfilled; 19 | @property BOOL hasInverseBehavior; 20 | @property(getter=isInverted) BOOL inverted; 21 | @property(nonatomic) BOOL assertForOverFulfill; 22 | @property(nonatomic) unsigned long long expectedFulfillmentCount; 23 | @property(nonatomic) unsigned long long fulfillmentCount; 24 | @property(readonly) unsigned long long fulfillmentToken; 25 | @property(readonly) _XCTestExpectationImplementation *internalImplementation; // @synthesize internalImplementation=_internalImplementation; 26 | @property(copy) NSString *expectationDescription; 27 | @property(readonly, nonatomic) NSObject *delegateQueue; 28 | @property(readonly, nonatomic) NSObject *queue; 29 | 30 | + (id)expectationWithDescription:(id)arg1; 31 | 32 | - (void)cleanup; 33 | - (void)_queue_fulfillWithCallStackReturnAddresses:(id)arg1; 34 | - (void)fulfill; 35 | 36 | - (id)initWithDescription:(id)arg1; 37 | - (id)init; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestExpectationDelegate-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class XCTestExpectation; 10 | 11 | @protocol XCTestExpectationDelegate 12 | - (void)didFulfillExpectation:(XCTestExpectation *)arg1; 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestExpectationWaiter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface XCTestExpectationWaiter : XCTWaiter 10 | { 11 | } 12 | 13 | - (long long)wait:(double)arg1 forExpectations:(id)arg2 enforceOrder:(BOOL)arg3; 14 | - (long long)wait:(double)arg1 forExpectations:(id)arg2; 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestManager_TestsInterface-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSData, NSString; 8 | 9 | @protocol XCTestManager_TestsInterface 10 | - (void)_XCT_receivedAccessibilityNotification:(int)arg1 withPayload:(NSData *)arg2; 11 | - (void)_XCT_applicationWithBundleID:(NSString *)arg1 didUpdatePID:(int)arg2 andState:(unsigned long long)arg3; 12 | @end 13 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestMisuseObserver.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | #import "XCTestObservation.h" 10 | 11 | @class NSMutableArray, NSString, XCTestCase, XCTestSuite; 12 | 13 | @interface XCTestMisuseObserver : NSObject 14 | { 15 | CDUnknownBlockType _warningLogHandler; 16 | NSMutableArray *_testSuiteStack; 17 | XCTestCase *_currentTestCase; 18 | } 19 | @property(retain) XCTestCase *currentTestCase; // @synthesize currentTestCase=_currentTestCase; 20 | @property(readonly) NSMutableArray *testSuiteStack; // @synthesize testSuiteStack=_testSuiteStack; 21 | @property(readonly, copy) CDUnknownBlockType warningLogHandler; // @synthesize warningLogHandler=_warningLogHandler; 22 | @property(readonly) XCTestSuite *currentTestSuite; 23 | 24 | - (void)testCaseDidFinish:(id)arg1; 25 | - (void)testCase:(id)arg1 didFailWithDescription:(id)arg2 inFile:(id)arg3 atLine:(unsigned long long)arg4; 26 | - (void)testCaseWillStart:(id)arg1; 27 | - (void)testSuiteDidFinish:(id)arg1; 28 | - (void)testSuiteWillStart:(id)arg1; 29 | - (BOOL)testSuiteStackContainsTestSuite:(id)arg1; 30 | - (void)removeTestSuiteFromStack:(id)arg1; 31 | - (void)popCurrentTestSuite; 32 | - (void)pushTestSuite:(id)arg1; 33 | - (void)emitWarningLog:(id)arg1; 34 | 35 | - (id)initWithWarningLogHandler:(CDUnknownBlockType)arg1; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestObservation-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSBundle, NSString, XCTestCase, XCTestSuite; 8 | 9 | @protocol XCTestObservation 10 | 11 | @optional 12 | - (void)testCaseDidFinish:(XCTestCase *)arg1; 13 | - (void)testCase:(XCTestCase *)arg1 didFailWithDescription:(NSString *)arg2 inFile:(NSString *)arg3 atLine:(unsigned long long)arg4; 14 | - (void)testCaseWillStart:(XCTestCase *)arg1; 15 | - (void)testSuiteDidFinish:(XCTestSuite *)arg1; 16 | - (void)testSuite:(XCTestSuite *)arg1 didFailWithDescription:(NSString *)arg2 inFile:(NSString *)arg3 atLine:(unsigned long long)arg4; 17 | - (void)testSuiteWillStart:(XCTestSuite *)arg1; 18 | - (void)testBundleDidFinish:(NSBundle *)arg1; 19 | - (void)testBundleWillStart:(NSBundle *)arg1; 20 | @end 21 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestObserver.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @interface XCTestObserver : NSObject 8 | { 9 | } 10 | 11 | - (void)testCaseDidFail:(id)arg1 withDescription:(id)arg2 inFile:(id)arg3 atLine:(unsigned long long)arg4; 12 | - (void)testCaseDidStop:(id)arg1; 13 | - (void)testCaseDidStart:(id)arg1; 14 | - (void)testSuiteDidFail:(id)arg1 withDescription:(id)arg2 inFile:(id)arg3 atLine:(unsigned long long)arg4; 15 | - (void)testSuiteDidStop:(id)arg1; 16 | - (void)testSuiteDidStart:(id)arg1; 17 | - (void)stopObserving; 18 | - (void)startObserving; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestProbe.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @interface XCTestProbe : NSObject 8 | { 9 | } 10 | 11 | + (BOOL)isTesting; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestRun.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSDate, XCTest, _XCInternalTestRun; 10 | 11 | @interface XCTestRun () 12 | { 13 | id _internalTestRun; 14 | } 15 | @property(readonly) _XCInternalTestRun *implementation; // @synthesize implementation=_internalTestRun; 16 | @property(readonly) BOOL hasSucceeded; 17 | @property unsigned long long unexpectedExceptionCountBeforeCrash; 18 | @property unsigned long long failureCountBeforeCrash; 19 | @property unsigned long long executionCountBeforeCrash; 20 | @property(readonly) unsigned long long testCaseCount; 21 | @property(readonly) unsigned long long unexpectedExceptionCount; 22 | @property(readonly) unsigned long long failureCount; 23 | @property(readonly) unsigned long long totalFailureCount; 24 | @property(readonly) unsigned long long executionCount; 25 | @property(readonly, copy) NSDate *stopDate; 26 | @property(readonly, copy) NSDate *startDate; 27 | @property(readonly) double testDuration; 28 | @property(readonly) double totalDuration; 29 | @property(readonly) XCTest *test; 30 | 31 | + (id)testRunWithTest:(id)arg1; 32 | 33 | - (void)recordFailureWithDescription:(id)arg1 inFile:(id)arg2 atLine:(unsigned long long)arg3 expected:(BOOL)arg4; 34 | - (void)stop; 35 | - (void)start; 36 | - (id)init; 37 | - (id)initWithTest:(id)arg1; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestSuiteRun.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSArray, NSMutableArray; 10 | 11 | @interface XCTestSuiteRun : XCTestRun 12 | { 13 | NSMutableArray *_testRuns; 14 | } 15 | @property(readonly, copy) NSArray *testRuns; 16 | 17 | - (void)recordFailureWithDescription:(id)arg1 inFile:(id)arg2 atLine:(unsigned long long)arg3 expected:(BOOL)arg4; 18 | - (double)testDuration; 19 | - (unsigned long long)unexpectedExceptionCount; 20 | - (unsigned long long)failureCount; 21 | - (unsigned long long)executionCount; 22 | - (void)addTestRun:(id)arg1; 23 | - (void)stop; 24 | - (void)start; 25 | 26 | - (id)initWithTest:(id)arg1; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCTestWaiter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface XCTestWaiter : XCTWaiter 10 | { 11 | } 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIApplicationImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSString, XCUIApplicationProcess; 10 | 11 | @interface XCUIApplicationImpl : NSObject 12 | { 13 | NSString *_path; 14 | NSString *_bundleID; 15 | XCUIApplicationProcess *_currentProcess; 16 | } 17 | 18 | @property(retain, nonatomic) XCUIApplicationProcess *currentProcess; // @synthesize currentProcess=_currentProcess; 19 | @property(readonly, copy) NSString *bundleID; // @synthesize bundleID=_bundleID; 20 | @property(readonly, copy) NSString *path; // @synthesize path=_path; 21 | @property(nonatomic) unsigned long long state; 22 | @property(nonatomic) int processID; 23 | @property(readonly) id/*XCAccessibilityElement*/ accessibilityElement; 24 | 25 | - (instancetype)initWithPath:(id)arg1 bundleID:(id)arg2; 26 | 27 | - (void)launchWithArguments:(id)arg1 environment:(id)arg2 usingXcode:(BOOL)arg3; 28 | - (void)handleCrashUnderSymbol:(id)arg1; 29 | - (void)terminate; 30 | 31 | - (void)waitForViewControllerViewDidDisappearWithTimeout:(double)arg1; 32 | 33 | - (void)_waitForRunningActive; 34 | - (void)_launchUsingPlatformWithArguments:(id)arg1 environment:(id)arg2; 35 | - (void)_launchUsingXcodeWithArguments:(id)arg1 environment:(id)arg2; 36 | - (void)_waitForLaunchProgress; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @interface XCUIDevice () 10 | 11 | // Since Xcode 10.2 12 | @property (readonly) id accessibilityInterface; // implements XCUIAccessibilityInterface 13 | @property (readonly) id eventSynthesizer; // implements XCUIEventSynthesizing 14 | @property (readonly) id screenDataSource; // @synthesize screenDataSource=_screenDataSource; 15 | 16 | - (_Bool)performDeviceEvent:(id)arg1 error:(id *)arg2; 17 | 18 | // Since Xcode 13 19 | // 1 - Light 20 | // 2 - Dark 21 | - (void)setAppearanceMode:(long long)arg1; 22 | - (long long)appearanceMode; 23 | 24 | - (void)pressLockButton; 25 | - (void)holdHomeButtonForDuration:(double)arg1; 26 | - (void)_silentPressButton:(long long)arg1; 27 | // Since Xcode 11 28 | - (_Bool)supportsPressureInteraction; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIElementAsynchronousHandlerWrapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSString, NSUUID; 8 | 9 | @interface XCUIElementAsynchronousHandlerWrapper : NSObject 10 | { 11 | CDUnknownBlockType _handler; 12 | NSString *_handlerDescription; 13 | NSUUID *_identifier; 14 | } 15 | @property(copy) NSUUID *identifier; // @synthesize identifier=_identifier; 16 | @property(copy) NSString *handlerDescription; // @synthesize handlerDescription=_handlerDescription; 17 | @property(copy) CDUnknownBlockType handler; // @synthesize handler=_handler; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIElementHitPointCoordinate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | #import 9 | 10 | #if !TARGET_OS_IPHONE 11 | 12 | @interface XCUIElementHitPointCoordinate : XCUICoordinate 13 | { 14 | } 15 | 16 | - (id)description; 17 | - (struct CGPoint)screenPoint; 18 | - (id)initWithCoordinate:(id)arg1 pointsOffset:(struct CGVector)arg2; 19 | - (id)initWithElement:(id)arg1 normalizedOffset:(struct CGVector)arg2; 20 | - (id)initWithElement:(id)arg1; 21 | 22 | @end 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIHitPointResult.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | #import 9 | 10 | @interface XCUIHitPointResult : NSObject 11 | { 12 | BOOL _hittable; 13 | CGPoint _hitPoint; 14 | } 15 | 16 | @property(readonly, getter=isHittable) BOOL hittable; // @synthesize hittable=_hittable; 17 | @property(readonly) struct CGPoint hitPoint; // @synthesize hitPoint=_hitPoint; 18 | - (id)initWithHitPoint:(struct CGPoint)arg1 hittable:(BOOL)arg2; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIRecorderNodeFinderMatch.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSMutableArray, NSSet, XCSourceCodeTreeNode, XCUIRecorderNodeFinder; 8 | 9 | @interface XCUIRecorderNodeFinderMatch : NSObject 10 | { 11 | NSSet *_matchingSnapshots; 12 | XCSourceCodeTreeNode *_node; 13 | XCUIRecorderNodeFinder *_ancestorFinder; 14 | NSMutableArray *_descendantFinders; 15 | } 16 | @property(retain) NSMutableArray *descendantFinders; // @synthesize descendantFinders=_descendantFinders; 17 | @property(retain) XCUIRecorderNodeFinder *ancestorFinder; // @synthesize ancestorFinder=_ancestorFinder; 18 | @property(retain) XCSourceCodeTreeNode *node; // @synthesize node=_node; 19 | @property(copy) NSSet *matchingSnapshots; // @synthesize matchingSnapshots=_matchingSnapshots; 20 | 21 | - (void)invalidate; 22 | - (id)nodeIncludingDescendants; 23 | - (id)initWithNode:(id)arg1 matchingSnapshots:(id)arg2 ancestorFinder:(id)arg3; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIRecorderTimingMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSString; 8 | 9 | @interface XCUIRecorderTimingMessage : NSObject 10 | { 11 | double _start; 12 | NSString *_message; 13 | } 14 | @property(copy) NSString *message; // @synthesize message=_message; 15 | @property double start; // @synthesize start=_start; 16 | 17 | + (id)descriptionForTimingMessages:(id)arg1; 18 | + (id)messageWithString:(id)arg1; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIScreen.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit) (Debug version compiled Nov 29 2017 14:55:25). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. 5 | // 6 | 7 | @interface XCUIScreen() 8 | { 9 | _Bool _isMainScreen; 10 | long long _displayID; 11 | } 12 | @property(readonly) _Bool isMainScreen; // @synthesize isMainScreen=_isMainScreen; 13 | @property(readonly) long long displayID; // @synthesize displayID=_displayID; 14 | 15 | - (id)_clippedScreenshotData:(id)arg1 quality:(long long)arg2 rect:(struct CGRect)arg3 scale:(double)arg4; 16 | - (id)_screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3; 17 | - (id)screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3; 18 | - (id)screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2; 19 | - (id)_modernScreenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3; 20 | - (id)screenshot; 21 | - (id)_imageFromData:(id)arg1; 22 | - (double)scale; 23 | 24 | - (id)initWithDisplayID:(long long)arg1 isMainScreen:(_Bool)arg2 device:(id)arg3 screenDataSource:(id)arg4; 25 | 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/XCUIScreenDataSource-Protocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSString; 8 | 9 | @protocol XCUIScreenDataSource 10 | - (void)requestScreenshotOfScreenWithID:(long long)arg1 11 | withRect:(struct CGRect)arg2 12 | scale:(double)arg3 13 | formatUTI:(NSString *)arg4 14 | compressionQuality:(double)arg5 15 | withReply:(void (^)(NSData *, NSError *))arg6; 16 | - (void)requestScaleForScreenWithIdentifier:(long long)arg1 completion:(void (^)(double, NSError *))arg2; 17 | - (void)requestScreenIdentifiersWithCompletion:(void (^)(NSArray *, NSError *))arg1; 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCKVOExpectationImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSObject, NSString, XCTKVOExpectation; 10 | 11 | @interface _XCKVOExpectationImplementation : NSObject 12 | { 13 | XCTKVOExpectation *_expectation; 14 | id _observedObject; 15 | NSString *_keyPath; 16 | id _expectedValue; 17 | unsigned long long _options; 18 | CDUnknownBlockType _handler; 19 | NSObject *_queue; 20 | BOOL _hasCleanedUp; 21 | } 22 | @property(readonly) unsigned long long options; // @synthesize options=_options; 23 | @property(readonly) id expectedValue; // @synthesize expectedValue=_expectedValue; 24 | @property(readonly, copy) NSString *keyPath; // @synthesize keyPath=_keyPath; 25 | @property(readonly) id observedObject; // @synthesize observedObject=_observedObject; 26 | @property(copy) CDUnknownBlockType handler; 27 | 28 | - (void)cleanup; 29 | - (void)observeValueForKeyPath:(id)arg1 ofObject:(id)arg2 change:(id)arg3 context:(void *)arg4; 30 | - (id)initWithKeyPath:(id)arg1 object:(id)arg2 expectedValue:(id)arg3 expectation:(id)arg4 options:(unsigned long long)arg5; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTDarwinNotificationExpectationImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSObject, NSString, XCTDarwinNotificationExpectation; 10 | 11 | @interface _XCTDarwinNotificationExpectationImplementation : NSObject 12 | { 13 | XCTDarwinNotificationExpectation *_expectation; 14 | NSString *_notificationName; 15 | int _notifyToken; 16 | CDUnknownBlockType _handler; 17 | NSObject *_queue; 18 | BOOL _hasCleanedUp; 19 | } 20 | @property(readonly, copy) NSString *notificationName; // @synthesize notificationName=_notificationName; 21 | @property(copy) CDUnknownBlockType handler; 22 | 23 | - (void)cleanup; 24 | - (void)_handleNotification; 25 | - (id)initWithNotificationName:(id)arg1 expectation:(id)arg2; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTNSNotificationExpectationImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSNotificationCenter, NSObject, NSString, XCTNSNotificationExpectation; 10 | 11 | @interface _XCTNSNotificationExpectationImplementation : NSObject 12 | { 13 | XCTNSNotificationExpectation *_expectation; 14 | id _observedObject; 15 | NSString *_notificationName; 16 | NSNotificationCenter *_notificationCenter; 17 | CDUnknownBlockType _handler; 18 | NSObject *_queue; 19 | BOOL _hasCleanedUp; 20 | } 21 | @property(readonly) NSNotificationCenter *notificationCenter; // @synthesize notificationCenter=_notificationCenter; 22 | @property(readonly, copy) NSString *notificationName; // @synthesize notificationName=_notificationName; 23 | @property(readonly) id observedObject; // @synthesize observedObject=_observedObject; 24 | @property(copy) CDUnknownBlockType handler; 25 | 26 | - (void)cleanup; 27 | - (void)_observeExpectedNotification:(id)arg1; 28 | - (id)initWithName:(id)arg1 object:(id)arg2 notificationCenter:(id)arg3 expectation:(id)arg4; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTNSPredicateExpectationImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import "NSObject.h" 8 | 9 | @class NSObject, NSPredicate, NSString, NSTimer, XCTNSPredicateExpectation; 10 | 11 | @interface _XCTNSPredicateExpectationImplementation : NSObject 12 | { 13 | XCTNSPredicateExpectation *_expectation; 14 | id _object; 15 | NSPredicate *_predicate; 16 | CDUnknownBlockType _handler; 17 | NSTimer *_timer; 18 | NSObject *_queue; 19 | BOOL _hasCleanedUp; 20 | } 21 | @property(readonly, copy) NSPredicate *predicate; // @synthesize predicate=_predicate; 22 | @property(readonly) id object; // @synthesize object=_object; 23 | @property(copy) CDUnknownBlockType handler; 24 | 25 | - (void)cleanup; 26 | - (void)_considerFulfilling; 27 | - (id)initWithPredicate:(id)arg1 object:(id)arg2 expectation:(id)arg3; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTestCaseInterruptionException.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @interface _XCTestCaseInterruptionException : NSException 8 | { 9 | } 10 | 11 | + (void)interruptTest; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTestImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class XCTestRun; 8 | 9 | @interface _XCTestImplementation : NSObject 10 | { 11 | XCTestRun *_testRun; 12 | } 13 | @property(retain) XCTestRun *testRun; // @synthesize testRun=_testRun; 14 | @end 15 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTestObservationCenterImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | @class NSMutableSet; 8 | 9 | @interface _XCTestObservationCenterImplementation : NSObject 10 | { 11 | NSMutableArray *_observers; 12 | BOOL _suspended; 13 | } 14 | 15 | @property BOOL suspended; // @synthesize suspended=_suspended; 16 | @property(retain) NSMutableArray *observers; // @synthesize observers=_observers; 17 | - (id)init; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PrivateHeaders/XCTest/_XCTestSuiteImplementation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by class-dump 3.5 (64 bit). 3 | // 4 | // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. 5 | // 6 | 7 | #import 8 | 9 | @class NSMutableArray, NSString, XCTestConfiguration; 10 | 11 | @interface _XCTestSuiteImplementation : XCTest 12 | { 13 | NSString *_name; 14 | NSMutableArray *_tests; 15 | XCTestConfiguration *_testConfiguration; 16 | } 17 | @property(retain) XCTestConfiguration *testConfiguration; // @synthesize testConfiguration=_testConfiguration; 18 | @property(retain) NSMutableArray *tests; // @synthesize tests=_tests; 19 | @property(copy) NSString *name; // @synthesize name=_name; 20 | 21 | - (id)initWithName:(id)arg1; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Scripts/ci/build-real.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # To run build script for CI 4 | 5 | xcodebuild clean build-for-testing \ 6 | -project WebDriverAgent.xcodeproj \ 7 | -derivedDataPath $DERIVED_DATA_PATH \ 8 | -scheme $SCHEME \ 9 | -destination "$DESTINATION" \ 10 | CODE_SIGNING_ALLOWED=NO ARCHS=arm64 11 | 12 | # Only .app is needed. 13 | 14 | pushd $WD 15 | 16 | # to remove test packages to refer to the device local instead of embedded ones 17 | # XCTAutomationSupport.framework, XCTest.framewor, XCTestCore.framework, 18 | # XCUIAutomation.framework, XCUnit.framework 19 | rm -rf $SCHEME-Runner.app/Frameworks/XC*.framework 20 | 21 | zip -r $ZIP_PKG_NAME $SCHEME-Runner.app 22 | popd 23 | mv $WD/$ZIP_PKG_NAME ./ 24 | -------------------------------------------------------------------------------- /Scripts/ci/build-sim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # To run build script for CI 4 | 5 | xcodebuild clean build-for-testing \ 6 | -project WebDriverAgent.xcodeproj \ 7 | -derivedDataPath wda_build \ 8 | -scheme $SCHEME \ 9 | -destination "$DESTINATION" \ 10 | CODE_SIGNING_ALLOWED=NO ARCHS=$ARCHS 11 | 12 | # simulator needs to build entire build files 13 | 14 | pushd wda_build 15 | # to remove unnecessary space consuming files 16 | rm -rf Build/Intermediates.noindex 17 | zip -r $ZIP_PKG_NAME Build 18 | popd 19 | mv wda_build/$ZIP_PKG_NAME ./ 20 | -------------------------------------------------------------------------------- /WebDriverAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WebDriverAgent.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSDictionary+FBUtf8SafeDictionary.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSString (FBUtf8SafeString) 15 | 16 | /** 17 | Converts the string, so it could be properly represented in UTF-8 encoding. All non-encodable characters are replaced with 18 | the given `replacement` 19 | 20 | @param replacement The character to use a a replacement for the lossy encoding 21 | @returns Either the same string or a string with non-encodable chars replaced 22 | */ 23 | - (instancetype)fb_utf8SafeStringWithReplacement:(unichar)replacement; 24 | 25 | @end 26 | 27 | @interface NSDictionary (FBUtf8SafeDictionary) 28 | 29 | /** 30 | Converts the dictionary, so it could be properly represented in UTF-8 encoding. All non-encodable characters 31 | in string values are replaced with the Unocde question mark characters. Nested dictionaries and arrays are 32 | processed recursively. 33 | 34 | @returns Either the same dictionary or a dictionary with non-encodable chars in string values replaced 35 | */ 36 | - (instancetype)fb_utf8SafeDictionary; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSExpression+FBFormat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSExpression (FBFormat) 15 | 16 | /** 17 | Method used to normalize/verify NSExpression expressions before passing them to WDA. 18 | Only expressions of NSKeyPathExpressionType are going to be verified. 19 | Allowed property names are only these declared in FBElement protocol (property names are received in runtime) 20 | and their shortcuts (without 'wd' prefix). All other property names are considered as unknown. 21 | 22 | @param input expression object received from user input 23 | @return formatted expression 24 | @throw FBUnknownPredicateKeyException in case the given property name is not declared in FBElement protocol 25 | */ 26 | + (instancetype)fb_wdExpressionWithExpression:(NSExpression *)input; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSExpression+FBFormat.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "NSExpression+FBFormat.h" 11 | 12 | #import "FBElementUtils.h" 13 | 14 | @implementation NSExpression (FBFormat) 15 | 16 | + (instancetype)fb_wdExpressionWithExpression:(NSExpression *)input 17 | { 18 | if ([input expressionType] != NSKeyPathExpressionType) { 19 | return input; 20 | } 21 | 22 | NSString *propName = [input keyPath]; 23 | NSUInteger dotPos = [propName rangeOfString:@"."].location; 24 | NSString *wdPropName; 25 | if (NSNotFound == dotPos) { 26 | wdPropName = [FBElementUtils wdAttributeNameForAttributeName:propName]; 27 | } else { 28 | NSString *actualPropName = [propName substringToIndex:dotPos]; 29 | NSString *suffix = [propName substringFromIndex:(dotPos + 1)]; 30 | wdPropName = [NSString stringWithFormat:@"%@.%@", [FBElementUtils wdAttributeNameForAttributeName:actualPropName], suffix]; 31 | } 32 | return [NSExpression expressionForKeyPath:wdPropName]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSString+FBVisualLength.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface NSString (FBVisualLength) 13 | 14 | /** 15 | Helper method that returns length of string with trimmed whitespaces 16 | */ 17 | - (NSUInteger)fb_visualLength; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSString+FBVisualLength.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "NSString+FBVisualLength.h" 11 | 12 | @implementation NSString (FBVisualLength) 13 | 14 | - (NSUInteger)fb_visualLength 15 | { 16 | return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSString+FBXMLSafeString.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface NSString (FBXMLSafeString) 15 | 16 | /** 17 | Method used to normalize a string before passing it to XML document 18 | 19 | @param replacement The string to be used as a replacement for invalid XML characters 20 | @return The string where all characters, which are not members of 21 | XML Character Range definition (http://www.w3.org/TR/2008/REC-xml-20081126/#charsets), 22 | are replaced 23 | */ 24 | - (NSString *)fb_xmlSafeStringWithReplacement:(NSString *)replacement; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/NSString+FBXMLSafeString.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "NSString+FBXMLSafeString.h" 11 | 12 | @implementation NSString (FBXMLSafeString) 13 | 14 | - (NSString *)fb_xmlSafeStringWithReplacement:(NSString *)replacement 15 | { 16 | static NSMutableCharacterSet *invalidSet; 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] 20 | invalidSet = [NSMutableCharacterSet characterSetWithRange:NSMakeRange(0x9, 1)]; 21 | [invalidSet addCharactersInRange:NSMakeRange(0xA, 1)]; 22 | [invalidSet addCharactersInRange:NSMakeRange(0xD, 1)]; 23 | [invalidSet addCharactersInRange:NSMakeRange(0x20, 0xD7FF - 0x20 + 1)]; 24 | [invalidSet addCharactersInRange:NSMakeRange(0xE000, 0xFFFD - 0xE000 + 1)]; 25 | [invalidSet addCharactersInRange:NSMakeRange(0x10000, 0x10FFFF - 0x10000 + 1)]; 26 | [invalidSet invert]; 27 | }); 28 | return [[self componentsSeparatedByCharactersInSet:invalidSet] componentsJoinedByString:replacement]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCAXClient_iOS+FBSnapshotReqParams.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "XCAXClient_iOS.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | extern NSString *const FBSnapshotMaxDepthKey; 17 | 18 | void FBSetCustomParameterForElementSnapshot (NSString* name, id value); 19 | 20 | id __nullable FBGetCustomParameterForElementSnapshot (NSString *name); 21 | 22 | @interface XCAXClient_iOS (FBSnapshotReqParams) 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCTIssue+FBPatcher.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface XCTIssue (AMPatcher) 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCTIssue+FBPatcher.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "XCTIssue+FBPatcher.h" 11 | 12 | #import 13 | 14 | static _Bool swizzledShouldInterruptTest(id self, SEL _cmd) 15 | { 16 | return NO; 17 | } 18 | 19 | @implementation XCTIssue (AMPatcher) 20 | 21 | #pragma clang diagnostic push 22 | #pragma clang diagnostic ignored "-Wobjc-load-method" 23 | + (void)load 24 | { 25 | SEL originalShouldInterruptTest = NSSelectorFromString(@"shouldInterruptTest"); 26 | if (nil == originalShouldInterruptTest) return; 27 | Method originalShouldInterruptTestMethod = class_getInstanceMethod(self.class, originalShouldInterruptTest); 28 | if (nil == originalShouldInterruptTestMethod) return; 29 | method_setImplementation(originalShouldInterruptTestMethod, (IMP)swizzledShouldInterruptTest); 30 | } 31 | #pragma clang diagnostic pop 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBAlert.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface XCUIApplication (FBAlert) 13 | 14 | /* The accessiblity label used for Safari app */ 15 | extern NSString *const FB_SAFARI_APP_NAME; 16 | 17 | /** 18 | Retrieve the current alert element 19 | 20 | @return Alert element instance 21 | */ 22 | - (XCUIElement *)fb_alertElement; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBFocused.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2018-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "FBElement.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface XCUIApplication (FBFocused) 16 | 17 | /** 18 | Return current focused element 19 | */ 20 | - (id)fb_focusedElement; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBQuiescence.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "XCUIApplication.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface XCUIApplication (FBQuiescence) 16 | 17 | /** 18 | It allows to turn on/off waiting for application quiescence, while performing queries. Defaults to YES. 19 | This value mirrors the corresponding property of the connected XCUIApplicationProcess instance. 20 | */ 21 | @property (nonatomic, assign) BOOL fb_shouldWaitForQuiescence; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBQuiescence.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "XCUIApplication+FBQuiescence.h" 11 | 12 | #import "XCUIApplicationImpl.h" 13 | #import "XCUIApplicationProcess.h" 14 | #import "XCUIApplicationProcess+FBQuiescence.h" 15 | 16 | 17 | @implementation XCUIApplication (FBQuiescence) 18 | 19 | - (BOOL)fb_shouldWaitForQuiescence 20 | { 21 | return [[self applicationImpl] currentProcess].fb_shouldWaitForQuiescence.boolValue; 22 | } 23 | 24 | - (void)setFb_shouldWaitForQuiescence:(BOOL)value 25 | { 26 | [[self applicationImpl] currentProcess].fb_shouldWaitForQuiescence = @(value); 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | 11 | #import 12 | #import "FBElementCache.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface XCUIApplication (FBTouchAction) 17 | 18 | /** 19 | Perform complex touch action in scope of the current application. 20 | 21 | @param actions Array of dictionaries, whose format is described in W3C spec (https://github.com/jlipps/simple-wd-spec#perform-actions) 22 | @param elementCache Cached elements mapping for the currrent application. The method assumes all elements are already represented by their actual instances if nil value is set 23 | @param error If there is an error, upon return contains an NSError object that describes the problem 24 | @return YES If the touch action has been successfully performed without errors 25 | */ 26 | - (BOOL)fb_performW3CActions:(NSArray *)actions elementCache:(nullable FBElementCache *)elementCache error:(NSError * _Nullable*)error; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBUIInterruptions.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface XCUIApplication (FBUIInterruptions) 15 | 16 | /** 17 | * Disables automatic UI interruptions handling for all applications. 18 | */ 19 | + (void)fb_disableUIInterruptionsHandling; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplication+FBUIInterruptions.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "XCUIApplication+FBUIInterruptions.h" 11 | 12 | #import "FBReflectionUtils.h" 13 | #import "XCUIApplication.h" 14 | 15 | @implementation XCUIApplication (FBUIInterruptions) 16 | 17 | - (BOOL)fb_doesNotHandleUIInterruptions 18 | { 19 | return YES; 20 | } 21 | 22 | + (void)fb_disableUIInterruptionsHandling 23 | { 24 | static dispatch_once_t onceToken; 25 | dispatch_once(&onceToken, ^{ 26 | FBReplaceMethod([self class], 27 | @selector(doesNotHandleUIInterruptions), 28 | @selector(fb_doesNotHandleUIInterruptions)); 29 | }); 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIApplicationProcess+FBQuiescence.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "XCUIApplicationProcess.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface XCUIApplicationProcess (FBQuiescence) 17 | 18 | /*! Defines wtether the process should perform quiescence checks. YES by default */ 19 | @property (nonatomic) NSNumber* fb_shouldWaitForQuiescence; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIDevice+FBHealthCheck.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | 15 | @interface XCUIDevice (FBHealthCheck) 16 | 17 | /** 18 | Checks health of XCTest by: 19 | 1) Querying application for some elements, 20 | 2) Triggering some device events. 21 | 22 | !!! Health check might modify simulator state so it should only be called in-between testing sessions 23 | 24 | @param application application used to issue queries 25 | @return YES if the operation succeeds, otherwise NO. 26 | */ 27 | - (BOOL)fb_healthCheckWithApplication:(nullable XCUIApplication *)application; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIDevice+FBHealthCheck.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "XCUIDevice+FBHealthCheck.h" 11 | 12 | #import "XCUIDevice+FBRotation.h" 13 | #import "XCUIApplication+FBHelpers.h" 14 | 15 | @implementation XCUIDevice (FBHealthCheck) 16 | 17 | - (BOOL)fb_healthCheckWithApplication:(nullable XCUIApplication *)application 18 | { 19 | if (![self fb_elementQueryCheckWithApplication:application]) { 20 | return NO; 21 | } 22 | if (![self fb_deviceInteractionCheck]) { 23 | return NO; 24 | } 25 | return YES; 26 | } 27 | 28 | - (BOOL)fb_elementQueryCheckWithApplication:(nullable XCUIApplication *)application 29 | { 30 | if (!application) { 31 | return NO; 32 | } 33 | if (!application.label) { 34 | return NO; 35 | } 36 | if ([application descendantsMatchingType:XCUIElementTypeAny].count == 0 ) { 37 | return NO; 38 | } 39 | return YES; 40 | } 41 | 42 | - (BOOL)fb_deviceInteractionCheck 43 | { 44 | [self pressButton:XCUIDeviceButtonHome]; 45 | return YES; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIDevice+FBRotation.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #if !TARGET_OS_TV 15 | @interface XCUIDevice (FBRotation) 16 | 17 | /** 18 | Sets requested device interface orientation. 19 | 20 | @param orientation The interface orientation. 21 | @return YES if the operation succeeds, otherwise NO. 22 | */ 23 | - (BOOL)fb_setDeviceInterfaceOrientation:(UIDeviceOrientation)orientation; 24 | 25 | /** 26 | Sets the devices orientation to the rotation passed. 27 | 28 | @param rotationObj The rotation defining the devices orientation. 29 | @return YES if the operation succeeds, otherwise NO. 30 | */ 31 | - (BOOL)fb_setDeviceRotation:(NSDictionary *)rotationObj; 32 | 33 | /*! The UIDeviceOrientation to rotation mappings */ 34 | @property (strong, nonatomic, readonly) NSDictionary *fb_rotationMapping; 35 | 36 | @end 37 | #endif 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBAccessibility.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "FBXCElementSnapshotWrapper.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface XCUIElement (FBAccessibility) 16 | 17 | /*! Whether or not the element is accessible */ 18 | @property (atomic, readonly) BOOL fb_isAccessibilityElement; 19 | 20 | @end 21 | 22 | 23 | @interface FBXCElementSnapshotWrapper (FBAccessibility) 24 | 25 | /*! Whether or not the element in snapshot is accessible */ 26 | @property (atomic, readonly) BOOL fb_isAccessibilityElement; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBAccessibility.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "XCUIElement+FBAccessibility.h" 11 | 12 | #import "FBConfiguration.h" 13 | #import "XCTestPrivateSymbols.h" 14 | #import "XCUIElement+FBUtilities.h" 15 | #import "FBXCElementSnapshotWrapper+Helpers.h" 16 | 17 | @implementation XCUIElement (FBAccessibility) 18 | 19 | - (BOOL)fb_isAccessibilityElement 20 | { 21 | id snapshot = [self fb_snapshotWithAttributes:@[FB_XCAXAIsElementAttributeName] 22 | maxDepth:@1]; 23 | return [FBXCElementSnapshotWrapper ensureWrapped:snapshot].fb_isAccessibilityElement; 24 | } 25 | 26 | @end 27 | 28 | @implementation FBXCElementSnapshotWrapper (FBAccessibility) 29 | 30 | - (BOOL)fb_isAccessibilityElement 31 | { 32 | NSNumber *isAccessibilityElement = self.additionalAttributes[FB_XCAXAIsElementAttribute]; 33 | if (nil != isAccessibilityElement) { 34 | return isAccessibilityElement.boolValue; 35 | } 36 | 37 | return [(NSNumber *)[self fb_attributeValue:FB_XCAXAIsElementAttributeName] boolValue]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBCaching.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface XCUIElement (FBCaching) 15 | 16 | /*! This property is set to YES if the given element has been resolved from the cache, so it is safe to use the `lastSnapshot` property */ 17 | @property (nullable, nonatomic) NSNumber *fb_isResolvedFromCache; 18 | 19 | @property (nonatomic, readonly) NSString *fb_cacheId; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBXCElementSnapshotWrapper.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface XCUIElement (FBIsVisible) 15 | 16 | /*! Whether or not the element is visible */ 17 | @property (atomic, readonly) BOOL fb_isVisible; 18 | 19 | @end 20 | 21 | 22 | @interface FBXCElementSnapshotWrapper (FBIsVisible) 23 | 24 | /*! Whether or not the element is visible */ 25 | @property (atomic, readonly) BOOL fb_isVisible; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBSwiping.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface XCUIElement (FBSwiping) 14 | 15 | /** 16 | * Performs swipe gesture on the element 17 | * 18 | * @param direction Swipe direction. The following values are supported: up, down, left and right 19 | * @param velocity Swipe speed in pixels per second 20 | */ 21 | - (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity; 22 | 23 | @end 24 | 25 | #if !TARGET_OS_TV 26 | @interface XCUICoordinate (FBSwiping) 27 | 28 | /** 29 | * Performs swipe gesture on the coordinate 30 | * 31 | * @param direction Swipe direction. The following values are supported: up, down, left and right 32 | * @param velocity Swipe speed in pixels per second 33 | */ 34 | - (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity; 35 | 36 | @end 37 | #endif 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBTVFocuse.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2018-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #if TARGET_OS_TV 15 | @interface XCUIElement (FBTVFocuse) 16 | 17 | /** 18 | Sets focus 19 | 20 | @param error If there is an error, upon return contains an NSError object that describes the problem. 21 | @return YES if the operation succeeds, otherwise NO. 22 | */ 23 | - (BOOL)fb_setFocusWithError:(NSError**) error; 24 | 25 | /** 26 | Select a focused element 27 | 28 | @param error If there is an error, upon return contains an NSError object that describes the problem. 29 | @return YES if the operation succeeds, otherwise NO. 30 | */ 31 | - (BOOL)fb_selectWithError:(NSError**) error; 32 | 33 | @end 34 | #endif 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | #import "FBXCElementSnapshotWrapper.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface XCUIElement (WebDriverAttributes) 17 | 18 | @end 19 | 20 | 21 | @interface FBXCElementSnapshotWrapper (WebDriverAttributes) 22 | 23 | /** 24 | Fetches wdName attribute value for the given snapshot instance 25 | 26 | @param snapshot snapshot instance 27 | @return wdName attribute value or nil 28 | */ 29 | + (nullable NSString *)wdNameWithSnapshot:(id)snapshot; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Categories/XCUIElementQuery+FBHelpers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2018-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "FBXCElementSnapshot.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface XCUIElementQuery (FBHelpers) 16 | 17 | /** 18 | Extracts the cached element snapshot from its query. 19 | No requests to the accessiblity framework is made. 20 | It is only safe to use this call right after element lookup query 21 | has been executed. 22 | 23 | @return Either the cached snapshot or nil 24 | */ 25 | - (nullable id)fb_cachedSnapshot; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBAlertViewCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBAlertViewCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBCustomCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBCustomCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBDebugCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBDebugCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBElementCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBElementCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBFindElementCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBFindElementCommands : NSObject 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBOrientationCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBOrientationCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBScreenshotCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBScreenshotCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBScreenshotCommands.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBScreenshotCommands.h" 11 | 12 | #import "XCUIDevice+FBHelpers.h" 13 | 14 | @implementation FBScreenshotCommands 15 | 16 | #pragma mark - 17 | 18 | + (NSArray *)routes 19 | { 20 | return 21 | @[ 22 | [[FBRoute GET:@"/screenshot"].withoutSession respondWithTarget:self action:@selector(handleGetScreenshot:)], 23 | [[FBRoute GET:@"/screenshot"] respondWithTarget:self action:@selector(handleGetScreenshot:)], 24 | ]; 25 | } 26 | 27 | 28 | #pragma mark - Commands 29 | 30 | + (id)handleGetScreenshot:(FBRouteRequest *)request 31 | { 32 | NSError *error; 33 | NSData *screenshotData = [[XCUIDevice sharedDevice] fb_screenshotWithError:&error]; 34 | if (nil == screenshotData) { 35 | return FBResponseWithStatus([FBCommandStatus unableToCaptureScreenErrorWithMessage:error.description traceback:nil]); 36 | } 37 | NSString *screenshot = [screenshotData base64EncodedStringWithOptions:0]; 38 | return FBResponseWithObject(screenshot); 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBSessionCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBSessionCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBTouchActionCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBTouchActionCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBTouchActionCommands.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBTouchActionCommands.h" 11 | 12 | #import "FBRoute.h" 13 | #import "FBRouteRequest.h" 14 | #import "FBSession.h" 15 | #import "XCUIApplication+FBTouchAction.h" 16 | 17 | @implementation FBTouchActionCommands 18 | 19 | #pragma mark - 20 | 21 | + (NSArray *)routes 22 | { 23 | return 24 | @[ 25 | [[FBRoute POST:@"/actions"] respondWithTarget:self action:@selector(handlePerformW3CTouchActions:)], 26 | ]; 27 | } 28 | 29 | #pragma mark - Commands 30 | 31 | + (id)handlePerformW3CTouchActions:(FBRouteRequest *)request 32 | { 33 | XCUIApplication *application = request.session.activeApplication; 34 | NSArray *actions = (NSArray *)request.arguments[@"actions"]; 35 | NSError *error; 36 | if (![application fb_performW3CActions:actions elementCache:request.session.elementCache error:&error]) { 37 | return FBResponseWithUnknownError(error); 38 | } 39 | return FBResponseWithOK(); 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBTouchIDCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBTouchIDCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBTouchIDCommands.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBTouchIDCommands.h" 11 | 12 | #import "FBRouteRequest.h" 13 | 14 | #import "XCUIDevice+FBHelpers.h" 15 | 16 | @implementation FBTouchIDCommands 17 | 18 | + (NSArray *)routes 19 | { 20 | return @[ 21 | [[FBRoute POST:@"/wda/touch_id"] respondWithBlock: ^ id (FBRouteRequest *request) { 22 | BOOL isMatch = [request.arguments[@"match"] boolValue]; 23 | if (![[XCUIDevice sharedDevice] fb_fingerTouchShouldMatch:isMatch]) { 24 | return FBResponseWithUnknownErrorFormat(@"Cannot perform Touch Id %@match", isMatch ? @"" : @"non-"); 25 | } 26 | return FBResponseWithOK(); 27 | }], 28 | ]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBUnknownCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBUnknownCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBUnknownCommands.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBUnknownCommands.h" 11 | 12 | #import "FBRouteRequest.h" 13 | 14 | @implementation FBUnknownCommands 15 | 16 | #pragma mark - 17 | 18 | + (BOOL)shouldRegisterAutomatically 19 | { 20 | return NO; 21 | } 22 | 23 | + (NSArray *)routes 24 | { 25 | return 26 | @[ 27 | [[FBRoute GET:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)], 28 | [[FBRoute POST:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)], 29 | [[FBRoute PUT:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)], 30 | [[FBRoute DELETE:@"/*"].withoutSession respondWithTarget:self action:@selector(unhandledHandler:)] 31 | ]; 32 | } 33 | 34 | + (id)unhandledHandler:(FBRouteRequest *)request 35 | { 36 | return FBResponseWithStatus([FBCommandStatus unknownCommandErrorWithMessage:[NSString stringWithFormat:@"Unhandled endpoint: %@ with parameters %@", request.URL, request.parameters] 37 | traceback:nil]); 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Commands/FBVideoCommands.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBVideoCommands : NSObject 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.facebook.wda.lib 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBCommandHandler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | /** 20 | Protocol for Classes to declare intent to implement responses to commands 21 | */ 22 | @protocol FBCommandHandler 23 | 24 | /** 25 | * Should return map of FBRouteCommandHandler block with keys as supported routes 26 | * 27 | * @return map an NSArray of routes. 28 | */ 29 | + (NSArray *)routes; 30 | 31 | @optional 32 | /** 33 | * @return BOOL deciding if class should be added to route handlers automatically, default (if not implemented) is YES 34 | */ 35 | + (BOOL)shouldRegisterAutomatically; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBExceptionHandler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | /** 16 | Class used to handle exceptions raised by command handlers 17 | */ 18 | @interface FBExceptionHandler : NSObject 19 | 20 | /** 21 | Handles 'exception' for 'webServer' raised while handling 'response' 22 | 23 | @param exception exception that needs handling 24 | @param response response related to that exception 25 | */ 26 | - (void)handleException:(NSException *)exception forResponse:(RouteResponse *)response; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBExceptions.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBExceptions.h" 11 | 12 | NSString *const FBInvalidArgumentException = @"FBInvalidArgumentException"; 13 | NSString *const FBSessionCreationException = @"FBSessionCreationException"; 14 | NSString *const FBSessionDoesNotExistException = @"FBSessionDoesNotExistException"; 15 | NSString *const FBApplicationDeadlockDetectedException = @"FBApplicationDeadlockDetectedException"; 16 | NSString *const FBElementAttributeUnknownException = @"FBElementAttributeUnknownException"; 17 | NSString *const FBElementNotVisibleException = @"FBElementNotVisibleException"; 18 | NSString *const FBTimeoutException = @"FBTimeoutException"; 19 | NSString *const FBStaleElementException = @"FBStaleElementException"; 20 | NSString *const FBInvalidXPathException = @"FBInvalidXPathException"; 21 | NSString *const FBXPathQueryEvaluationException = @"FBXPathQueryEvaluationException"; 22 | NSString *const FBClassChainQueryParseException = @"FBClassChainQueryParseException"; 23 | NSString *const FBApplicationCrashedException = @"FBApplicationCrashedException"; 24 | NSString *const FBApplicationMissingException = @"FBApplicationMissingException"; 25 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBResponseJSONPayload.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import 13 | #import 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /** 18 | Class that represents WebDriverAgent JSON repsonse 19 | */ 20 | @interface FBResponseJSONPayload : NSObject 21 | 22 | /** 23 | Initializer for JSON respond that converts given 'dictionary' to JSON 24 | */ 25 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary 26 | httpStatusCode:(HTTPStatusCode)httpStatusCode; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBRouteRequest-Private.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FBRouteRequest () 15 | @property (nonatomic, strong, readwrite) NSURL *URL; 16 | @property (nonatomic, copy, readwrite) NSDictionary *parameters; 17 | @property (nonatomic, copy, readwrite) NSDictionary *arguments; 18 | @property (nonatomic, strong, readwrite) FBSession *session; 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBRouteRequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @class FBSession; 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | /** 17 | Class that represents WebDriverAgent command request 18 | */ 19 | @interface FBRouteRequest : NSObject 20 | 21 | /*! Request's URL */ 22 | @property (nonatomic, strong, readonly) NSURL *URL; 23 | 24 | /*! Parameters sent with that request */ 25 | @property (nonatomic, copy, readonly) NSDictionary *parameters; 26 | 27 | /*! Arguments sent with that request */ 28 | @property (nonatomic, copy, readonly) NSDictionary *arguments; 29 | 30 | /*! Session associated with that request */ 31 | @property (nonatomic, strong, readonly) FBSession *session; 32 | 33 | /** 34 | Convenience constructor for request 35 | */ 36 | + (instancetype)routeRequestWithURL:(NSURL *)URL parameters:(NSDictionary *)parameters arguments:(NSDictionary *)arguments; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBRouteRequest.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBRouteRequest-Private.h" 11 | 12 | @implementation FBRouteRequest 13 | 14 | + (instancetype)routeRequestWithURL:(NSURL *)URL parameters:(NSDictionary *)parameters arguments:(NSDictionary *)arguments 15 | { 16 | FBRouteRequest *request = [self.class new]; 17 | request.URL = URL; 18 | request.parameters = parameters; 19 | request.arguments = arguments; 20 | return request; 21 | } 22 | 23 | - (NSString *)description 24 | { 25 | return [NSString stringWithFormat: 26 | @"Request URL %@ | Params %@ | Arguments %@", 27 | self.URL, 28 | self.parameters, 29 | self.arguments 30 | ]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBScreenRecordingPromise.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FBScreenRecordingPromise : NSObject 15 | 16 | /** Unique identiifier of the video recording, also used as the default file name */ 17 | @property (nonatomic, readonly) NSUUID *identifier; 18 | /** Native screen recording promise */ 19 | @property (nonatomic, readonly) id nativePromise; 20 | 21 | /** 22 | Creates a wrapper object for a native screen recording promise 23 | 24 | @param promise Native promise object to be wrapped 25 | */ 26 | - (instancetype)initWithNativePromise:(id)promise; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBScreenRecordingPromise.m: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright (c) 2015-present, Facebook, Inc. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | */ 10 | 11 | #import "FBScreenRecordingPromise.h" 12 | 13 | @interface FBScreenRecordingPromise () 14 | @property (readwrite) id nativePromise; 15 | @end 16 | 17 | @implementation FBScreenRecordingPromise 18 | 19 | - (instancetype)initWithNativePromise:(id)promise 20 | { 21 | if ((self = [super init])) { 22 | self.nativePromise = promise; 23 | } 24 | return self; 25 | } 26 | 27 | - (NSUUID *)identifier 28 | { 29 | return (NSUUID *)[self.nativePromise valueForKey:@"_UUID"]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBScreenRecordingRequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FBScreenRecordingRequest : NSObject 15 | 16 | /** The amount of video FPS */ 17 | @property (readonly, nonatomic) NSUInteger fps; 18 | /** Codec to use, where 0 is h264, 1 - HEVC */ 19 | @property (readonly, nonatomic) long long codec; 20 | 21 | /** 22 | Creates a custom wrapper for a screen recording reqeust 23 | 24 | @param fps FPS value, see baove 25 | @param codec Codex value, see above 26 | */ 27 | - (instancetype)initWithFps:(NSUInteger)fps codec:(long long)codec; 28 | 29 | /** 30 | Transforms the current wrapper instance to a native object, 31 | which is ready to be passed to XCTest APIs 32 | 33 | @param error If there was a failure converting the instance to a native object 34 | @returns Native object instance 35 | */ 36 | - (nullable id)toNativeRequestWithError:(NSError **)error; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBSession-Private.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @class FBElementCache; 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface FBSession () 17 | @property (nonatomic, copy, readwrite) NSString *identifier; 18 | @property (nonatomic, strong, readwrite) FBElementCache *elementCache; 19 | 20 | /** 21 | Sets session as current session 22 | */ 23 | + (void)markSessionActive:(FBSession *)session; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBWebServer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @class RouteResponse, RoutingHTTPServer, FBExceptionHandler; 13 | @protocol FBWebServerDelegate; 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /** 18 | HTTP and USB service wrapper, handling requests and responses 19 | */ 20 | @interface FBWebServer : NSObject 21 | 22 | /** 23 | Server delegate. 24 | */ 25 | @property (weak, nonatomic) id delegate; 26 | 27 | /** 28 | Starts WebDriverAgent service by booting HTTP and USB server 29 | */ 30 | - (void)startServing; 31 | 32 | /** 33 | Stops WebDriverAgent service, shutting down HTTP and USB servers. 34 | */ 35 | - (void)stopServing; 36 | 37 | @end 38 | 39 | /** 40 | The protocol allowing the server delegate to handle messages from the server. 41 | */ 42 | @protocol FBWebServerDelegate 43 | 44 | /** 45 | The server requested WebDriverAgent service shutdown. 46 | 47 | @param webServer Server instance. 48 | */ 49 | - (void)webServerDidRequestShutdown:(FBWebServer *)webServer; 50 | 51 | @end 52 | 53 | NS_ASSUME_NONNULL_END 54 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBXCAccessibilityElement.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol FBXCAccessibilityElement 15 | 16 | @property(readonly) id payload; // @synthesize payload=_payload; 17 | @property(readonly) int processIdentifier; // @synthesize processIdentifier=_processIdentifier; 18 | @property(readonly) const struct __AXUIElement *AXUIElement; // @synthesize AXUIElement=_axElement; 19 | @property(readonly, getter=isNative) BOOL native; 20 | 21 | + (id)elementWithAXUIElement:(struct __AXUIElement *)arg1; 22 | + (id)elementWithProcessIdentifier:(int)arg1; 23 | + (id)deviceElement; 24 | + (id)mockElementWithProcessIdentifier:(int)arg1 payload:(id)arg2; 25 | + (id)mockElementWithProcessIdentifier:(int)arg1; 26 | 27 | - (id)initWithMockProcessIdentifier:(int)arg1 payload:(id)arg2; 28 | - (id)initWithAXUIElement:(struct __AXUIElement *)arg1; 29 | - (id)init; 30 | 31 | @end 32 | 33 | BOOL FBIsAXElementEqualToOther(id first, id second); 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBXCAccessibilityElement.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBXCAccessibilityElement.h" 11 | 12 | #import "FBElementUtils.h" 13 | 14 | BOOL FBIsAXElementEqualToOther(id first, id second) 15 | { 16 | return nil != second && [[FBElementUtils uidWithAccessibilityElement:first] 17 | isEqualToString:([FBElementUtils uidWithAccessibilityElement:second] ?: @"")]; 18 | } 19 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBXCDeviceEvent.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol FBXCDeviceEvent 15 | 16 | @property unsigned long long type; // @synthesize type=_type; 17 | @property double rotation; // @synthesize rotation=_rotation; 18 | @property double duration; // @synthesize duration=_duration; 19 | @property unsigned int usage; // @synthesize usage=_usage; 20 | @property unsigned int eventPage; // @synthesize eventPage=_eventPage; 21 | @property(readonly) BOOL isButtonHoldEvent; 22 | 23 | + (id)deviceEventForDigitalCrownRotation:(double)arg1 velocity:(double)arg2; 24 | + (id)deviceEventWithPage:(unsigned int)arg1 usage:(unsigned int)arg2 duration:(double)arg3; 25 | 26 | - (void)dispatch; 27 | 28 | @end 29 | 30 | _Nullable id FBCreateXCDeviceEvent(unsigned int page, 31 | unsigned int usage, 32 | double duration, 33 | NSError **error); 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBXCElementSnapshot.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBXCElementSnapshot.h" 11 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Routing/FBXCElementSnapshotWrapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBXCElementSnapshot.h" 11 | #import "FBElement.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface FBXCElementSnapshotWrapper : NSObject 16 | 17 | /*!Wrapped snapshot instance */ 18 | @property (nonatomic, readonly) id snapshot; 19 | 20 | /** 21 | Wraps the given snapshot.. If the given snapshot is already wrapped then the result remains unchanged. 22 | 23 | @param snapshot snapshot instance to wrap 24 | @returns wrapper instance 25 | */ 26 | + (nullable instancetype)ensureWrapped:(nullable id)snapshot; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBAlertsMonitor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @class FBAlert, XCUIApplication; 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @protocol FBAlertsMonitorDelegate 17 | 18 | /** 19 | The callback which is invoked when an unexpected on-screen alert is shown 20 | 21 | @param alert The instance of the current alert 22 | */ 23 | - (void)didDetectAlert:(FBAlert *)alert; 24 | 25 | @end 26 | 27 | @interface FBAlertsMonitor : NSObject 28 | 29 | /*! The delegate which decides on what to do when an alert is detected */ 30 | @property (nonatomic, nullable, weak) id delegate; 31 | 32 | /** 33 | Creates an instance of alerts monitor. 34 | The monitoring is done on the main thread and is disabled unless `enable` is called. 35 | 36 | @return Alerts monitor instance 37 | */ 38 | - (instancetype)init; 39 | 40 | /** 41 | Enables alerts monitoring 42 | */ 43 | - (void)enable; 44 | 45 | /** 46 | Disables alerts monitoring 47 | */ 48 | - (void)disable; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBBaseActionsParser.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBBaseActionsSynthesizer.h" 11 | 12 | #import "FBErrorBuilder.h" 13 | 14 | @implementation FBBaseActionsSynthesizer 15 | 16 | - (instancetype)initWithActions:(NSArray *)actions forApplication:(XCUIApplication *)application 17 | { 18 | self = [super init]; 19 | if (self) { 20 | _actions = actions; 21 | _application = application; 22 | } 23 | return self; 24 | } 25 | 26 | - (nullable XCSynthesizedEventRecord *)synthesizeWithError:(NSError **)error 27 | { 28 | @throw [[FBErrorBuilder.builder withDescription:@"Override this method in subclasses"] build]; 29 | return nil; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBDebugLogDelegateDecorator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | /** 16 | XCTestLogger decorator that will print all debug information to console 17 | */ 18 | @interface FBDebugLogDelegateDecorator : NSObject 19 | 20 | /** 21 | Decorates XCTestLogger by also printing debug message to console 22 | */ 23 | + (void)decorateXCTestLogger; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBFailureProofTestCase.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** 15 | Test Case that will never fail or stop from running in case of failure 16 | */ 17 | @interface FBFailureProofTestCase : XCTestCase 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBImageUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /*! Returns YES if the data contains a PNG image */ 15 | BOOL FBIsPngImage(NSData *imageData); 16 | 17 | /*! Converts the given image data to a PNG representation if necessary */ 18 | NSData *_Nullable FBToPngData(NSData *imageData); 19 | 20 | /*! Returns YES if the data contains a JPG image */ 21 | BOOL FBIsJpegImage(NSData *imageData); 22 | 23 | /*! Converts the given image data to a JPG representation if necessary */ 24 | NSData *_Nullable FBToJpegData(NSData *imageData, CGFloat compressionQuality); 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBLogger.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** 15 | A Global Logger object that understands log levels 16 | */ 17 | @interface FBLogger : NSObject 18 | 19 | /** 20 | Log to stdout. 21 | */ 22 | + (void)log:(NSString *)message; 23 | + (void)logFmt:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); 24 | 25 | /** 26 | Log to stdout, only if WDA is Verbose 27 | */ 28 | + (void)verboseLog:(NSString *)message; 29 | + (void)verboseLogFmt:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBLogger.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBLogger.h" 11 | 12 | #import "FBConfiguration.h" 13 | 14 | @implementation FBLogger 15 | 16 | + (void)log:(NSString *)message 17 | { 18 | NSLog(@"%@", message); 19 | } 20 | 21 | + (void)logFmt:(NSString *)format, ... 22 | { 23 | va_list args; 24 | va_start(args, format); 25 | NSLogv(format, args); 26 | va_end(args); 27 | } 28 | 29 | + (void)verboseLog:(NSString *)message 30 | { 31 | if (!FBConfiguration.verboseLoggingEnabled) { 32 | return; 33 | } 34 | [self log:message]; 35 | } 36 | 37 | + (void)verboseLogFmt:(NSString *)format, ... 38 | { 39 | if (!FBConfiguration.verboseLoggingEnabled) { 40 | return; 41 | } 42 | va_list args; 43 | va_start(args, format); 44 | NSLogv(format, args); 45 | va_end(args); 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBMjpegServer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBTCPSocket.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FBMjpegServer : NSObject 15 | 16 | /** 17 | The default constructor for the screenshot bradcaster service. 18 | This service sends low resolution screenshots 10 times per seconds 19 | to all connected clients. 20 | */ 21 | - (instancetype)init; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBNotificationsHelper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FBNotificationsHelper : NSObject 15 | 16 | /** 17 | Creates an expectation that is fulfilled when an expected NSNotification is received 18 | 19 | @param name The name of the awaited notification 20 | @param timeout The maximum amount of float seconds to wait for the expectation 21 | @return The appropriate waiter result 22 | */ 23 | + (XCTWaiterResult)waitForNotificationWithName:(NSNotificationName)name 24 | timeout:(NSTimeInterval)timeout; 25 | 26 | /** 27 | Creates an expectation that is fulfilled when an expected Darwin notification is received 28 | 29 | @param name The name of the awaited notification 30 | @param timeout The maximum amount of float seconds to wait for the expectation 31 | @return The appropriate waiter result 32 | */ 33 | + (XCTWaiterResult)waitForDarwinNotificationWithName:(NSString *)name 34 | timeout:(NSTimeInterval)timeout; 35 | 36 | @end 37 | 38 | NS_ASSUME_NONNULL_END 39 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBNotificationsHelper.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBNotificationsHelper.h" 11 | 12 | @implementation FBNotificationsHelper 13 | 14 | + (XCTWaiterResult)waitForNotificationWithName:(NSNotificationName)name 15 | timeout:(NSTimeInterval)timeout 16 | { 17 | XCTNSNotificationExpectation *expectation = [[XCTNSNotificationExpectation alloc] 18 | initWithName:name]; 19 | return [XCTWaiter waitForExpectations:@[expectation] timeout:timeout]; 20 | } 21 | 22 | + (XCTWaiterResult)waitForDarwinNotificationWithName:(NSString *)name 23 | timeout:(NSTimeInterval)timeout 24 | { 25 | XCTDarwinNotificationExpectation *expectation = [[XCTDarwinNotificationExpectation alloc] 26 | initWithNotificationName:name]; 27 | return [XCTWaiter waitForExpectations:@[expectation] timeout:timeout]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBReflectionUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** 15 | * Swizzles the implemntation of originalSelector with the swizzledSelector for the given class. 16 | * Both methods must belong to this class. 17 | * 18 | * @param cls The class where to swizzle 19 | * @param originalSelector original method selector 20 | * @paramswizzledSelector swizzled method selector 21 | */ 22 | void FBReplaceMethod(Class cls, SEL originalSelector, SEL swizzledSelector); 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBReflectionUtils.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBReflectionUtils.h" 11 | 12 | #import 13 | 14 | void FBReplaceMethod(Class class, SEL originalSelector, SEL swizzledSelector) { 15 | Method originalMethod = class_getInstanceMethod(class, originalSelector); 16 | Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); 17 | 18 | BOOL didAddMethod = 19 | class_addMethod(class, 20 | originalSelector, 21 | method_getImplementation(swizzledMethod), 22 | method_getTypeEncoding(swizzledMethod)); 23 | 24 | if (didAddMethod) { 25 | class_replaceMethod(class, 26 | swizzledSelector, 27 | method_getImplementation(originalMethod), 28 | method_getTypeEncoding(originalMethod)); 29 | } else { 30 | method_exchangeImplementations(originalMethod, swizzledMethod); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBScreen.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface FBScreen : NSObject 15 | 16 | /** 17 | The scale factor of the main device's screen 18 | */ 19 | + (double)scale; 20 | 21 | /** 22 | The absolute size of application's status bar or CGSizeZero if it's hidden or does not exist 23 | */ 24 | + (CGSize)statusBarSizeForApplication:(XCUIApplication *)application; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBScreen.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBScreen.h" 11 | #import "XCUIElement+FBIsVisible.h" 12 | #import "FBXCodeCompatibility.h" 13 | #import "XCUIScreen.h" 14 | 15 | @implementation FBScreen 16 | 17 | + (double)scale 18 | { 19 | return [XCUIScreen.mainScreen scale]; 20 | } 21 | 22 | + (CGSize)statusBarSizeForApplication:(XCUIApplication *)application 23 | { 24 | XCUIApplication *app = XCUIApplication.fb_systemApplication; 25 | // Since iOS 13 the status bar is no longer part of the application, it’s part of the SpringBoard 26 | XCUIElement *mainStatusBar = app.statusBars.allElementsBoundByIndex.firstObject; 27 | if (nil == mainStatusBar) { 28 | return CGSizeZero; 29 | } 30 | CGSize result = mainStatusBar.frame.size; 31 | // Workaround for https://github.com/appium/appium/issues/15961 32 | return CGSizeMake(MAX(result.width, result.height), MIN(result.width, result.height)); 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBTVNavigationTracker-Private.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2018-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #if TARGET_OS_TV 13 | 14 | @interface FBTVNavigationItem () 15 | @property (nonatomic, readonly) NSString *uid; 16 | @property (nonatomic, readonly) NSMutableSet* directions; 17 | 18 | + (instancetype)itemWithUid:(NSString *) uid; 19 | @end 20 | 21 | 22 | @interface FBTVNavigationTracker () 23 | 24 | - (FBTVDirection)horizontalDirectionWithItem:(FBTVNavigationItem *)item andDelta:(CGFloat)delta; 25 | - (FBTVDirection)verticalDirectionWithItem:(FBTVNavigationItem *)item andDelta:(CGFloat)delta; 26 | @end 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBTVNavigationTracker.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2018-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #if TARGET_OS_TV 14 | 15 | /** 16 | Defines directions to move focuse to. 17 | */ 18 | typedef NS_ENUM(NSUInteger, FBTVDirection) { 19 | FBTVDirectionUp = 0, 20 | FBTVDirectionDown = 1, 21 | FBTVDirectionLeft = 2, 22 | FBTVDirectionRight = 3, 23 | FBTVDirectionNone = 4 24 | }; 25 | 26 | NS_ASSUME_NONNULL_BEGIN 27 | 28 | @interface FBTVNavigationItem : NSObject 29 | @end 30 | 31 | @interface FBTVNavigationTracker : NSObject 32 | 33 | /** 34 | Track the target element's point 35 | 36 | @param targetElement A target element which will track 37 | @return An instancce of FBTVNavigationTracker 38 | */ 39 | + (instancetype)trackerWithTargetElement: (XCUIElement *) targetElement; 40 | 41 | /** 42 | Determine the correct direction to move the focus to the tracked target 43 | element from the currently focused one 44 | 45 | @return FBTVDirection to move the focus to 46 | */ 47 | - (FBTVDirection)directionToFocusedElement; 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBUnattachedAppLauncher.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | /** 15 | Launches apps without attaching them to an XCUITest or a WDA session, allowing them to remain open 16 | when WDA closes. 17 | */ 18 | @interface FBUnattachedAppLauncher : NSObject 19 | 20 | /** 21 | Launch the app with the specified bundle ID. Return YES if successful, NO otherwise. 22 | */ 23 | + (BOOL)launchAppWithBundleId:(NSString *)bundleId; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBUnattachedAppLauncher.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBUnattachedAppLauncher.h" 11 | 12 | #import 13 | 14 | #import "LSApplicationWorkspace.h" 15 | 16 | @implementation FBUnattachedAppLauncher 17 | 18 | + (BOOL)launchAppWithBundleId:(NSString *)bundleId { 19 | return [[LSApplicationWorkspace defaultWorkspace] openApplicationWithBundleID:bundleId]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBBaseActionsSynthesizer.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | #if !TARGET_OS_TV 15 | @interface FBW3CActionsSynthesizer : FBBaseActionsSynthesizer 16 | 17 | @end 18 | #endif 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Utilities/FBXMLGenerationOptions.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBXMLGenerationOptions.h" 11 | 12 | @implementation FBXMLGenerationOptions 13 | 14 | - (FBXMLGenerationOptions *)withScope:(NSString *)scope 15 | { 16 | self.scope = scope; 17 | return self; 18 | } 19 | 20 | - (FBXMLGenerationOptions *)withExcludedAttributes:(NSArray *)excludedAttributes 21 | { 22 | self.excludedAttributes = excludedAttributes; 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/CocoaHTTPServer/Categories/DDNumber.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | 4 | @interface NSNumber (DDNumber) 5 | 6 | + (BOOL)parseString:(NSString *)str intoSInt64:(SInt64 *)pNum; 7 | + (BOOL)parseString:(NSString *)str intoUInt64:(UInt64 *)pNum; 8 | 9 | + (BOOL)parseString:(NSString *)str intoNSInteger:(NSInteger *)pNum; 10 | + (BOOL)parseString:(NSString *)str intoNSUInteger:(NSUInteger *)pNum; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/CocoaHTTPServer/HTTPMessage.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The HTTPMessage class is a simple Objective-C wrapper around Apple's CFHTTPMessage class. 3 | **/ 4 | 5 | #import 6 | 7 | #if TARGET_OS_IPHONE 8 | // Note: You may need to add the CFNetwork Framework to your project 9 | #import 10 | #endif 11 | 12 | #define HTTPVersion1_0 ((NSString *)kCFHTTPVersion1_0) 13 | #define HTTPVersion1_1 ((NSString *)kCFHTTPVersion1_1) 14 | 15 | 16 | @interface HTTPMessage : NSObject 17 | { 18 | CFHTTPMessageRef message; 19 | } 20 | 21 | - (id)initEmptyRequest; 22 | 23 | - (id)initRequestWithMethod:(NSString *)method URL:(NSURL *)url version:(NSString *)version; 24 | 25 | - (id)initResponseWithStatusCode:(NSInteger)code description:(NSString *)description version:(NSString *)version; 26 | 27 | - (BOOL)appendData:(NSData *)data; 28 | 29 | - (BOOL)isHeaderComplete; 30 | 31 | - (NSString *)version; 32 | 33 | - (NSString *)method; 34 | - (NSURL *)url; 35 | 36 | - (NSInteger)statusCode; 37 | 38 | - (NSDictionary *)allHeaderFields; 39 | - (NSString *)headerField:(NSString *)headerField; 40 | 41 | - (void)setHeaderField:(NSString *)headerField value:(NSString *)headerFieldValue; 42 | 43 | - (NSData *)messageData; 44 | 45 | - (NSData *)body; 46 | - (void)setBody:(NSData *)body; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/CocoaHTTPServer/LICENSE: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2011, Deusty, LLC 4 | All rights reserved. 5 | 6 | Redistribution and use of this software in source and binary forms, 7 | with or without modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above 10 | copyright notice, this list of conditions and the 11 | following disclaimer. 12 | 13 | * Neither the name of Deusty nor the names of its 14 | contributors may be used to endorse or promote products 15 | derived from this software without specific prior 16 | written permission of Deusty, LLC. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/CocoaHTTPServer/Responses/HTTPDataResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | 4 | 5 | @interface HTTPDataResponse : NSObject 6 | { 7 | NSUInteger offset; 8 | NSData *data; 9 | } 10 | 11 | - (id)initWithData:(NSData *)data; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/CocoaHTTPServer/Responses/HTTPErrorResponse.h: -------------------------------------------------------------------------------- 1 | #import "HTTPResponse.h" 2 | 3 | @interface HTTPErrorResponse : NSObject { 4 | NSInteger _status; 5 | } 6 | 7 | - (id)initWithErrorCode:(int)httpErrorCode; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/CocoaHTTPServer/Responses/HTTPErrorResponse.m: -------------------------------------------------------------------------------- 1 | #import "HTTPErrorResponse.h" 2 | 3 | #pragma clang diagnostic ignored "-Wdirect-ivar-access" 4 | 5 | @implementation HTTPErrorResponse 6 | 7 | -(id)initWithErrorCode:(int)httpErrorCode 8 | { 9 | if ((self = [super init])) 10 | { 11 | _status = httpErrorCode; 12 | } 13 | 14 | return self; 15 | } 16 | 17 | - (UInt64) contentLength { 18 | return 0; 19 | } 20 | 21 | - (UInt64) offset { 22 | return 0; 23 | } 24 | 25 | - (void)setOffset:(UInt64)offset { 26 | ; 27 | } 28 | 29 | - (NSData*) readDataOfLength:(NSUInteger)length { 30 | return nil; 31 | } 32 | 33 | - (BOOL) isDone { 34 | return YES; 35 | } 36 | 37 | - (NSInteger) status { 38 | return _status; 39 | } 40 | @end 41 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/HTTPResponseProxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | 4 | // Wraps an HTTPResponse object to allow setting a custom status code 5 | // without needing to create subclasses of every response. 6 | @interface HTTPResponseProxy : NSObject 7 | 8 | @property (nonatomic) NSObject *response; 9 | @property (nonatomic) NSInteger status; 10 | 11 | - (NSInteger)customStatus; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Matt Stevens 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/Route.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "RoutingHTTPServer.h" 3 | 4 | @interface Route : NSObject 5 | 6 | @property (nonatomic) NSRegularExpression *regex; 7 | @property (nonatomic, copy) RequestHandler handler; 8 | 9 | #if __has_feature(objc_arc_weak) 10 | @property (nonatomic, weak) id target; 11 | #else 12 | @property (nonatomic, assign) id target; 13 | #endif 14 | 15 | @property (nonatomic, assign) SEL selector; 16 | @property (nonatomic) NSArray *keys; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/Route.m: -------------------------------------------------------------------------------- 1 | #import "Route.h" 2 | 3 | @implementation Route 4 | 5 | @synthesize regex; 6 | @synthesize handler; 7 | @synthesize target; 8 | @synthesize selector; 9 | @synthesize keys; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/RouteRequest.h: -------------------------------------------------------------------------------- 1 | #import 2 | @class HTTPMessage; 3 | 4 | @interface RouteRequest : NSObject 5 | 6 | @property (nonatomic, readonly) NSDictionary *headers; 7 | @property (nonatomic, readonly) NSDictionary *params; 8 | 9 | - (id)initWithHTTPMessage:(HTTPMessage *)msg parameters:(NSDictionary *)params; 10 | - (NSString *)header:(NSString *)field; 11 | - (id)param:(NSString *)name; 12 | - (NSString *)method; 13 | - (NSURL *)url; 14 | - (NSData *)body; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/RouteRequest.m: -------------------------------------------------------------------------------- 1 | #import "RouteRequest.h" 2 | #import "HTTPMessage.h" 3 | 4 | #pragma clang diagnostic ignored "-Wdirect-ivar-access" 5 | #pragma clang diagnostic ignored "-Widiomatic-parentheses" 6 | 7 | @implementation RouteRequest { 8 | HTTPMessage *message; 9 | } 10 | 11 | @synthesize params; 12 | 13 | - (id)initWithHTTPMessage:(HTTPMessage *)msg parameters:(NSDictionary *)parameters { 14 | if (self = [super init]) { 15 | params = parameters; 16 | message = msg; 17 | } 18 | return self; 19 | } 20 | 21 | - (NSDictionary *)headers { 22 | return [message allHeaderFields]; 23 | } 24 | 25 | - (NSString *)header:(NSString *)field { 26 | return [message headerField:field]; 27 | } 28 | 29 | - (id)param:(NSString *)name { 30 | return [params objectForKey:name]; 31 | } 32 | 33 | - (NSString *)method { 34 | return [message method]; 35 | } 36 | 37 | - (NSURL *)url { 38 | return [message url]; 39 | } 40 | 41 | - (NSData *)body { 42 | return [message body]; 43 | } 44 | 45 | - (NSString *)description { 46 | NSData *data = [message messageData]; 47 | return [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/RouteResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPResponse.h" 3 | @class HTTPConnection; 4 | @class HTTPResponseProxy; 5 | 6 | @interface RouteResponse : NSObject 7 | 8 | @property (nonatomic, unsafe_unretained, readonly) HTTPConnection *connection; 9 | @property (nonatomic, readonly) NSDictionary *headers; 10 | @property (nonatomic, strong) NSObject *response; 11 | @property (nonatomic, readonly) NSObject *proxiedResponse; 12 | @property (nonatomic) NSInteger statusCode; 13 | 14 | - (id)initWithConnection:(HTTPConnection *)theConnection; 15 | - (void)setHeader:(NSString *)field value:(NSString *)value; 16 | - (void)respondWithString:(NSString *)string; 17 | - (void)respondWithString:(NSString *)string encoding:(NSStringEncoding)encoding; 18 | - (void)respondWithData:(NSData *)data; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /WebDriverAgentLib/Vendor/RoutingHTTPServer/RoutingConnection.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "HTTPConnection.h" 3 | 4 | @interface RoutingConnection : HTTPConnection 5 | @end 6 | -------------------------------------------------------------------------------- /WebDriverAgentRunner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | NSLocationAlwaysAndWhenInUseUsageDescription 24 | 25 | NSLocationAlwaysUsageDescription 26 | 27 | NSLocationWhenInUseUsageDescription 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | @interface AppDelegate () 13 | @end 14 | 15 | @implementation AppDelegate 16 | @end 17 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBAlertViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface FBAlertViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBNavigationController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | #import 10 | 11 | @interface FBNavigationController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBNavigationController.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBNavigationController.h" 11 | 12 | @implementation FBNavigationController 13 | 14 | #if !TARGET_OS_TV 15 | - (UIInterfaceOrientationMask)supportedInterfaceOrientations 16 | { 17 | return UIInterfaceOrientationMaskAll; 18 | } 19 | #endif 20 | 21 | - (BOOL)shouldAutorotate 22 | { 23 | return YES; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBScrollViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface FBScrollViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBScrollViewController.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBScrollViewController.h" 11 | 12 | #import "FBTableDataSource.h" 13 | 14 | static const CGFloat FBSubviewHeight = 40.0; 15 | 16 | @interface FBScrollViewController () 17 | @property (nonatomic, weak) IBOutlet UIScrollView *scrollView; 18 | @property (nonatomic, strong) IBOutlet FBTableDataSource *dataSource; 19 | @end 20 | 21 | @implementation FBScrollViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | [self setupLabelViews]; 26 | self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.view.frame), self.dataSource.count * FBSubviewHeight); 27 | } 28 | 29 | - (void)setupLabelViews 30 | { 31 | NSUInteger count = self.dataSource.count; 32 | for (NSInteger i = 0 ; i < count ; i++) { 33 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, i * FBSubviewHeight, CGRectGetWidth(self.view.frame), FBSubviewHeight)]; 34 | label.text = [self.dataSource textForElementAtIndex:i]; 35 | label.textAlignment = NSTextAlignmentCenter; 36 | [self.scrollView addSubview:label]; 37 | } 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBTableDataSource.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface FBTableDataSource : NSObject 13 | 14 | - (NSUInteger)count; 15 | - (NSString *)textForElementAtIndex:(NSInteger)index; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/FBTableDataSource.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBTableDataSource.h" 11 | 12 | @implementation FBTableDataSource 13 | 14 | - (NSUInteger)count 15 | { 16 | return 100; 17 | } 18 | 19 | - (NSString *)textForElementAtIndex:(NSInteger)index 20 | { 21 | return [NSString stringWithFormat:@"%ld", (long)index]; 22 | } 23 | 24 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 25 | { 26 | return self.count; 27 | } 28 | 29 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 30 | { 31 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 32 | cell.textLabel.text = [self textForElementAtIndex:indexPath.row]; 33 | return cell; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/TouchSpotView.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface TouchSpotView : UIView 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/TouchSpotView.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "TouchSpotView.h" 11 | 12 | @implementation TouchSpotView 13 | 14 | - (instancetype)initWithFrame:(CGRect)frame 15 | { 16 | self = [super initWithFrame:frame]; 17 | if (self) { 18 | self.backgroundColor = UIColor.lightGrayColor; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)setBounds:(CGRect)newBounds 24 | { 25 | super.bounds = newBounds; 26 | self.layer.cornerRadius = newBounds.size.width / 2.0; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/TouchViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "TouchableView.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface TouchViewController : UIViewController 16 | 17 | @property (weak, nonatomic) IBOutlet TouchableView *touchable; 18 | @property (weak, nonatomic) IBOutlet UILabel *numberOfTapsLabel; 19 | @property (weak, nonatomic) IBOutlet UILabel *numberOfTouchesLabel; 20 | 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/TouchViewController.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "TouchViewController.h" 11 | 12 | @implementation TouchViewController 13 | 14 | - (void)viewDidLoad 15 | { 16 | [super viewDidLoad]; 17 | self.touchable.delegate = self; 18 | self.numberOfTouchesLabel.text = @"0"; 19 | self.numberOfTapsLabel.text = @"0"; 20 | } 21 | 22 | - (void)shouldHandleTapsNumber:(int)numberOfTaps { 23 | self.numberOfTapsLabel.text = [NSString stringWithFormat:@"%d", numberOfTaps]; 24 | } 25 | 26 | - (void)shouldHandleTouchesNumber:(int)touchesCount { 27 | self.numberOfTouchesLabel.text = [NSString stringWithFormat:@"%d", touchesCount]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/TouchableView.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "TouchSpotView.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @protocol TouchableViewDelegate 16 | 17 | - (void)shouldHandleTouchesNumber:(int)touchesCount; 18 | - (void)shouldHandleTapsNumber:(int)numberOfTaps; 19 | 20 | @end 21 | 22 | @interface TouchableView : UIView 23 | 24 | @property (nonatomic) NSMutableDictionary *touchViews; 25 | @property (nonatomic) int numberOFTaps; 26 | @property (nonatomic) id delegate; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/Classes/ViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface ViewController : UIViewController 13 | @end 14 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationApp/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, @"AppDelegate"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/FBConfigurationTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import "FBIntegrationTestCase.h" 12 | 13 | #import "FBConfiguration.h" 14 | #import "FBRuntimeUtils.h" 15 | 16 | @interface FBConfigurationTests : FBIntegrationTestCase 17 | 18 | @end 19 | 20 | @implementation FBConfigurationTests 21 | 22 | - (void)setUp 23 | { 24 | [super setUp]; 25 | [self launchApplication]; 26 | } 27 | 28 | - (void)testReduceMotion 29 | { 30 | BOOL defaultReduceMotionEnabled = [FBConfiguration reduceMotionEnabled]; 31 | 32 | [FBConfiguration setReduceMotionEnabled:YES]; 33 | XCTAssertTrue([FBConfiguration reduceMotionEnabled]); 34 | 35 | [FBConfiguration setReduceMotionEnabled:defaultReduceMotionEnabled]; 36 | XCTAssertEqual([FBConfiguration reduceMotionEnabled], defaultReduceMotionEnabled); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/FBFailureProofTestCaseTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "FBFailureProofTestCase.h" 13 | #import "FBExceptionHandler.h" 14 | 15 | @interface FBFailureProofTestCaseTests : FBFailureProofTestCase 16 | @end 17 | 18 | @implementation FBFailureProofTestCaseTests 19 | 20 | - (void)setUp 21 | { 22 | [super setUp]; 23 | [[XCUIApplication new] launch]; 24 | } 25 | 26 | - (void)testPreventElementSearchFailure 27 | { 28 | [[XCUIApplication new].buttons[@"kaboom"] tap]; 29 | } 30 | 31 | - (void)testInactiveAppSearch 32 | { 33 | [[XCUIDevice sharedDevice] pressButton:XCUIDeviceButtonHome]; 34 | [[XCUIApplication new].buttons[@"kaboom"] tap]; 35 | } 36 | 37 | - (void)testPreventAssertFailure 38 | { 39 | XCTAssertNotNil(nil); 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/FBScreenTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "FBIntegrationTestCase.h" 13 | #import "FBScreen.h" 14 | 15 | @interface FBScreenTests : FBIntegrationTestCase 16 | @end 17 | 18 | @implementation FBScreenTests 19 | 20 | - (void)setUp 21 | { 22 | [super setUp]; 23 | [self launchApplication]; 24 | } 25 | 26 | - (void)testScreenScale 27 | { 28 | XCTAssertTrue([FBScreen scale] >= 2); 29 | } 30 | 31 | - (void)testStatusBarSize 32 | { 33 | CGSize statusBarSize = [FBScreen statusBarSizeForApplication:self.testedApplication]; 34 | BOOL statusBarSizeIsZero = CGSizeEqualToSize(CGSizeZero, statusBarSize); 35 | XCTAssertFalse(statusBarSizeIsZero); 36 | } 37 | 38 | @end 39 | 40 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/FBTestMacros.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | /** 13 | Macro used to wait till certain condition is true. 14 | If condition will not become true within default timeout (1m) it will fail running test 15 | */ 16 | #define FBAssertWaitTillBecomesTrue(condition) \ 17 | ({ \ 18 | NSError *__error; \ 19 | XCTAssertTrue([[[FBRunLoopSpinner new] \ 20 | interval:1.0] \ 21 | spinUntilTrue:^BOOL{ \ 22 | return (condition); \ 23 | }]); \ 24 | XCTAssertNil(__error); \ 25 | }) 26 | 27 | #define FBWaitExact(timeoutSeconds) \ 28 | ({ \ 29 | [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:(timeoutSeconds)]]; \ 30 | }) 31 | 32 | #define FBCellElementWithLabel(label) ([self.testedApplication descendantsMatchingType:XCUIElementTypeAny][label]) 33 | #define FBAssertVisibleCell(label) FBAssertWaitTillBecomesTrue(FBCellElementWithLabel(label).fb_isVisible) 34 | #define FBAssertInvisibleCell(label) FBAssertWaitTillBecomesTrue(!FBCellElementWithLabel(label).fb_isVisible) 35 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.facebook.wda.integrationTests 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/XCElementSnapshotHitPointTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "FBIntegrationTestCase.h" 11 | #import "FBTestMacros.h" 12 | #import "FBXCElementSnapshotWrapper+Helpers.h" 13 | #import "XCUIElement.h" 14 | #import "XCUIElement+FBUtilities.h" 15 | 16 | @interface XCElementSnapshotHitPoint : FBIntegrationTestCase 17 | @end 18 | 19 | @implementation XCElementSnapshotHitPoint 20 | 21 | - (void)testAccessibilityActivationPoint 22 | { 23 | [self launchApplication]; 24 | [self goToAttributesPage]; 25 | XCUIElement *dstBtn = self.testedApplication.buttons[@"not_accessible"]; 26 | CGPoint hitPoint = [FBXCElementSnapshotWrapper ensureWrapped:dstBtn.fb_takeSnapshot].fb_hitPoint.CGPointValue; 27 | XCTAssertTrue(hitPoint.x > 0 && hitPoint.y > 0); 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WebDriverAgentTests/IntegrationTests/XCUIDeviceHealthCheckTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "FBIntegrationTestCase.h" 13 | #import "XCUIDevice+FBHealthCheck.h" 14 | #import "XCUIElement.h" 15 | 16 | @interface XCUIDeviceHealthCheckTests : FBIntegrationTestCase 17 | @end 18 | 19 | @implementation XCUIDeviceHealthCheckTests 20 | 21 | - (void)testHealthCheck 22 | { 23 | [self launchApplication]; 24 | XCTAssertTrue(self.testedApplication.exists); 25 | XCTAssertTrue([[XCUIDevice sharedDevice] fb_healthCheckWithApplication:self.testedApplication]); 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface XCElementSnapshotDouble : NSObject 13 | @property (readwrite, nullable) id value; 14 | @property (readwrite, nullable, copy) NSString *label; 15 | @end 16 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/Doubles/XCUIApplicationDouble.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface XCUIApplicationDouble : NSObject 13 | @property (nonatomic, assign, readonly) BOOL didTerminate; 14 | @property (nonatomic, strong) NSString* bundleID; 15 | @property (nonatomic) BOOL fb_shouldWaitForQuiescence; 16 | 17 | - (BOOL)running; 18 | @end 19 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/Doubles/XCUIApplicationDouble.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "XCUIApplicationDouble.h" 11 | 12 | @interface XCUIApplicationDouble () 13 | @property (nonatomic, assign, readwrite) BOOL didTerminate; 14 | @end 15 | 16 | @implementation XCUIApplicationDouble 17 | 18 | - (instancetype)init 19 | { 20 | self = [super init]; 21 | if (self) { 22 | _bundleID = @"some.bundle.identifier"; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)terminate 28 | { 29 | self.didTerminate = YES; 30 | } 31 | 32 | - (NSUInteger)processID 33 | { 34 | return 0; 35 | } 36 | 37 | - (NSString *)bundleID 38 | { 39 | return @"com.facebook.awesome"; 40 | } 41 | 42 | - (void)fb_nativeResolve 43 | { 44 | 45 | } 46 | 47 | - (id)query 48 | { 49 | return nil; 50 | } 51 | 52 | - (BOOL)fb_shouldWaitForQuiescence 53 | { 54 | return NO; 55 | } 56 | 57 | -(void)setFb_shouldWaitForQuiescence:(BOOL)value 58 | { 59 | 60 | } 61 | 62 | - (BOOL)running 63 | { 64 | return NO; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/FBConfigurationTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "FBConfiguration.h" 13 | 14 | @interface FBConfigurationTests : XCTestCase 15 | 16 | @end 17 | 18 | @implementation FBConfigurationTests 19 | 20 | - (void)setUp 21 | { 22 | [super setUp]; 23 | unsetenv("USE_PORT"); 24 | unsetenv("VERBOSE_LOGGING"); 25 | } 26 | 27 | - (void)testBindingPortDefault 28 | { 29 | XCTAssertTrue(NSEqualRanges([FBConfiguration bindingPortRange], NSMakeRange(8100, 100))); 30 | } 31 | 32 | - (void)testBindingPortEnvironmentOverwrite 33 | { 34 | setenv("USE_PORT", "1000", 1); 35 | XCTAssertTrue(NSEqualRanges([FBConfiguration bindingPortRange], NSMakeRange(1000, 1))); 36 | } 37 | 38 | - (void)testVerboseLoggingDefault 39 | { 40 | XCTAssertFalse([FBConfiguration verboseLoggingEnabled]); 41 | } 42 | 43 | - (void)testVerboseLoggingEnvironmentOverwrite 44 | { 45 | setenv("VERBOSE_LOGGING", "YES", 1); 46 | XCTAssertTrue([FBConfiguration verboseLoggingEnabled]); 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/FBElementUtilitiesTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | 11 | #import 12 | 13 | #import "FBElement.h" 14 | #import "XCUIElementDouble.h" 15 | #import "FBElementUtils.h" 16 | 17 | @interface FBElementUtilitiesTests : XCTestCase 18 | @end 19 | 20 | @implementation FBElementUtilitiesTests 21 | 22 | - (void)testTypesFiltering { 23 | NSMutableArray *elements = [NSMutableArray new]; 24 | XCUIElementDouble *el1 = [XCUIElementDouble new]; 25 | [elements addObject:el1]; 26 | XCUIElementDouble *el2 = [XCUIElementDouble new]; 27 | el2.elementType = XCUIElementTypeAlert; 28 | el2.wdType = @"XCUIElementTypeAlert"; 29 | [elements addObject:el2]; 30 | XCUIElementDouble *el3 = [XCUIElementDouble new]; 31 | [elements addObject:el3]; 32 | 33 | NSSet *result = [FBElementUtils uniqueElementTypesWithElements:elements]; 34 | XCTAssertEqual([result count], 2); 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/FBXMLSafeStringTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "NSString+FBXMLSafeString.h" 13 | 14 | @interface FBXMLSafeStringTests : XCTestCase 15 | @end 16 | 17 | @implementation FBXMLSafeStringTests 18 | 19 | - (void)testSafeXmlStringTransformationWithEmptyReplacement { 20 | NSString *withInvalidChar = [NSString stringWithFormat:@"bla%@", @"\uFFFF"]; 21 | NSString *withoutInvalidChar = @"bla"; 22 | XCTAssertNotEqualObjects(withInvalidChar, withoutInvalidChar); 23 | XCTAssertEqualObjects([withInvalidChar fb_xmlSafeStringWithReplacement:@""], withoutInvalidChar); 24 | } 25 | 26 | - (void)testSafeXmlStringTransformationWithNonEmptyReplacement { 27 | NSString *withInvalidChar = [NSString stringWithFormat:@"bla%@", @"\uFFFF"]; 28 | XCTAssertEqualObjects([withInvalidChar fb_xmlSafeStringWithReplacement:@"1"], @"bla1"); 29 | } 30 | 31 | - (void)testSafeXmlStringTransformationWithSmileys { 32 | NSString *validString = @"Yo👿"; 33 | XCTAssertEqualObjects([validString fb_xmlSafeStringWithReplacement:@""], validString); 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.facebook.wda.unitTests 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests/NSDictionaryFBUtf8SafeTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "NSDictionary+FBUtf8SafeDictionary.h" 13 | 14 | @interface NSDictionaryFBUtf8SafeTests : XCTestCase 15 | @end 16 | 17 | @implementation NSDictionaryFBUtf8SafeTests 18 | 19 | - (void)testEmptySafeDictConversion 20 | { 21 | NSDictionary *d = @{}; 22 | XCTAssertEqualObjects(d, d.fb_utf8SafeDictionary); 23 | } 24 | 25 | - (void)testNonEmptySafeDictConversion 26 | { 27 | NSDictionary *d = @{ 28 | @"1": @[@3, @4], 29 | @"5": @{@"6": @7, @"8": @9}, 30 | @"10": @"11" 31 | }; 32 | XCTAssertEqualObjects(d, d.fb_utf8SafeDictionary); 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /WebDriverAgentTests/UnitTests_tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.facebook.wda.unitTests 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /azure-templates/base_job.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | name: '' 3 | action: '' 4 | target: '' 5 | dest: '' 6 | sdk: '' 7 | iphoneModel: '' 8 | ipadModel: '' 9 | tvModel: '' 10 | iosVersion: '' 11 | xcodeVersion: '' 12 | tvVersion: '' 13 | vmImage: '' 14 | extraXcArgs: '' 15 | 16 | 17 | jobs: 18 | - job: ${{ parameters.name }} 19 | pool: 20 | vmImage: ${{ parameters.vmImage }} 21 | variables: 22 | ACTION: ${{ parameters.action }} 23 | TARGET: ${{ parameters.target }} 24 | DEST: ${{ parameters.dest }} 25 | SDK: ${{ parameters.sdk }} 26 | CODE_SIGN: ${{ parameters.codeSign }} 27 | IPHONE_MODEL: ${{ parameters.iphoneModel }} 28 | TV_MODEL: ${{ parameters.tvModel }} 29 | IPAD_MODEL: ${{ parameters.ipadModel }} 30 | IOS_VERSION: ${{ parameters.iosVersion }} 31 | XCODE_VERSION: ${{ parameters.xcodeVersion }} 32 | TV_VERSION: ${{ parameters.tvVersion }} 33 | EXTRA_XC_ARGS: ${{ parameters.extraXcArgs }} 34 | steps: 35 | - template: bootstrap_steps.yml 36 | - script: ./Scripts/build.sh 37 | -------------------------------------------------------------------------------- /azure-templates/bootstrap_steps.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - script: sudo xcode-select --switch "/Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer" 3 | - script: mkdir -p ./Resources/WebDriverAgent.bundle 4 | - task: UseRubyVersion@0 5 | inputs: 6 | versionSpec: '3' 7 | addToPath: true 8 | -------------------------------------------------------------------------------- /azure-templates/node_setup_steps.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - task: NodeTool@0 3 | inputs: 4 | versionSpec: "$(DEFAULT_NODE_VERSION)" 5 | -------------------------------------------------------------------------------- /ci-jobs/scripts/azure-print-tag-name.js: -------------------------------------------------------------------------------- 1 | 2 | const branch = process.env.BUILD_SOURCEBRANCH || ''; 3 | console.log(branch.replace(/^refs\/tags\//, '')); // eslint-disable-line no-console -------------------------------------------------------------------------------- /ci-jobs/templates/build.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | vmImage: 'macOS-11' 3 | name: macOS_11 4 | excludeXcode: $(excludeXcode) 5 | jobs: 6 | - job: ${{ parameters.name }} 7 | variables: 8 | EXCLUDE_XCODE: ${{ parameters.excludeXcode }} 9 | pool: 10 | vmImage: ${{ parameters.vmImage }} 11 | dependsOn: create_github_release 12 | steps: 13 | - script: node ./ci-jobs/scripts/azure-print-tag-name 14 | displayName: Print Tag Name 15 | - script: ls /Applications/ 16 | displayName: List Installed Applications 17 | - name: Use Node.js 18 | uses: actions/setup-node@v3 19 | with: 20 | node-version: lts/* 21 | - script: npm install 22 | displayName: Install Node Modules 23 | - script: mkdir -p Resources/WebDriverAgent.bundle 24 | displayName: Make Resources Folder 25 | - script: node ./Scripts/build-webdriveragent.js 26 | displayName: Build WebDriverAgents 27 | - script: ls ./bundles 28 | displayName: List WDA Bundles 29 | - task: PublishPipelineArtifact@0 30 | inputs: 31 | targetPath: bundles/ 32 | artifactName: ${{ parameters.name }} 33 | - script: | 34 | brew install ghr 35 | ghr $(node ./ci-jobs/scripts/azure-print-tag-name) bundles/ 36 | env: 37 | GITHUB_TOKEN: $(GITHUB_TOKEN) 38 | displayName: Upload to GitHub Releases 39 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import * as dependencies from './lib/check-dependencies'; 2 | import * as proxies from './lib/no-session-proxy'; 3 | import * as driver from './lib/webdriveragent'; 4 | import * as constants from './lib/constants'; 5 | import * as utils from './lib/utils'; 6 | 7 | 8 | const { checkForDependencies, bundleWDASim } = dependencies; 9 | const { NoSessionProxy } = proxies; 10 | const { WebDriverAgent } = driver; 11 | const { WDA_BASE_URL, WDA_RUNNER_BUNDLE_ID, PROJECT_FILE } = constants; 12 | const { resetTestProcesses, BOOTSTRAP_PATH } = utils; 13 | 14 | export { 15 | WebDriverAgent, 16 | NoSessionProxy, 17 | checkForDependencies, bundleWDASim, 18 | resetTestProcesses, 19 | BOOTSTRAP_PATH, 20 | WDA_RUNNER_BUNDLE_ID, PROJECT_FILE, 21 | WDA_BASE_URL, 22 | }; 23 | -------------------------------------------------------------------------------- /lib/check-dependencies.js: -------------------------------------------------------------------------------- 1 | import { fs } from '@appium/support'; 2 | import _ from 'lodash'; 3 | import { exec } from 'teen_process'; 4 | import path from 'path'; 5 | import XcodeBuild from './xcodebuild'; 6 | import { 7 | WDA_SCHEME, SDK_SIMULATOR, WDA_RUNNER_APP 8 | } from './constants'; 9 | import { BOOTSTRAP_PATH } from './utils'; 10 | import log from './logger'; 11 | 12 | async function buildWDASim () { 13 | const args = [ 14 | '-project', path.join(BOOTSTRAP_PATH, 'WebDriverAgent.xcodeproj'), 15 | '-scheme', WDA_SCHEME, 16 | '-sdk', SDK_SIMULATOR, 17 | 'CODE_SIGN_IDENTITY=""', 18 | 'CODE_SIGNING_REQUIRED="NO"', 19 | 'GCC_TREAT_WARNINGS_AS_ERRORS=0', 20 | ]; 21 | await exec('xcodebuild', args); 22 | } 23 | 24 | // eslint-disable-next-line require-await 25 | async function checkForDependencies () { 26 | log.debug('Dependencies are up to date'); 27 | return false; 28 | } 29 | 30 | async function bundleWDASim (xcodebuild) { 31 | if (xcodebuild && !_.isFunction(xcodebuild.retrieveDerivedDataPath)) { 32 | xcodebuild = new XcodeBuild('', {}); 33 | } 34 | 35 | const derivedDataPath = await xcodebuild.retrieveDerivedDataPath(); 36 | const wdaBundlePath = path.join(derivedDataPath, 'Build', 'Products', 'Debug-iphonesimulator', WDA_RUNNER_APP); 37 | if (await fs.exists(wdaBundlePath)) { 38 | return wdaBundlePath; 39 | } 40 | await buildWDASim(); 41 | return wdaBundlePath; 42 | } 43 | 44 | export { checkForDependencies, bundleWDASim }; 45 | -------------------------------------------------------------------------------- /lib/constants.js: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | const WDA_RUNNER_BUNDLE_ID = 'com.facebook.WebDriverAgentRunner'; 4 | const WDA_RUNNER_BUNDLE_ID_FOR_XCTEST = `${WDA_RUNNER_BUNDLE_ID}.xctrunner`; 5 | const WDA_RUNNER_APP = 'WebDriverAgentRunner-Runner.app'; 6 | const WDA_SCHEME = 'WebDriverAgentRunner'; 7 | const PROJECT_FILE = 'project.pbxproj'; 8 | const WDA_BASE_URL = 'http://127.0.0.1'; 9 | 10 | const PLATFORM_NAME_TVOS = 'tvOS'; 11 | const PLATFORM_NAME_IOS = 'iOS'; 12 | 13 | const SDK_SIMULATOR = 'iphonesimulator'; 14 | const SDK_DEVICE = 'iphoneos'; 15 | 16 | const WDA_UPGRADE_TIMESTAMP_PATH = path.join('.appium', 'webdriveragent', 'upgrade.time'); 17 | 18 | export { 19 | WDA_RUNNER_BUNDLE_ID, WDA_RUNNER_APP, PROJECT_FILE, 20 | WDA_SCHEME, PLATFORM_NAME_TVOS, PLATFORM_NAME_IOS, 21 | SDK_SIMULATOR, SDK_DEVICE, WDA_BASE_URL, WDA_UPGRADE_TIMESTAMP_PATH, 22 | WDA_RUNNER_BUNDLE_ID_FOR_XCTEST 23 | }; 24 | -------------------------------------------------------------------------------- /lib/logger.js: -------------------------------------------------------------------------------- 1 | import { logger } from '@appium/support'; 2 | 3 | const log = logger.getLogger('WebDriverAgent'); 4 | 5 | export default log; 6 | -------------------------------------------------------------------------------- /lib/no-session-proxy.js: -------------------------------------------------------------------------------- 1 | import { JWProxy } from '@appium/base-driver'; 2 | 3 | 4 | class NoSessionProxy extends JWProxy { 5 | constructor (opts = {}) { 6 | super(opts); 7 | } 8 | 9 | getUrlForProxy (url) { 10 | if (url === '') { 11 | url = '/'; 12 | } 13 | const proxyBase = `${this.scheme}://${this.server}:${this.port}${this.base}`; 14 | let remainingUrl = ''; 15 | if ((new RegExp('^/')).test(url)) { 16 | remainingUrl = url; 17 | } else { 18 | throw new Error(`Did not know what to do with url '${url}'`); 19 | } 20 | remainingUrl = remainingUrl.replace(/\/$/, ''); // can't have trailing slashes 21 | return proxyBase + remainingUrl; 22 | } 23 | } 24 | 25 | export { NoSessionProxy }; 26 | export default NoSessionProxy; 27 | -------------------------------------------------------------------------------- /test/functional/desired.js: -------------------------------------------------------------------------------- 1 | import { util } from '@appium/support'; 2 | 3 | export const PLATFORM_VERSION = process.env.PLATFORM_VERSION ? process.env.PLATFORM_VERSION : '11.3'; 4 | export const DEVICE_NAME = process.env.DEVICE_NAME 5 | || (util.compareVersions(PLATFORM_VERSION, '>=', '13.0') ? 'iPhone X' : 'iPhone 6'); 6 | -------------------------------------------------------------------------------- /test/functional/helpers/simulator.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | import Simctl from 'node-simctl'; 3 | import { retryInterval } from 'asyncbox'; 4 | import { killAllSimulators as simKill } from 'appium-ios-simulator'; 5 | import { resetTestProcesses } from '../../../lib/utils'; 6 | 7 | 8 | async function killAllSimulators () { 9 | if (process.env.CLOUD) { 10 | return; 11 | } 12 | 13 | const simctl = new Simctl(); 14 | const allDevices = _.flatMap(_.values(await simctl.getDevices())); 15 | const bootedDevices = allDevices.filter((device) => device.state === 'Booted'); 16 | 17 | for (const {udid} of bootedDevices) { 18 | // It is necessary to stop the corresponding xcodebuild process before killing 19 | // the simulator, otherwise it will be automatically restarted 20 | await resetTestProcesses(udid, true); 21 | simctl.udid = udid; 22 | await simctl.shutdownDevice(); 23 | } 24 | await simKill(); 25 | } 26 | 27 | async function shutdownSimulator (device) { 28 | // stop XCTest processes if running to avoid unexpected side effects 29 | await resetTestProcesses(device.udid, true); 30 | await device.shutdown(); 31 | } 32 | 33 | async function deleteDeviceWithRetry (udid) { 34 | const simctl = new Simctl({udid}); 35 | try { 36 | await retryInterval(10, 1000, simctl.deleteDevice.bind(simctl)); 37 | } catch (ign) {} 38 | } 39 | 40 | 41 | export { killAllSimulators, shutdownSimulator, deleteDeviceWithRetry }; 42 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@appium/tsconfig/tsconfig.json", 4 | "compilerOptions": { 5 | "strict": false, // TODO: make this flag true 6 | "outDir": "build", 7 | "types": ["node"], 8 | "checkJs": true 9 | }, 10 | "include": [ 11 | "index.js", 12 | "lib" 13 | ] 14 | } 15 | --------------------------------------------------------------------------------