@deque/axe-appium3-webdriveragent 0.0.0-stage → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Configurations/IOSSettings.xcconfig +31 -0
- package/Configurations/IOSTestSettings.xcconfig +1 -0
- package/Configurations/TVOSSettings.xcconfig +31 -0
- package/Configurations/TVOSTestSettings.xcconfig +1 -0
- package/LICENSE +66 -0
- package/LICENSE-3RD-PARTY.md +70 -0
- package/MySwiftFramework/JSONHelper.swift +31 -0
- package/MySwiftFramework/MySwiftFramework.h +18 -0
- package/PrivateHeaders/AccessibilityUtilities/AXSettings.h +15 -0
- package/PrivateHeaders/MobileCoreServices/LSApplicationWorkspace.h +127 -0
- package/PrivateHeaders/TextInput/TIPreferencesController.h +45 -0
- package/PrivateHeaders/UIKitCore/UIKeyboardImpl.h +27 -0
- package/PrivateHeaders/XCTest/CDStructures.h +7 -0
- package/PrivateHeaders/XCTest/NSFastEnumeration-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCAXClient_iOS.h +91 -0
- package/PrivateHeaders/XCTest/XCApplicationQuery.h +30 -0
- package/PrivateHeaders/XCTest/XCDebugLogDelegate-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCPointerEvent.h +63 -0
- package/PrivateHeaders/XCTest/XCPointerEventPath.h +65 -0
- package/PrivateHeaders/XCTest/XCSynthesizedEventRecord.h +55 -0
- package/PrivateHeaders/XCTest/XCTAggregateSuiteRunStatistics.h +38 -0
- package/PrivateHeaders/XCTest/XCTAttachmentManager.h +33 -0
- package/PrivateHeaders/XCTest/XCTCapabilities.h +35 -0
- package/PrivateHeaders/XCTest/XCTCapabilitiesProviding-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTElementSetTransformer-Protocol.h +35 -0
- package/PrivateHeaders/XCTest/XCTElementSnapshotAttributeDataSource-Protocol.h +33 -0
- package/PrivateHeaders/XCTest/XCTElementSnapshotProvider-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTExpectedFailureContextManager.h +35 -0
- package/PrivateHeaders/XCTest/XCTFuture.h +45 -0
- package/PrivateHeaders/XCTest/XCTHarnessEventReporting-Protocol.h +29 -0
- package/PrivateHeaders/XCTest/XCTIssue.h +49 -0
- package/PrivateHeaders/XCTest/XCTIssueHandling-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCTMacCatalystStatusProviding-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMeasureOptions.h +48 -0
- package/PrivateHeaders/XCTest/XCTMemoryChecker.h +50 -0
- package/PrivateHeaders/XCTest/XCTMemoryCheckerDelegate-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCTMessagingChannel_IDEToRunner-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCTMessagingChannel_RunnerToDaemon-Protocol.h +39 -0
- package/PrivateHeaders/XCTest/XCTMessagingChannel_RunnerToIDE-Protocol.h +32 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_ActivityReporting-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_AttachmentFutureResultStatusUpdating-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_BundleRequesting-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_CapabilityExchange-Protocol.h +56 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_DebugLogging-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_EventSynthesis-Protocol.h +34 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_ForcePressureSupportQuerying-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_HIDEventRecording-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_MemoryTesting-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_PerformanceMeasurementReporting-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_ProcessMonitoring-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_ProtectedResourceAuthorization-Protocol.h +22 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_ScreenRecording-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_SelfDiagnosisIssueReporting-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_SignpostRequesting-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_SiriAutomation-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_SystemConfiguration-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_TelemetrySending-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_TestExecution-Protocol.h +28 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_TestReporting-Protocol.h +40 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_UIAutomation-Protocol.h +29 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_UIAutomationRunnerEventReporting-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCTMessagingRole_UserPresence-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTMetricDiagnosticHelper.h +49 -0
- package/PrivateHeaders/XCTest/XCTNSPredicateExpectationObject-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTPromise.h +30 -0
- package/PrivateHeaders/XCTest/XCTRemoteSignpostListenerProxy-Protocol.h +29 -0
- package/PrivateHeaders/XCTest/XCTRepetitionPolicy.h +43 -0
- package/PrivateHeaders/XCTest/XCTReportingSession.h +50 -0
- package/PrivateHeaders/XCTest/XCTReportingSessionConfiguration-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCTReportingSessionIssueReporter-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTReportingSessionTestContainer-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCTReportingSessionTestReporter.h +51 -0
- package/PrivateHeaders/XCTest/XCTRunnerAutomationSession-Protocol.h +38 -0
- package/PrivateHeaders/XCTest/XCTRunnerDaemonSession.h +96 -0
- package/PrivateHeaders/XCTest/XCTRunnerDaemonSessionUIAutomationDelegate-Protocol.h +33 -0
- package/PrivateHeaders/XCTest/XCTRunnerIDESession.h +99 -0
- package/PrivateHeaders/XCTest/XCTRunnerIDESessionDelegate-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTRuntimeDiagnosticsPolicy.h +36 -0
- package/PrivateHeaders/XCTest/XCTRuntimeIssueDetectionPolicy.h +39 -0
- package/PrivateHeaders/XCTest/XCTScreenCapturePolicy.h +35 -0
- package/PrivateHeaders/XCTest/XCTSignpostListener-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCTSkippedTestContext.h +37 -0
- package/PrivateHeaders/XCTest/XCTSourceCodeContext.h +39 -0
- package/PrivateHeaders/XCTest/XCTSourceCodeLocation.h +31 -0
- package/PrivateHeaders/XCTest/XCTTagSelection.h +41 -0
- package/PrivateHeaders/XCTest/XCTTestIdentifier.h +81 -0
- package/PrivateHeaders/XCTest/XCTTestIdentifierSet.h +54 -0
- package/PrivateHeaders/XCTest/XCTTestSelection.h +35 -0
- package/PrivateHeaders/XCTest/XCTWaiter.h +54 -0
- package/PrivateHeaders/XCTest/XCTWaiterManagement-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTWaiterManager-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCTWaiterWait.h +40 -0
- package/PrivateHeaders/XCTest/XCTest.h +53 -0
- package/PrivateHeaders/XCTest/XCTestCase.h +180 -0
- package/PrivateHeaders/XCTest/XCTestCaseDiscoveryUIAutomationDelegate-Protocol.h +20 -0
- package/PrivateHeaders/XCTest/XCTestCaseRun.h +28 -0
- package/PrivateHeaders/XCTest/XCTestCaseUIAutomationDelegate-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCTestCastMethodNamesUIAutomationDelegate-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCTestConfiguration.h +94 -0
- package/PrivateHeaders/XCTest/XCTestDriver.h +64 -0
- package/PrivateHeaders/XCTest/XCTestExpectation.h +50 -0
- package/PrivateHeaders/XCTest/XCTestExpectationDelegate-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCTestObservationCenter.h +60 -0
- package/PrivateHeaders/XCTest/XCTestRun.h +44 -0
- package/PrivateHeaders/XCTest/XCUIAXNotificationHandling-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCUIAccessibilityInterface-Protocol.h +58 -0
- package/PrivateHeaders/XCTest/XCUIAlertMonitoring-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCUIApplication.h +98 -0
- package/PrivateHeaders/XCTest/XCUIApplicationAutomationSessionProviding-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCUIApplicationImpl.h +90 -0
- package/PrivateHeaders/XCTest/XCUIApplicationImplReporter-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCUIApplicationManaging-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCUIApplicationMonitor-Protocol.h +43 -0
- package/PrivateHeaders/XCTest/XCUIApplicationOpenRequest.h +34 -0
- package/PrivateHeaders/XCTest/XCUIApplicationPlatformServicesProviderDelegate-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCUIApplicationProcess.h +105 -0
- package/PrivateHeaders/XCTest/XCUIApplicationProcessDelegate-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCUIApplicationProcessManaging-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCUIApplicationProcessTracker-Protocol.h +28 -0
- package/PrivateHeaders/XCTest/XCUIApplicationRegistry.h +32 -0
- package/PrivateHeaders/XCTest/XCUIButtonConsole.h +26 -0
- package/PrivateHeaders/XCTest/XCUICoordinate.h +49 -0
- package/PrivateHeaders/XCTest/XCUIDevice.h +134 -0
- package/PrivateHeaders/XCTest/XCUIDeviceAutomationModeInterface-Protocol.h +25 -0
- package/PrivateHeaders/XCTest/XCUIDeviceDelayedAttachmentTransferSupportInterface-Protocol.h +22 -0
- package/PrivateHeaders/XCTest/XCUIDeviceEventAndStateInterface-Protocol.h +40 -0
- package/PrivateHeaders/XCTest/XCUIElement.h +207 -0
- package/PrivateHeaders/XCTest/XCUIElementAttributesPrivate-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/XCUIElementEventTarget-Protocol.h +38 -0
- package/PrivateHeaders/XCTest/XCUIElementQuery.h +166 -0
- package/PrivateHeaders/XCTest/XCUIElementTypeQueryProvider_Private-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCUIEventRecording-Protocol.h +37 -0
- package/PrivateHeaders/XCTest/XCUIHitPointResult.h +25 -0
- package/PrivateHeaders/XCTest/XCUIInterruptionMonitoring-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/XCUIIssueDiagnosticsProviding-Protocol.h +23 -0
- package/PrivateHeaders/XCTest/XCUIKnobControl.h +26 -0
- package/PrivateHeaders/XCTest/XCUILocation.h +24 -0
- package/PrivateHeaders/XCTest/XCUIPlatformApplicationServicesProviding-Protocol.h +33 -0
- package/PrivateHeaders/XCTest/XCUIRemoteAccessibilityInterface-Protocol.h +45 -0
- package/PrivateHeaders/XCTest/XCUIRemoteDeviceRunner-Protocol.h +24 -0
- package/PrivateHeaders/XCTest/XCUIRemoteSiriInterface-Protocol.h +30 -0
- package/PrivateHeaders/XCTest/XCUIResetAuthorizationStatusOfProtectedResourcesInterface-Protocol.h +22 -0
- package/PrivateHeaders/XCTest/XCUIScreen.h +53 -0
- package/PrivateHeaders/XCTest/XCUIScreenDataSource-Protocol.h +35 -0
- package/PrivateHeaders/XCTest/XCUISiriService.h +39 -0
- package/PrivateHeaders/XCTest/XCUISystem.h +26 -0
- package/PrivateHeaders/XCTest/XCUIXcodeApplicationManaging-Protocol.h +27 -0
- package/PrivateHeaders/XCTest/_TtC10XCTestCore19XCTReportingContext.h +26 -0
- package/PrivateHeaders/XCTest/_XCTMessaging_VoidProtocol-Protocol.h +20 -0
- package/PrivateHeaders/XCTest/_XCTestObservationInternal-Protocol.h +26 -0
- package/PrivateHeaders/XCTest/_XCTestObservationPrivate-Protocol.h +27 -0
- package/README.md +57 -2
- package/Scripts/build-webdriveragent.mjs +93 -0
- package/Scripts/build.sh +137 -0
- package/Scripts/bundle-mobile-assets.sh +35 -0
- package/Scripts/embed-runner-icon.sh +118 -0
- package/Scripts/fetch-prebuilt-wda.mjs +81 -0
- package/Scripts/update-wda-version.mjs +44 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +8522 -0
- package/WebDriverAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/WebDriverAgent.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/WebDriverAgent.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationApp.xcscheme +87 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationApp_tvOS.xcscheme +78 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationApp_watchOS.xcscheme +78 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_1.xcscheme +93 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_2.xcscheme +93 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_3.xcscheme +93 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_tvOS.xcscheme +93 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_watchOS.xcscheme +93 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentLib.xcscheme +125 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentLib_tvOS.xcscheme +95 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentLib_watchOS.xcscheme +85 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner-nodebug.xcscheme +87 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme +132 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_noauth.xcscheme +70 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme +123 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_watchOS.xcscheme +128 -0
- package/WebDriverAgentLib/Categories/FBXCElementSnapshotWrapper+Helpers.h +100 -0
- package/WebDriverAgentLib/Categories/FBXCElementSnapshotWrapper+Helpers.m +192 -0
- package/WebDriverAgentLib/Categories/NSDictionary+FBUtf8SafeDictionary.h +39 -0
- package/WebDriverAgentLib/Categories/NSDictionary+FBUtf8SafeDictionary.m +105 -0
- package/WebDriverAgentLib/Categories/NSExpression+FBFormat.h +29 -0
- package/WebDriverAgentLib/Categories/NSExpression+FBFormat.m +34 -0
- package/WebDriverAgentLib/Categories/NSString+FBVisualLength.h +18 -0
- package/WebDriverAgentLib/Categories/NSString+FBVisualLength.m +18 -0
- package/WebDriverAgentLib/Categories/NSString+FBXMLSafeString.h +27 -0
- package/WebDriverAgentLib/Categories/NSString+FBXMLSafeString.m +30 -0
- package/WebDriverAgentLib/Categories/XCAXClient_iOS+FBSnapshotReqParams.h +26 -0
- package/WebDriverAgentLib/Categories/XCAXClient_iOS+FBSnapshotReqParams.m +181 -0
- package/WebDriverAgentLib/Categories/XCTIssue+FBPatcher.h +17 -0
- package/WebDriverAgentLib/Categories/XCTIssue+FBPatcher.m +35 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.h +47 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.m +179 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBFocused.h +23 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.h +186 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +674 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBQuiescence.h +24 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBQuiescence.m +28 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.h +82 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m +198 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBUIInterruptions.h +22 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBUIInterruptions.m +31 -0
- package/WebDriverAgentLib/Categories/XCUIApplicationProcess+FBQuiescence.h +27 -0
- package/WebDriverAgentLib/Categories/XCUIApplicationProcess+FBQuiescence.m +111 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHealthCheck.h +30 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHealthCheck.m +47 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.h +236 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +478 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHinge.h +41 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHinge.m +215 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.h +46 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +108 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBVoiceOver.h +66 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBVoiceOver.m +218 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBAccessibility.h +29 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBAccessibility.m +50 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBCaching.h +19 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBCaching.m +36 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBClassChain.h +57 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBClassChain.m +239 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBCustomActions.h +27 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBCustomActions.m +127 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBFind.h +75 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBFind.m +146 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBForceTouch.h +38 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBForceTouch.m +55 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.h +28 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.m +78 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBMinMax.h +33 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBMinMax.m +75 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBPickerWheel.h +45 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBPickerWheel.m +59 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBResolve.h +37 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBResolve.m +51 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBScrolling.h +98 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBScrolling.m +465 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBSwiping.h +38 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBSwiping.m +56 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBTVFocuse.h +35 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBTVFocuse.m +71 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBTyping.h +97 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +233 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBUID.h +42 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBUID.m +85 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.h +108 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +175 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBVisibleFrame.h +35 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBVisibleFrame.m +61 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.h +32 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.m +299 -0
- package/WebDriverAgentLib/Categories/XCUIElementQuery+FBHelpers.h +28 -0
- package/WebDriverAgentLib/Categories/XCUIElementQuery+FBHelpers.m +47 -0
- package/WebDriverAgentLib/Commands/AxeAuthCommands.h +30 -0
- package/WebDriverAgentLib/Commands/AxeAuthCommands.m +175 -0
- package/WebDriverAgentLib/Commands/AxeAutoScanCommands.h +19 -0
- package/WebDriverAgentLib/Commands/AxeAutoScanCommands.m +143 -0
- package/WebDriverAgentLib/Commands/AxeProductDeclaration.h +21 -0
- package/WebDriverAgentLib/Commands/AxeProductDeclaration.m +40 -0
- package/WebDriverAgentLib/Commands/AxeReportCommands.h +20 -0
- package/WebDriverAgentLib/Commands/AxeReportCommands.m +62 -0
- package/WebDriverAgentLib/Commands/AxeScanCommands.h +20 -0
- package/WebDriverAgentLib/Commands/AxeScanCommands.m +386 -0
- package/WebDriverAgentLib/Commands/AxeUsageCommands.h +27 -0
- package/WebDriverAgentLib/Commands/AxeUsageCommands.m +90 -0
- package/WebDriverAgentLib/Commands/FBAlertViewCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBAlertViewCommands.m +104 -0
- package/WebDriverAgentLib/Commands/FBCustomCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBCustomCommands.m +848 -0
- package/WebDriverAgentLib/Commands/FBDebugCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBDebugCommands.m +81 -0
- package/WebDriverAgentLib/Commands/FBElementCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBElementCommands.m +775 -0
- package/WebDriverAgentLib/Commands/FBFindElementCommands.h +18 -0
- package/WebDriverAgentLib/Commands/FBFindElementCommands.m +186 -0
- package/WebDriverAgentLib/Commands/FBOrientationCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBOrientationCommands.m +192 -0
- package/WebDriverAgentLib/Commands/FBScreenshotCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBScreenshotCommands.m +40 -0
- package/WebDriverAgentLib/Commands/FBSessionCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBSessionCommands.m +519 -0
- package/WebDriverAgentLib/Commands/FBTouchActionCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBTouchActionCommands.m +41 -0
- package/WebDriverAgentLib/Commands/FBTouchIDCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBTouchIDCommands.m +30 -0
- package/WebDriverAgentLib/Commands/FBUnknownCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBUnknownCommands.m +39 -0
- package/WebDriverAgentLib/Commands/FBVideoCommands.h +19 -0
- package/WebDriverAgentLib/Commands/FBVideoCommands.m +84 -0
- package/WebDriverAgentLib/FBAlert.h +104 -0
- package/WebDriverAgentLib/FBAlert.m +454 -0
- package/WebDriverAgentLib/Info.plist +26 -0
- package/WebDriverAgentLib/Routing/FBCommandHandler.h +38 -0
- package/WebDriverAgentLib/Routing/FBCommandStatus.h +80 -0
- package/WebDriverAgentLib/Routing/FBCommandStatus.m +279 -0
- package/WebDriverAgentLib/Routing/FBElement.h +98 -0
- package/WebDriverAgentLib/Routing/FBElementCache.h +61 -0
- package/WebDriverAgentLib/Routing/FBElementCache.m +100 -0
- package/WebDriverAgentLib/Routing/FBElementUtils.h +76 -0
- package/WebDriverAgentLib/Routing/FBElementUtils.m +153 -0
- package/WebDriverAgentLib/Routing/FBExceptionHandler.h +29 -0
- package/WebDriverAgentLib/Routing/FBExceptionHandler.m +65 -0
- package/WebDriverAgentLib/Routing/FBExceptions.h +69 -0
- package/WebDriverAgentLib/Routing/FBExceptions.m +27 -0
- package/WebDriverAgentLib/Routing/FBHTTPServer.h +97 -0
- package/WebDriverAgentLib/Routing/FBHTTPServer.m +955 -0
- package/WebDriverAgentLib/Routing/FBHTTPStatusCodes.h +581 -0
- package/WebDriverAgentLib/Routing/FBResponseJSONPayload.h +29 -0
- package/WebDriverAgentLib/Routing/FBResponseJSONPayload.m +58 -0
- package/WebDriverAgentLib/Routing/FBResponsePayload.h +74 -0
- package/WebDriverAgentLib/Routing/FBResponsePayload.m +148 -0
- package/WebDriverAgentLib/Routing/FBRoute.h +86 -0
- package/WebDriverAgentLib/Routing/FBRoute.m +183 -0
- package/WebDriverAgentLib/Routing/FBRouteRequest-Private.h +20 -0
- package/WebDriverAgentLib/Routing/FBRouteRequest.h +39 -0
- package/WebDriverAgentLib/Routing/FBRouteRequest.m +32 -0
- package/WebDriverAgentLib/Routing/FBScreenRecordingContainer.h +65 -0
- package/WebDriverAgentLib/Routing/FBScreenRecordingContainer.m +88 -0
- package/WebDriverAgentLib/Routing/FBScreenRecordingPromise.h +29 -0
- package/WebDriverAgentLib/Routing/FBScreenRecordingPromise.m +31 -0
- package/WebDriverAgentLib/Routing/FBScreenRecordingRequest.h +39 -0
- package/WebDriverAgentLib/Routing/FBScreenRecordingRequest.m +99 -0
- package/WebDriverAgentLib/Routing/FBSession-Private.h +26 -0
- package/WebDriverAgentLib/Routing/FBSession.h +179 -0
- package/WebDriverAgentLib/Routing/FBSession.m +575 -0
- package/WebDriverAgentLib/Routing/FBTCPSocket.h +117 -0
- package/WebDriverAgentLib/Routing/FBTCPSocket.m +244 -0
- package/WebDriverAgentLib/Routing/FBWebServer.h +68 -0
- package/WebDriverAgentLib/Routing/FBWebServer.m +306 -0
- package/WebDriverAgentLib/Routing/FBXCAccessibilityElement.h +34 -0
- package/WebDriverAgentLib/Routing/FBXCAccessibilityElement.m +17 -0
- package/WebDriverAgentLib/Routing/FBXCDeviceEvent.h +34 -0
- package/WebDriverAgentLib/Routing/FBXCDeviceEvent.m +42 -0
- package/WebDriverAgentLib/Routing/FBXCElementSnapshot.h +82 -0
- package/WebDriverAgentLib/Routing/FBXCElementSnapshot.m +9 -0
- package/WebDriverAgentLib/Routing/FBXCElementSnapshotWrapper.h +29 -0
- package/WebDriverAgentLib/Routing/FBXCElementSnapshotWrapper.m +114 -0
- package/WebDriverAgentLib/Routing/RouteRequest.h +28 -0
- package/WebDriverAgentLib/Routing/RouteRequest.m +25 -0
- package/WebDriverAgentLib/Routing/RouteResponse.h +30 -0
- package/WebDriverAgentLib/Routing/RouteResponse.m +54 -0
- package/WebDriverAgentLib/Utilities/FBAccessibilityTraits.h +20 -0
- package/WebDriverAgentLib/Utilities/FBAccessibilityTraits.m +61 -0
- package/WebDriverAgentLib/Utilities/FBActiveAppDetectionPoint.h +56 -0
- package/WebDriverAgentLib/Utilities/FBActiveAppDetectionPoint.m +115 -0
- package/WebDriverAgentLib/Utilities/FBAlertsMonitor.h +51 -0
- package/WebDriverAgentLib/Utilities/FBAlertsMonitor.m +110 -0
- package/WebDriverAgentLib/Utilities/FBBaseActionsSynthesizer.h +132 -0
- package/WebDriverAgentLib/Utilities/FBBaseActionsSynthesizer.m +165 -0
- package/WebDriverAgentLib/Utilities/FBCapabilities.h +43 -0
- package/WebDriverAgentLib/Utilities/FBCapabilities.m +24 -0
- package/WebDriverAgentLib/Utilities/FBClassChainQueryParser.h +99 -0
- package/WebDriverAgentLib/Utilities/FBClassChainQueryParser.m +666 -0
- package/WebDriverAgentLib/Utilities/FBConfiguration.h +379 -0
- package/WebDriverAgentLib/Utilities/FBConfiguration.m +476 -0
- package/WebDriverAgentLib/Utilities/FBDebugLogDelegateDecorator.h +26 -0
- package/WebDriverAgentLib/Utilities/FBDebugLogDelegateDecorator.m +49 -0
- package/WebDriverAgentLib/Utilities/FBElementHelpers.h +29 -0
- package/WebDriverAgentLib/Utilities/FBElementHelpers.m +21 -0
- package/WebDriverAgentLib/Utilities/FBElementTypeTransformer.h +45 -0
- package/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m +149 -0
- package/WebDriverAgentLib/Utilities/FBErrorBuilder.h +64 -0
- package/WebDriverAgentLib/Utilities/FBErrorBuilder.m +75 -0
- package/WebDriverAgentLib/Utilities/FBFailureProofTestCase.h +19 -0
- package/WebDriverAgentLib/Utilities/FBFailureProofTestCase.m +74 -0
- package/WebDriverAgentLib/Utilities/FBImageProcessor.h +55 -0
- package/WebDriverAgentLib/Utilities/FBImageProcessor.m +197 -0
- package/WebDriverAgentLib/Utilities/FBImageUtils.h +25 -0
- package/WebDriverAgentLib/Utilities/FBImageUtils.m +80 -0
- package/WebDriverAgentLib/Utilities/FBKeyboard.h +37 -0
- package/WebDriverAgentLib/Utilities/FBKeyboard.m +123 -0
- package/WebDriverAgentLib/Utilities/FBLogger.h +32 -0
- package/WebDriverAgentLib/Utilities/FBLogger.m +47 -0
- package/WebDriverAgentLib/Utilities/FBMacros.h +66 -0
- package/WebDriverAgentLib/Utilities/FBMathUtils.h +100 -0
- package/WebDriverAgentLib/Utilities/FBMathUtils.m +147 -0
- package/WebDriverAgentLib/Utilities/FBMjpegServer.h +36 -0
- package/WebDriverAgentLib/Utilities/FBMjpegServer.m +248 -0
- package/WebDriverAgentLib/Utilities/FBNotificationsHelper.h +37 -0
- package/WebDriverAgentLib/Utilities/FBNotificationsHelper.m +29 -0
- package/WebDriverAgentLib/Utilities/FBPasteboard.h +40 -0
- package/WebDriverAgentLib/Utilities/FBPasteboard.m +176 -0
- package/WebDriverAgentLib/Utilities/FBProtocolHelpers.h +46 -0
- package/WebDriverAgentLib/Utilities/FBProtocolHelpers.m +144 -0
- package/WebDriverAgentLib/Utilities/FBReflectionUtils.h +23 -0
- package/WebDriverAgentLib/Utilities/FBReflectionUtils.m +31 -0
- package/WebDriverAgentLib/Utilities/FBRunLoopSpinner.h +77 -0
- package/WebDriverAgentLib/Utilities/FBRunLoopSpinner.m +94 -0
- package/WebDriverAgentLib/Utilities/FBRuntimeUtils.h +79 -0
- package/WebDriverAgentLib/Utilities/FBRuntimeUtils.m +112 -0
- package/WebDriverAgentLib/Utilities/FBScreen.h +49 -0
- package/WebDriverAgentLib/Utilities/FBScreen.m +128 -0
- package/WebDriverAgentLib/Utilities/FBScreenshot.h +44 -0
- package/WebDriverAgentLib/Utilities/FBScreenshot.m +231 -0
- package/WebDriverAgentLib/Utilities/FBSettings.h +51 -0
- package/WebDriverAgentLib/Utilities/FBSettings.m +45 -0
- package/WebDriverAgentLib/Utilities/FBSettingsHandler.h +35 -0
- package/WebDriverAgentLib/Utilities/FBSettingsHandler.m +398 -0
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker-Private.h +37 -0
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker.h +77 -0
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker.m +177 -0
- package/WebDriverAgentLib/Utilities/FBUnattachedAppLauncher.h +26 -0
- package/WebDriverAgentLib/Utilities/FBUnattachedAppLauncher.m +21 -0
- package/WebDriverAgentLib/Utilities/FBW3CActionsHelpers.h +42 -0
- package/WebDriverAgentLib/Utilities/FBW3CActionsHelpers.m +119 -0
- package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.h +19 -0
- package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.m +1011 -0
- package/WebDriverAgentLib/Utilities/FBWebServerParams.h +22 -0
- package/WebDriverAgentLib/Utilities/FBWebServerParams.m +23 -0
- package/WebDriverAgentLib/Utilities/FBXCAXClientProxy.h +171 -0
- package/WebDriverAgentLib/Utilities/FBXCAXClientProxy.m +240 -0
- package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.h +45 -0
- package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.m +362 -0
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.h +73 -0
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +129 -0
- package/WebDriverAgentLib/Utilities/FBXMLGenerationOptions.h +45 -0
- package/WebDriverAgentLib/Utilities/FBXMLGenerationOptions.m +25 -0
- package/WebDriverAgentLib/Utilities/FBXPath-Private.h +61 -0
- package/WebDriverAgentLib/Utilities/FBXPath.h +59 -0
- package/WebDriverAgentLib/Utilities/FBXPath.m +1087 -0
- package/WebDriverAgentLib/Utilities/FBXPathExtensions.h +40 -0
- package/WebDriverAgentLib/Utilities/FBXPathExtensions.m +418 -0
- package/WebDriverAgentLib/Utilities/LRUCache/LRUCache.h +66 -0
- package/WebDriverAgentLib/Utilities/LRUCache/LRUCache.m +149 -0
- package/WebDriverAgentLib/Utilities/LRUCache/LRUCacheNode.h +43 -0
- package/WebDriverAgentLib/Utilities/LRUCache/LRUCacheNode.m +51 -0
- package/WebDriverAgentLib/Utilities/NSPredicate+FBFormat.h +42 -0
- package/WebDriverAgentLib/Utilities/NSPredicate+FBFormat.m +69 -0
- package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.h +78 -0
- package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m +127 -0
- package/WebDriverAgentLib/Utilities/XCUIApplicationProcessDelay.h +37 -0
- package/WebDriverAgentLib/Utilities/XCUIApplicationProcessDelay.m +83 -0
- package/WebDriverAgentLib/WebDriverAgentLib.h +61 -0
- package/WebDriverAgentRunner/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/WebDriverAgentRunner/Assets.xcassets/AppIcon.appiconset/icon-1024.png +0 -0
- package/WebDriverAgentRunner/Assets.xcassets/Contents.json +6 -0
- package/WebDriverAgentRunner/Info.plist +30 -0
- package/WebDriverAgentRunner/UITestingUITests.m +58 -0
- package/WebDriverAgentTests/IntegrationApp/COORDINATE_PROBE.md +52 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.h +14 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/AppDelegate.m +38 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBAlertViewController.h +14 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBAlertViewController.m +82 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBCoordinateProbeViewController.h +4 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBCoordinateProbeViewController.m +194 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBNavigationController.h +12 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBNavigationController.m +25 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBScrollViewController.h +13 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBScrollViewController.m +52 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBTableDataSource.h +16 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/FBTableDataSource.m +35 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.h +20 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/SceneDelegate.m +81 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/TouchSpotView.h +17 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/TouchSpotView.m +28 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/TouchViewController.h +23 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/TouchViewController.m +29 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/TouchableView.h +30 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/TouchableView.m +119 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/ViewController.h +12 -0
- package/WebDriverAgentTests/IntegrationApp/Classes/ViewController.m +144 -0
- package/WebDriverAgentTests/IntegrationApp/Info.plist +71 -0
- package/WebDriverAgentTests/IntegrationApp/Resources/Base.lproj/Main.storyboard +650 -0
- package/WebDriverAgentTests/IntegrationApp/main.m +15 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/AppDelegate.h +13 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/AppDelegate.m +26 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/Info.plist +41 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/SceneDelegate.h +15 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/SceneDelegate.m +22 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/ViewController.h +13 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/ViewController.m +79 -0
- package/WebDriverAgentTests/IntegrationApp_tvOS/main.m +17 -0
- package/WebDriverAgentTests/IntegrationApp_watchOS/ContentView.swift +31 -0
- package/WebDriverAgentTests/IntegrationApp_watchOS/WatchSpikeApp.swift +18 -0
- package/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +175 -0
- package/WebDriverAgentTests/IntegrationTests/FBAutoAlertsHandlerTests.m +79 -0
- package/WebDriverAgentTests/IntegrationTests/FBConfigurationTests.m +123 -0
- package/WebDriverAgentTests/IntegrationTests/FBDisplayGestureTests.m +541 -0
- package/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m +273 -0
- package/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m +222 -0
- package/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m +68 -0
- package/WebDriverAgentTests/IntegrationTests/FBFailureProofTestCaseTests.m +41 -0
- package/WebDriverAgentTests/IntegrationTests/FBForceTouchTests.m +88 -0
- package/WebDriverAgentTests/IntegrationTests/FBImageProcessorTests.m +116 -0
- package/WebDriverAgentTests/IntegrationTests/FBIntegrationAppTests.m +87 -0
- package/WebDriverAgentTests/IntegrationTests/FBIntegrationTestCase.h +101 -0
- package/WebDriverAgentTests/IntegrationTests/FBIntegrationTestCase.m +176 -0
- package/WebDriverAgentTests/IntegrationTests/FBKeyboardTests.m +61 -0
- package/WebDriverAgentTests/IntegrationTests/FBPasteboardTests.m +92 -0
- package/WebDriverAgentTests/IntegrationTests/FBPickerWheelSelectTests.m +55 -0
- package/WebDriverAgentTests/IntegrationTests/FBSafariAlertTests.m +77 -0
- package/WebDriverAgentTests/IntegrationTests/FBScreenTests.m +450 -0
- package/WebDriverAgentTests/IntegrationTests/FBScrollingTests.m +123 -0
- package/WebDriverAgentTests/IntegrationTests/FBSessionIntegrationTests.m +228 -0
- package/WebDriverAgentTests/IntegrationTests/FBTapTest.m +186 -0
- package/WebDriverAgentTests/IntegrationTests/FBTestMacros.h +33 -0
- package/WebDriverAgentTests/IntegrationTests/FBTypingTest.m +68 -0
- package/WebDriverAgentTests/IntegrationTests/FBVideoRecordingTests.m +63 -0
- package/WebDriverAgentTests/IntegrationTests/FBVoiceOverTests.m +103 -0
- package/WebDriverAgentTests/IntegrationTests/FBW3CMultiTouchActionsIntegrationTests.m +159 -0
- package/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m +700 -0
- package/WebDriverAgentTests/IntegrationTests/FBW3CTypeActionsTests.m +184 -0
- package/WebDriverAgentTests/IntegrationTests/FBXPathIntegrationTests.m +260 -0
- package/WebDriverAgentTests/IntegrationTests/Info.plist +24 -0
- package/WebDriverAgentTests/IntegrationTests/XCElementSnapshotHelperTests.m +205 -0
- package/WebDriverAgentTests/IntegrationTests/XCElementSnapshotHitPointTests.m +30 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIApplicationHelperTests.m +162 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceHealthCheckTests.m +27 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m +236 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceRotationTests.m +105 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIElementAttributesTests.m +248 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m +673 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIElementHelperIntegrationTests.m +51 -0
- package/WebDriverAgentTests/IntegrationTests_tvOS/FBTVFocusIntegrationTests.m +84 -0
- package/WebDriverAgentTests/IntegrationTests_tvOS/Info.plist +24 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/IntegrationTests_watchOS-Bridging-Header.h +23 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAAlertIntegrationTests.swift +25 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAAppLifecycleIntegrationTests.swift +37 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAClickIntegrationTests.swift +25 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDADeviceIntegrationTests.swift +92 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAElementAttributeIntegrationTests.swift +39 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAFindIntegrationTests.swift +101 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAMjpegStreamingIntegrationTests.swift +81 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAScreenshotAndSourceIntegrationTests.swift +54 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDATypingIntegrationTests.swift +73 -0
- package/WebDriverAgentTests/IntegrationTests_watchOS/WDAWatchInProcessTestCase.swift +51 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.h +16 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.m +110 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCUIApplicationDouble.h +17 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCUIApplicationDouble.m +66 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCUIElementDouble.h +55 -0
- package/WebDriverAgentTests/UnitTests/Doubles/XCUIElementDouble.m +114 -0
- package/WebDriverAgentTests/UnitTests/FBClassChainTests.m +313 -0
- package/WebDriverAgentTests/UnitTests/FBConfigurationTests.m +72 -0
- package/WebDriverAgentTests/UnitTests/FBCustomCommandsTests.m +144 -0
- package/WebDriverAgentTests/UnitTests/FBElementCacheTests.m +124 -0
- package/WebDriverAgentTests/UnitTests/FBElementTypeTransformerTests.m +45 -0
- package/WebDriverAgentTests/UnitTests/FBElementUtilitiesTests.m +76 -0
- package/WebDriverAgentTests/UnitTests/FBErrorBuilderTests.m +61 -0
- package/WebDriverAgentTests/UnitTests/FBExceptionHandlerTests.m +59 -0
- package/WebDriverAgentTests/UnitTests/FBHTTPServerSessionTests.m +151 -0
- package/WebDriverAgentTests/UnitTests/FBHTTPServerTests.m +458 -0
- package/WebDriverAgentTests/UnitTests/FBLRUCacheTests.m +161 -0
- package/WebDriverAgentTests/UnitTests/FBMathUtilsTests.m +196 -0
- package/WebDriverAgentTests/UnitTests/FBProtocolHelpersTests.m +81 -0
- package/WebDriverAgentTests/UnitTests/FBResponseJSONPayloadTests.m +76 -0
- package/WebDriverAgentTests/UnitTests/FBRouteTests.m +129 -0
- package/WebDriverAgentTests/UnitTests/FBRunLoopSpinnerTests.m +98 -0
- package/WebDriverAgentTests/UnitTests/FBRuntimeUtilsTests.m +45 -0
- package/WebDriverAgentTests/UnitTests/FBSDKVersionTests.m +66 -0
- package/WebDriverAgentTests/UnitTests/FBSessionTests.m +268 -0
- package/WebDriverAgentTests/UnitTests/FBTouchableViewTests.m +121 -0
- package/WebDriverAgentTests/UnitTests/FBXCAXClientProxyTests.m +90 -0
- package/WebDriverAgentTests/UnitTests/FBXMLSafeStringTests.m +35 -0
- package/WebDriverAgentTests/UnitTests/FBXPathTests.m +381 -0
- package/WebDriverAgentTests/UnitTests/Info.plist +24 -0
- package/WebDriverAgentTests/UnitTests/NSDictionaryFBUtf8SafeTests.m +77 -0
- package/WebDriverAgentTests/UnitTests/NSExpressionFBFormatTests.m +60 -0
- package/WebDriverAgentTests/UnitTests/NSPredicateFBFormatTests.m +72 -0
- package/WebDriverAgentTests/UnitTests/XCUIElementHelpersTests.m +50 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/FBXCAccessibilityElementDouble.h +27 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/FBXCAccessibilityElementDouble.m +23 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/FBXCElementSnapshotDouble.h +43 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/FBXCElementSnapshotDouble.m +24 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/XCUIElementDouble.h +47 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Doubles/XCUIElementDouble.m +81 -0
- package/WebDriverAgentTests/UnitTests_tvOS/FBTVNavigationTrackerTests.m +134 -0
- package/WebDriverAgentTests/UnitTests_tvOS/Info.plist +24 -0
- package/axeDevToolsXCUI.xcframework/Info.plist +50 -0
- package/axeDevToolsXCUI.xcframework/LICENSE-3RD-PARTY-axe-devtools-ios.md +29 -0
- package/axeDevToolsXCUI.xcframework/axe-devtools-ios-4.3.1.cdx.json +75 -0
- package/axeDevToolsXCUI.xcframework/axe-devtools-ios-4.3.1.spdx.json +67 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/HTMLReportTemplate.html +1912 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Headers/AxeTestBundleObserver.h +55 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Headers/axeDevToolsXCUI-Swift.h +1546 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Headers/axeDevToolsXCUI.h +17 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Info.plist +57 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/LICENSE.md +7 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios.abi.json +34308 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios.private.swiftinterface +927 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios.swiftinterface +927 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/Modules/module.modulemap +10 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64/axeDevToolsXCUI.framework/axeDevToolsXCUI +0 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/HTMLReportTemplate.html +1912 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Headers/AxeTestBundleObserver.h +55 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Headers/axeDevToolsXCUI-Swift.h +3088 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Headers/axeDevToolsXCUI.h +17 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Info.plist +53 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/LICENSE.md +7 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios-simulator.abi.json +34308 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +927 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +927 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +34308 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +927 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/axeDevToolsXCUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +927 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/Modules/module.modulemap +10 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/_CodeSignature/CodeResources +278 -0
- package/axeDevToolsXCUI.xcframework/ios-arm64_x86_64-simulator/axeDevToolsXCUI.framework/axeDevToolsXCUI +0 -0
- package/build/lib/check-dependencies.d.ts +6 -0
- package/build/lib/check-dependencies.d.ts.map +1 -0
- package/build/lib/check-dependencies.js +50 -0
- package/build/lib/check-dependencies.js.map +1 -0
- package/build/lib/constants.d.ts +25 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +28 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/index.d.ts +7 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +7 -0
- package/build/lib/index.js.map +1 -0
- package/build/lib/logger.d.ts +2 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +3 -0
- package/build/lib/logger.js.map +1 -0
- package/build/lib/no-session-proxy.d.ts +7 -0
- package/build/lib/no-session-proxy.d.ts.map +1 -0
- package/build/lib/no-session-proxy.js +17 -0
- package/build/lib/no-session-proxy.js.map +1 -0
- package/build/lib/types.d.ts +206 -0
- package/build/lib/types.d.ts.map +1 -0
- package/build/lib/types.js +2 -0
- package/build/lib/types.js.map +1 -0
- package/build/lib/utils/index.d.ts +11 -0
- package/build/lib/utils/index.d.ts.map +1 -0
- package/build/lib/utils/index.js +13 -0
- package/build/lib/utils/index.js.map +1 -0
- package/build/lib/utils/module.d.ts +25 -0
- package/build/lib/utils/module.d.ts.map +1 -0
- package/build/lib/utils/module.js +47 -0
- package/build/lib/utils/module.js.map +1 -0
- package/build/lib/utils/platform.d.ts +19 -0
- package/build/lib/utils/platform.d.ts.map +1 -0
- package/build/lib/utils/platform.js +32 -0
- package/build/lib/utils/platform.js.map +1 -0
- package/build/lib/utils/processes.d.ts +34 -0
- package/build/lib/utils/processes.d.ts.map +1 -0
- package/build/lib/utils/processes.js +151 -0
- package/build/lib/utils/processes.js.map +1 -0
- package/build/lib/utils/security.d.ts +5 -0
- package/build/lib/utils/security.d.ts.map +1 -0
- package/build/lib/utils/security.js +12 -0
- package/build/lib/utils/security.js.map +1 -0
- package/build/lib/utils/xctestrun.d.ts +51 -0
- package/build/lib/utils/xctestrun.d.ts.map +1 -0
- package/build/lib/utils/xctestrun.js +135 -0
- package/build/lib/utils/xctestrun.js.map +1 -0
- package/build/lib/wda-strategies.d.ts +69 -0
- package/build/lib/wda-strategies.d.ts.map +1 -0
- package/build/lib/wda-strategies.js +247 -0
- package/build/lib/wda-strategies.js.map +1 -0
- package/build/lib/webdriveragent.d.ts +175 -0
- package/build/lib/webdriveragent.d.ts.map +1 -0
- package/build/lib/webdriveragent.js +540 -0
- package/build/lib/webdriveragent.js.map +1 -0
- package/build/lib/xcodebuild.d.ts +98 -0
- package/build/lib/xcodebuild.d.ts.map +1 -0
- package/build/lib/xcodebuild.js +562 -0
- package/build/lib/xcodebuild.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/lib/check-dependencies.ts +64 -0
- package/lib/constants.ts +33 -0
- package/lib/index.ts +7 -0
- package/lib/logger.ts +3 -0
- package/lib/no-session-proxy.ts +19 -0
- package/lib/types.ts +238 -0
- package/lib/utils/index.ts +20 -0
- package/lib/utils/module.ts +66 -0
- package/lib/utils/platform.ts +34 -0
- package/lib/utils/processes.ts +174 -0
- package/lib/utils/security.ts +16 -0
- package/lib/utils/xctestrun.ts +188 -0
- package/lib/wda-strategies.ts +343 -0
- package/lib/webdriveragent.ts +642 -0
- package/lib/xcodebuild.ts +678 -0
- package/package.json +114 -3
|
@@ -0,0 +1,575 @@
|
|
|
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.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#import "FBSession.h"
|
|
10
|
+
#import "FBSession-Private.h"
|
|
11
|
+
|
|
12
|
+
#import <objc/runtime.h>
|
|
13
|
+
|
|
14
|
+
#import "FBXCAccessibilityElement.h"
|
|
15
|
+
#import "FBAlertsMonitor.h"
|
|
16
|
+
#import "FBConfiguration.h"
|
|
17
|
+
#import "FBElementCache.h"
|
|
18
|
+
#import "FBExceptions.h"
|
|
19
|
+
#import "FBMacros.h"
|
|
20
|
+
#import "FBScreenRecordingContainer.h"
|
|
21
|
+
#import "FBScreenRecordingPromise.h"
|
|
22
|
+
#import "FBScreenRecordingRequest.h"
|
|
23
|
+
#import "FBXCodeCompatibility.h"
|
|
24
|
+
#import "FBXCTestDaemonsProxy.h"
|
|
25
|
+
#import "XCUIApplication+FBQuiescence.h"
|
|
26
|
+
#import "XCUIElement.h"
|
|
27
|
+
#import "XCUIElement+FBClassChain.h"
|
|
28
|
+
#import "XCUIElement+FBUtilities.h"
|
|
29
|
+
#import "FBLogger.h"
|
|
30
|
+
|
|
31
|
+
/*!
|
|
32
|
+
The intial value for the default application property.
|
|
33
|
+
Setting this value to `defaultActiveApplication` property forces WDA to use the internal
|
|
34
|
+
automated algorithm to determine the active on-screen application
|
|
35
|
+
*/
|
|
36
|
+
NSString *const FBDefaultApplicationAuto = @"auto";
|
|
37
|
+
|
|
38
|
+
NSString *const FB_SAFARI_BUNDLE_ID = @"com.apple.mobilesafari";
|
|
39
|
+
|
|
40
|
+
// FBXCAXClientProxy's shared accessibility channel can be stuck servicing another request.
|
|
41
|
+
static const NSTimeInterval FB_IS_SYSTEM_APP_CHECK_TIMEOUT_SEC = 5.;
|
|
42
|
+
// -terminate hard-asserts off the main thread, which may itself be busy - see -fb_terminate...:.
|
|
43
|
+
static const NSTimeInterval FB_APP_TERMINATE_TIMEOUT_SEC = 5.;
|
|
44
|
+
// How long a -kill caller that lost the race below waits for the winner's teardown to finish.
|
|
45
|
+
static const NSTimeInterval FB_KILL_WAIT_TIMEOUT_SEC = 35.;
|
|
46
|
+
NSString *const FBSessionWasKilledNotification = @"FBSessionWasKilledNotification";
|
|
47
|
+
|
|
48
|
+
@interface FBSession ()
|
|
49
|
+
// Atomic, since /wda/apps/launch may replace it while a concurrent DELETE /session reads it in -kill
|
|
50
|
+
@property (nullable, atomic) XCUIApplication *testedApplication;
|
|
51
|
+
@property (nonatomic) BOOL isTestedApplicationExpectedToRun;
|
|
52
|
+
@property (nonatomic) BOOL shouldAppsWaitForQuiescence;
|
|
53
|
+
@property (nonatomic, nullable) FBAlertsMonitor *alertsMonitor;
|
|
54
|
+
@property (nonatomic, readwrite) NSMutableDictionary<NSNumber *, NSMutableDictionary<NSString *, NSNumber *> *> *elementsVisibilityCache;
|
|
55
|
+
|
|
56
|
+
- (BOOL)fb_isApplicationSameAsSystemApp:(XCUIApplication *)application timeout:(NSTimeInterval)timeout;
|
|
57
|
+
- (void)fb_terminateTestedApplicationWithTimeout:(NSTimeInterval)timeout generation:(NSUInteger)generation;
|
|
58
|
+
@end
|
|
59
|
+
|
|
60
|
+
@interface FBSession (FBAlertsMonitorDelegate)
|
|
61
|
+
|
|
62
|
+
- (void)didDetectAlert:(FBAlert *)alert;
|
|
63
|
+
|
|
64
|
+
@end
|
|
65
|
+
|
|
66
|
+
@implementation FBSession (FBAlertsMonitorDelegate)
|
|
67
|
+
|
|
68
|
+
- (void)didDetectAlert:(FBAlert *)alert
|
|
69
|
+
{
|
|
70
|
+
NSString *autoClickAlertSelector = FBConfiguration.sharedInstance.autoClickAlertSelector;
|
|
71
|
+
if ([autoClickAlertSelector length] > 0) {
|
|
72
|
+
@try {
|
|
73
|
+
[alert clickElementMatchingClassChain:autoClickAlertSelector];
|
|
74
|
+
} @catch (NSException *e) {
|
|
75
|
+
[FBLogger logFmt:@"Could not click at the alert element '%@'. Original error: %@",
|
|
76
|
+
autoClickAlertSelector, e.reason];
|
|
77
|
+
}
|
|
78
|
+
// This setting has priority over other settings if enabled
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (nil == self.defaultAlertAction || 0 == self.defaultAlertAction.length) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if ([self.defaultAlertAction isEqualToString:@"accept"]) {
|
|
87
|
+
@try {
|
|
88
|
+
[alert accept];
|
|
89
|
+
} @catch (NSException *e) {
|
|
90
|
+
[FBLogger logFmt:@"Cannot accept the alert. Original error: %@", e.reason];
|
|
91
|
+
}
|
|
92
|
+
} else if ([self.defaultAlertAction isEqualToString:@"dismiss"]) {
|
|
93
|
+
@try {
|
|
94
|
+
[alert dismiss];
|
|
95
|
+
} @catch (NSException *e) {
|
|
96
|
+
[FBLogger logFmt:@"Cannot dismiss the alert. Original error: %@", e.reason];
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
[FBLogger logFmt:@"'%@' default alert action is unsupported", self.defaultAlertAction];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@end
|
|
104
|
+
|
|
105
|
+
@implementation FBSession
|
|
106
|
+
|
|
107
|
+
// Guarded, together with the two counters below, by +teardownCondition.
|
|
108
|
+
static FBSession *_activeSession = nil;
|
|
109
|
+
// Class-level, not per-instance: a caller that finds _activeSession already nil (a concurrent
|
|
110
|
+
// -kill beat it there) still needs to know whether that -kill's teardown is done, since it cleared
|
|
111
|
+
// the pointer before running it. See +waitForActiveTeardownWithTimeout:.
|
|
112
|
+
// A count, not a flag: the bounded wait below lets teardowns overlap, so one of them finishing
|
|
113
|
+
// must not wake waiters while another still runs.
|
|
114
|
+
static NSUInteger _activeTeardownCount = 0;
|
|
115
|
+
// Bumped once a caller owns the device, before it launches anything; a teardown still running past
|
|
116
|
+
// the bounded wait re-checks it before touching process-wide state.
|
|
117
|
+
static NSUInteger _sessionGeneration = 0;
|
|
118
|
+
// Teardowns that have claimed the current generation and are committed to terminating the app.
|
|
119
|
+
// The generation bump waits for these to drain, so a claim and a bump can never interleave.
|
|
120
|
+
static NSUInteger _committedTerminationCount = 0;
|
|
121
|
+
|
|
122
|
+
+ (NSCondition *)teardownCondition
|
|
123
|
+
{
|
|
124
|
+
static NSCondition *condition;
|
|
125
|
+
static dispatch_once_t onceToken;
|
|
126
|
+
dispatch_once(&onceToken, ^{
|
|
127
|
+
condition = [NSCondition new];
|
|
128
|
+
});
|
|
129
|
+
return condition;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Waits (bounded) for every -kill teardown currently in progress to finish.
|
|
133
|
+
+ (void)waitForActiveTeardownWithTimeout:(NSTimeInterval)timeout
|
|
134
|
+
{
|
|
135
|
+
NSCondition *condition = self.teardownCondition;
|
|
136
|
+
[condition lock];
|
|
137
|
+
NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
|
138
|
+
while (_activeTeardownCount > 0 && [condition waitUntilDate:deadline]) {
|
|
139
|
+
}
|
|
140
|
+
[condition unlock];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
+ (instancetype)activeSession
|
|
144
|
+
{
|
|
145
|
+
NSCondition *condition = self.teardownCondition;
|
|
146
|
+
[condition lock];
|
|
147
|
+
FBSession *session = _activeSession;
|
|
148
|
+
[condition unlock];
|
|
149
|
+
return session;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
+ (void)killActiveSessionAndWaitForTeardown
|
|
153
|
+
{
|
|
154
|
+
FBSession *session = self.activeSession;
|
|
155
|
+
if (nil != session) {
|
|
156
|
+
// Runs the real teardown synchronously if this call wins the race in -kill, or waits for
|
|
157
|
+
// whoever did to finish if it lost - either way, blocks until torn down.
|
|
158
|
+
[session kill];
|
|
159
|
+
} else {
|
|
160
|
+
// _activeSession is already nil, but a concurrent -kill (e.g. from DELETE /session) may still
|
|
161
|
+
// be mid-teardown - wait for it, so we don't launch a replacement app too early.
|
|
162
|
+
[self waitForActiveTeardownWithTimeout:FB_KILL_WAIT_TIMEOUT_SEC];
|
|
163
|
+
}
|
|
164
|
+
// Claimed before the caller launches its replacement app: if the bounded wait expired with a
|
|
165
|
+
// teardown still running, that teardown must be stale by the time the new app exists.
|
|
166
|
+
NSCondition *condition = self.teardownCondition;
|
|
167
|
+
[condition lock];
|
|
168
|
+
// A committed -terminate cannot be revoked, so the next generation must never be handed out
|
|
169
|
+
// while one is in flight - give up on the new session instead of racing it.
|
|
170
|
+
NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:FB_APP_TERMINATE_TIMEOUT_SEC];
|
|
171
|
+
while (_committedTerminationCount > 0 && [condition waitUntilDate:deadline]) {
|
|
172
|
+
}
|
|
173
|
+
BOOL isTerminationPending = _committedTerminationCount > 0;
|
|
174
|
+
if (!isTerminationPending) {
|
|
175
|
+
_sessionGeneration++;
|
|
176
|
+
}
|
|
177
|
+
[condition unlock];
|
|
178
|
+
if (isTerminationPending) {
|
|
179
|
+
NSString *reason = [NSString stringWithFormat:@"The termination of a previous session's application is still in progress after %@ seconds. Please retry the session creation later", @(FB_APP_TERMINATE_TIMEOUT_SEC)];
|
|
180
|
+
@throw [NSException exceptionWithName:FBSessionCreationException reason:reason userInfo:nil];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
+ (void)markSessionActive:(FBSession *)session
|
|
185
|
+
{
|
|
186
|
+
[self killActiveSessionAndWaitForTeardown];
|
|
187
|
+
NSCondition *condition = self.teardownCondition;
|
|
188
|
+
[condition lock];
|
|
189
|
+
_activeSession = session;
|
|
190
|
+
[condition unlock];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Validates and claims `generation` in one critical section, so no replacement can be handed the
|
|
194
|
+
// next generation until the matching +endTermination. NO means this teardown is already stale.
|
|
195
|
+
+ (BOOL)beginTerminationForGeneration:(NSUInteger)generation
|
|
196
|
+
{
|
|
197
|
+
NSCondition *condition = self.teardownCondition;
|
|
198
|
+
[condition lock];
|
|
199
|
+
BOOL isCurrent = generation == _sessionGeneration;
|
|
200
|
+
if (isCurrent) {
|
|
201
|
+
_committedTerminationCount++;
|
|
202
|
+
}
|
|
203
|
+
[condition unlock];
|
|
204
|
+
return isCurrent;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
+ (void)endTermination
|
|
208
|
+
{
|
|
209
|
+
NSCondition *condition = self.teardownCondition;
|
|
210
|
+
[condition lock];
|
|
211
|
+
_committedTerminationCount--;
|
|
212
|
+
[condition broadcast];
|
|
213
|
+
[condition unlock];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Read in the same critical section that validates the generation: a replacement would have bumped
|
|
217
|
+
// the generation before storing anything, so a promise captured here can never be its.
|
|
218
|
+
+ (FBScreenRecordingPromise *)activeScreenRecordingForGeneration:(NSUInteger)generation
|
|
219
|
+
{
|
|
220
|
+
NSCondition *condition = self.teardownCondition;
|
|
221
|
+
[condition lock];
|
|
222
|
+
FBScreenRecordingPromise *promise = generation == _sessionGeneration
|
|
223
|
+
? FBScreenRecordingContainer.sharedInstance.screenRecordingPromise
|
|
224
|
+
: nil;
|
|
225
|
+
[condition unlock];
|
|
226
|
+
return promise;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
+ (instancetype)sessionWithIdentifier:(NSString *)identifier
|
|
230
|
+
{
|
|
231
|
+
if (!identifier) {
|
|
232
|
+
return nil;
|
|
233
|
+
}
|
|
234
|
+
// A single snapshot: reading the global twice could validate one session and return another.
|
|
235
|
+
FBSession *session = self.activeSession;
|
|
236
|
+
return [identifier isEqualToString:session.identifier] ? session : nil;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
+ (instancetype)initWithApplication:(XCUIApplication *)application
|
|
240
|
+
{
|
|
241
|
+
FBSession *session = [FBSession new];
|
|
242
|
+
session.useNativeCachingStrategy = YES;
|
|
243
|
+
session.alertsMonitor = nil;
|
|
244
|
+
session.defaultAlertAction = nil;
|
|
245
|
+
session.elementsVisibilityCache = [NSMutableDictionary dictionary];
|
|
246
|
+
session.identifier = [[NSUUID UUID] UUIDString];
|
|
247
|
+
session.defaultActiveApplication = FBDefaultApplicationAuto;
|
|
248
|
+
session.testedApplication = nil;
|
|
249
|
+
session.isTestedApplicationExpectedToRun = nil != application && application.running;
|
|
250
|
+
|
|
251
|
+
if (application) {
|
|
252
|
+
session.testedApplication = application;
|
|
253
|
+
session.shouldAppsWaitForQuiescence = application.fb_shouldWaitForQuiescence;
|
|
254
|
+
}
|
|
255
|
+
session.elementCache = [FBElementCache new];
|
|
256
|
+
|
|
257
|
+
[FBSession markSessionActive:session];
|
|
258
|
+
return session;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
+ (instancetype)initWithApplication:(nullable XCUIApplication *)application
|
|
262
|
+
defaultAlertAction:(NSString *)defaultAlertAction
|
|
263
|
+
{
|
|
264
|
+
FBSession *session = [self.class initWithApplication:application];
|
|
265
|
+
session.defaultAlertAction = [defaultAlertAction lowercaseString];
|
|
266
|
+
[session enableAlertsMonitor];
|
|
267
|
+
return session;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
- (BOOL)enableAlertsMonitor
|
|
271
|
+
{
|
|
272
|
+
if (nil != self.alertsMonitor) {
|
|
273
|
+
return NO;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
self.alertsMonitor = [[FBAlertsMonitor alloc] init];
|
|
277
|
+
self.alertsMonitor.delegate = (id<FBAlertsMonitorDelegate>)self;
|
|
278
|
+
[self.alertsMonitor enable];
|
|
279
|
+
return YES;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
- (BOOL)disableAlertsMonitor
|
|
283
|
+
{
|
|
284
|
+
if (nil == self.alertsMonitor) {
|
|
285
|
+
return NO;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
[self.alertsMonitor disable];
|
|
289
|
+
self.alertsMonitor = nil;
|
|
290
|
+
return YES;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
- (void)kill
|
|
294
|
+
{
|
|
295
|
+
// DELETE /session and session creation can now run concurrently, so a session already
|
|
296
|
+
// superseded by a newer one can still reach here via a stale reference. Check-and-clear must be
|
|
297
|
+
// atomic, else a belated -kill could null out the new session's pointer instead of its own.
|
|
298
|
+
NSCondition *teardownCondition = self.class.teardownCondition;
|
|
299
|
+
BOOL wasActive;
|
|
300
|
+
NSUInteger generation;
|
|
301
|
+
[teardownCondition lock];
|
|
302
|
+
wasActive = (self == _activeSession);
|
|
303
|
+
// Captured so the teardown steps below can tell whether a replacement has claimed the device.
|
|
304
|
+
generation = _sessionGeneration;
|
|
305
|
+
if (wasActive) {
|
|
306
|
+
_activeSession = nil;
|
|
307
|
+
// Registered in the same critical section as the clear above, else a concurrent session
|
|
308
|
+
// creation could observe neither an active session nor a teardown and skip its wait.
|
|
309
|
+
_activeTeardownCount++;
|
|
310
|
+
}
|
|
311
|
+
[teardownCondition unlock];
|
|
312
|
+
if (!wasActive) {
|
|
313
|
+
// Someone else is already tearing this session down - wait for that to finish (bounded), so
|
|
314
|
+
// we don't act as if it's gone (e.g. launch a new app) while its -terminate is still in flight.
|
|
315
|
+
[self.class waitForActiveTeardownWithTimeout:FB_KILL_WAIT_TIMEOUT_SEC];
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@try {
|
|
320
|
+
// Posted before teardown so pending HTTP requests for this session can stop waiting sooner.
|
|
321
|
+
[NSNotificationCenter.defaultCenter postNotificationName:FBSessionWasKilledNotification object:self];
|
|
322
|
+
|
|
323
|
+
[self disableAlertsMonitor];
|
|
324
|
+
|
|
325
|
+
// The container is process-wide, so only act on a promise captured while this teardown still
|
|
326
|
+
// owned the generation - nil here means it is stale and must leave the recording alone.
|
|
327
|
+
FBScreenRecordingPromise *activeScreenRecording = [self.class activeScreenRecordingForGeneration:generation];
|
|
328
|
+
if (nil != activeScreenRecording) {
|
|
329
|
+
NSError *error;
|
|
330
|
+
if (![FBXCTestDaemonsProxy stopScreenRecordingWithUUID:activeScreenRecording.identifier error:&error]) {
|
|
331
|
+
[FBLogger logFmt:@"%@", error];
|
|
332
|
+
}
|
|
333
|
+
// Identity, not generation: the stop above may outlast a replacement storing its own promise.
|
|
334
|
+
// Compare-and-reset, so that replacement's store cannot land between the check and the reset.
|
|
335
|
+
[FBScreenRecordingContainer.sharedInstance resetIfPromiseIs:activeScreenRecording];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (nil != self.testedApplication
|
|
339
|
+
&& FBConfiguration.sharedInstance.shouldTerminateApp
|
|
340
|
+
&& self.testedApplication.running
|
|
341
|
+
&& ![self fb_isApplicationSameAsSystemApp:self.testedApplication timeout:FB_IS_SYSTEM_APP_CHECK_TIMEOUT_SEC]) {
|
|
342
|
+
// Blocks until the app is either actually terminated or durably given up on (never left
|
|
343
|
+
// pending) - see -fb_terminateTestedApplicationWithTimeout:generation: - so it's safe to
|
|
344
|
+
// report this teardown as finished as soon as this returns.
|
|
345
|
+
[self fb_terminateTestedApplicationWithTimeout:FB_APP_TERMINATE_TIMEOUT_SEC generation:generation];
|
|
346
|
+
}
|
|
347
|
+
} @finally {
|
|
348
|
+
[teardownCondition lock];
|
|
349
|
+
_activeTeardownCount--;
|
|
350
|
+
// Unconditional: waiters re-check the count, so a wake-up mid-teardown just puts them back.
|
|
351
|
+
[teardownCondition broadcast];
|
|
352
|
+
[teardownCondition unlock];
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
- (XCUIApplication *)activeApplication
|
|
357
|
+
{
|
|
358
|
+
BOOL isAuto = [self.defaultActiveApplication isEqualToString:FBDefaultApplicationAuto];
|
|
359
|
+
NSString *defaultBundleId = isAuto ? nil : self.defaultActiveApplication;
|
|
360
|
+
|
|
361
|
+
if (nil != defaultBundleId && [self applicationStateWithBundleId:defaultBundleId] >= XCUIApplicationStateRunningForeground) {
|
|
362
|
+
return [self makeApplicationWithBundleId:defaultBundleId];
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (nil != self.testedApplication) {
|
|
366
|
+
XCUIApplicationState testedAppState = self.testedApplication.state;
|
|
367
|
+
if (testedAppState >= XCUIApplicationStateRunningForeground) {
|
|
368
|
+
NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"%K == %@ OR %K IN {%@, %@}",
|
|
369
|
+
@"elementType", @(XCUIElementTypeAlert),
|
|
370
|
+
// To look for `SBTransientOverlayWindow` elements. See https://github.com/appium/WebDriverAgent/pull/946
|
|
371
|
+
@"identifier", @"SBTransientOverlayWindow",
|
|
372
|
+
// To look for 'criticalAlertSetting' elements https://developer.apple.com/documentation/usernotifications/unnotificationsettings/criticalalertsetting
|
|
373
|
+
// See https://github.com/appium/appium/issues/20835
|
|
374
|
+
@"NotificationShortLookView"];
|
|
375
|
+
if (FBConfiguration.sharedInstance.shouldRespectSystemAlerts
|
|
376
|
+
&& [[XCUIApplication.fb_systemApplication descendantsMatchingType:XCUIElementTypeAny]
|
|
377
|
+
matchingPredicate:searchPredicate].count > 0) {
|
|
378
|
+
return XCUIApplication.fb_systemApplication;
|
|
379
|
+
}
|
|
380
|
+
return (XCUIApplication *)self.testedApplication;
|
|
381
|
+
}
|
|
382
|
+
if (self.isTestedApplicationExpectedToRun && testedAppState <= XCUIApplicationStateNotRunning) {
|
|
383
|
+
NSString *description = [NSString stringWithFormat:@"The application under test with bundle id '%@' is not running, possibly crashed", self.testedApplication.bundleID];
|
|
384
|
+
@throw [NSException exceptionWithName:FBApplicationCrashedException reason:description userInfo:nil];
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return [XCUIApplication fb_activeApplicationWithDefaultBundleId:defaultBundleId];
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
- (XCUIApplication *)launchApplicationWithBundleId:(NSString *)bundleIdentifier
|
|
392
|
+
shouldWaitForQuiescence:(nullable NSNumber *)shouldWaitForQuiescence
|
|
393
|
+
arguments:(nullable NSArray<NSString *> *)arguments
|
|
394
|
+
environment:(nullable NSDictionary <NSString *, NSString *> *)environment
|
|
395
|
+
{
|
|
396
|
+
return [self launchApplicationWithBundleId:bundleIdentifier
|
|
397
|
+
shouldWaitForQuiescence:shouldWaitForQuiescence
|
|
398
|
+
arguments:arguments
|
|
399
|
+
environment:environment
|
|
400
|
+
asApplicationUnderTest:NO];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
- (XCUIApplication *)launchApplicationWithBundleId:(NSString *)bundleIdentifier
|
|
404
|
+
shouldWaitForQuiescence:(nullable NSNumber *)shouldWaitForQuiescence
|
|
405
|
+
arguments:(nullable NSArray<NSString *> *)arguments
|
|
406
|
+
environment:(nullable NSDictionary <NSString *, NSString *> *)environment
|
|
407
|
+
asApplicationUnderTest:(BOOL)asApplicationUnderTest
|
|
408
|
+
{
|
|
409
|
+
NSCondition *condition = self.class.teardownCondition;
|
|
410
|
+
NSUInteger generation = 0;
|
|
411
|
+
BOOL shouldTerminateApp = NO;
|
|
412
|
+
if (asApplicationUnderTest) {
|
|
413
|
+
[condition lock];
|
|
414
|
+
BOOL isActive = self == _activeSession;
|
|
415
|
+
generation = _sessionGeneration;
|
|
416
|
+
shouldTerminateApp = FBConfiguration.sharedInstance.shouldTerminateApp;
|
|
417
|
+
[condition unlock];
|
|
418
|
+
if (!isActive) {
|
|
419
|
+
@throw [NSException exceptionWithName:FBSessionDoesNotExistException
|
|
420
|
+
reason:@"Session does not exist"
|
|
421
|
+
userInfo:nil];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
XCUIApplication *app = [self makeApplicationWithBundleId:bundleIdentifier];
|
|
426
|
+
if (nil == shouldWaitForQuiescence) {
|
|
427
|
+
// Iherit the quiescence check setting from the main app under test by default.
|
|
428
|
+
// The first app under test of the session waits for quiescence, as it would on session startup
|
|
429
|
+
app.fb_shouldWaitForQuiescence = nil == self.testedApplication
|
|
430
|
+
? asApplicationUnderTest
|
|
431
|
+
: self.shouldAppsWaitForQuiescence;
|
|
432
|
+
} else {
|
|
433
|
+
app.fb_shouldWaitForQuiescence = [shouldWaitForQuiescence boolValue];
|
|
434
|
+
}
|
|
435
|
+
if (!app.running) {
|
|
436
|
+
app.launchArguments = arguments ?: @[];
|
|
437
|
+
app.launchEnvironment = environment ?: @{};
|
|
438
|
+
[app launch];
|
|
439
|
+
} else {
|
|
440
|
+
[app activate];
|
|
441
|
+
}
|
|
442
|
+
if (asApplicationUnderTest) {
|
|
443
|
+
BOOL waitForQuiescence = app.fb_shouldWaitForQuiescence;
|
|
444
|
+
// A DELETE can finish while launch/activate is still waiting for XCTest.
|
|
445
|
+
// Publish the AUT under the same lock that -kill uses to clear the session.
|
|
446
|
+
[condition lock];
|
|
447
|
+
BOOL isActive = self == _activeSession && generation == _sessionGeneration;
|
|
448
|
+
if (isActive) {
|
|
449
|
+
self.testedApplication = app;
|
|
450
|
+
self.shouldAppsWaitForQuiescence = waitForQuiescence;
|
|
451
|
+
}
|
|
452
|
+
[condition unlock];
|
|
453
|
+
if (!isActive) {
|
|
454
|
+
// The HTTP request may already have been abandoned, but its handler keeps
|
|
455
|
+
// running. Clean up only while this launch still owns the generation;
|
|
456
|
+
// a replacement session may already be using the same bundle identifier.
|
|
457
|
+
if (shouldTerminateApp
|
|
458
|
+
&& ![self fb_isApplicationSameAsSystemApp:app timeout:FB_IS_SYSTEM_APP_CHECK_TIMEOUT_SEC]
|
|
459
|
+
&& [self.class beginTerminationForGeneration:generation]) {
|
|
460
|
+
@try {
|
|
461
|
+
[app terminate];
|
|
462
|
+
} @catch (NSException *e) {
|
|
463
|
+
[FBLogger logFmt:@"%@", e.description];
|
|
464
|
+
} @finally {
|
|
465
|
+
[self.class endTermination];
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
@throw [NSException exceptionWithName:FBSessionDoesNotExistException
|
|
469
|
+
reason:@"Session was deleted during application launch"
|
|
470
|
+
userInfo:nil];
|
|
471
|
+
}
|
|
472
|
+
[FBLogger logFmt:@"The application '%@' is set as the application under test", bundleIdentifier];
|
|
473
|
+
}
|
|
474
|
+
if ([app fb_isSameAppAs:self.testedApplication]) {
|
|
475
|
+
self.isTestedApplicationExpectedToRun = YES;
|
|
476
|
+
}
|
|
477
|
+
return app;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
- (XCUIApplication *)activateApplicationWithBundleId:(NSString *)bundleIdentifier
|
|
481
|
+
{
|
|
482
|
+
XCUIApplication *app = [self makeApplicationWithBundleId:bundleIdentifier];
|
|
483
|
+
[app activate];
|
|
484
|
+
return app;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
- (BOOL)terminateApplicationWithBundleId:(NSString *)bundleIdentifier
|
|
488
|
+
{
|
|
489
|
+
XCUIApplication *app = [self makeApplicationWithBundleId:bundleIdentifier];
|
|
490
|
+
if ([app fb_isSameAppAs:self.testedApplication]) {
|
|
491
|
+
self.isTestedApplicationExpectedToRun = NO;
|
|
492
|
+
}
|
|
493
|
+
if (app.running) {
|
|
494
|
+
[app terminate];
|
|
495
|
+
return YES;
|
|
496
|
+
}
|
|
497
|
+
return NO;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
- (NSUInteger)applicationStateWithBundleId:(NSString *)bundleIdentifier
|
|
501
|
+
{
|
|
502
|
+
return [self makeApplicationWithBundleId:bundleIdentifier].state;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
- (XCUIApplication *)makeApplicationWithBundleId:(NSString *)bundleIdentifier
|
|
506
|
+
{
|
|
507
|
+
return nil != self.testedApplication && [bundleIdentifier isEqualToString:(NSString *)self.testedApplication.bundleID]
|
|
508
|
+
? self.testedApplication
|
|
509
|
+
: [[XCUIApplication alloc] initWithBundleIdentifier:bundleIdentifier];
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// Has no async variant and can block on the shared accessibility channel. Run off-thread and give
|
|
513
|
+
// up after `timeout`, assuming the supplied app IS the system app - safer, since it means skipping
|
|
514
|
+
// termination rather than risking terminating springboard.
|
|
515
|
+
- (BOOL)fb_isApplicationSameAsSystemApp:(XCUIApplication *)application timeout:(NSTimeInterval)timeout
|
|
516
|
+
{
|
|
517
|
+
__block XCUIApplication *systemApp = nil;
|
|
518
|
+
__block NSException *caughtException = nil;
|
|
519
|
+
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
|
520
|
+
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
|
521
|
+
// Undocumented private API; guard in case it hard-asserts off-main like -terminate does on
|
|
522
|
+
// some Xcode/iOS version - uncaught, that would crash the whole process.
|
|
523
|
+
@try {
|
|
524
|
+
systemApp = [[application class] fb_systemApplication];
|
|
525
|
+
} @catch (NSException *e) {
|
|
526
|
+
caughtException = e;
|
|
527
|
+
}
|
|
528
|
+
dispatch_semaphore_signal(sem);
|
|
529
|
+
});
|
|
530
|
+
int64_t timeoutNs = (int64_t)(timeout * NSEC_PER_SEC);
|
|
531
|
+
if (0 != dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, timeoutNs)) || nil != caughtException) {
|
|
532
|
+
[FBLogger logFmt:@"Could not determine the system application within %@ seconds%@; assuming '%@' might be it and skipping its termination", @(timeout), nil == caughtException ? @"" : [NSString stringWithFormat:@" (%@)", caughtException.description], application.bundleID];
|
|
533
|
+
return YES;
|
|
534
|
+
}
|
|
535
|
+
return [application fb_isSameAppAs:systemApp];
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// -terminate hard-asserts off-main, but -kill can now run on a background queue. Dispatching to
|
|
539
|
+
// main and waiting indefinitely could hang just as long as main is stuck, so give up after
|
|
540
|
+
// `timeout` - but a "given up on" call must never still terminate whatever's running by the time
|
|
541
|
+
// main gets to it (e.g. a replacement session's app), so cancellation and the actual terminate
|
|
542
|
+
// call share a lock: whichever gets there first - the dispatched block, or the timeout - wins.
|
|
543
|
+
- (void)fb_terminateTestedApplicationWithTimeout:(NSTimeInterval)timeout generation:(NSUInteger)generation
|
|
544
|
+
{
|
|
545
|
+
XCUIApplication *application = self.testedApplication;
|
|
546
|
+
NSObject *lock = [NSObject new];
|
|
547
|
+
__block BOOL isAllowedToTerminate = YES;
|
|
548
|
+
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
|
549
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
550
|
+
@synchronized (lock) {
|
|
551
|
+
// Re-checked here, not before dispatching: this block can sit on a busy main queue past the
|
|
552
|
+
// teardown wait, and a replacement usually runs the same bundle ID as the app to terminate.
|
|
553
|
+
// The claim is held across -terminate, so no replacement can take the next generation mid-call.
|
|
554
|
+
if (isAllowedToTerminate && [self.class beginTerminationForGeneration:generation]) {
|
|
555
|
+
@try {
|
|
556
|
+
[application terminate];
|
|
557
|
+
} @catch (NSException *e) {
|
|
558
|
+
[FBLogger logFmt:@"%@", e.description];
|
|
559
|
+
} @finally {
|
|
560
|
+
[self.class endTermination];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
dispatch_semaphore_signal(sem);
|
|
565
|
+
});
|
|
566
|
+
int64_t timeoutNs = (int64_t)(timeout * NSEC_PER_SEC);
|
|
567
|
+
if (0 != dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, timeoutNs))) {
|
|
568
|
+
@synchronized (lock) {
|
|
569
|
+
isAllowedToTerminate = NO;
|
|
570
|
+
}
|
|
571
|
+
[FBLogger logFmt:@"Could not terminate '%@' within %@ seconds; giving up on it rather than risk terminating a possible replacement session's app later", application.bundleID, @(timeout)];
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
@end
|
|
@@ -0,0 +1,117 @@
|
|
|
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.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
@import Foundation;
|
|
10
|
+
// A textual import, not `@import Network;` - older Xcode/watchOS SDK combinations (verified:
|
|
11
|
+
// Xcode 15.4/watchOS 10.5) fail to expose nw_listener_t/nw_connection_t and friends through the
|
|
12
|
+
// Network module map on watchOS, even though the underlying API has existed since watchOS 5.0.
|
|
13
|
+
// Kept unconditional (rather than gated to watchOS) since it also builds cleanly on iOS/tvOS.
|
|
14
|
+
#import <Network/Network.h>
|
|
15
|
+
|
|
16
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
17
|
+
|
|
18
|
+
// Backed by Network.framework rather than BSD sockets on every platform, since watchOS forbids
|
|
19
|
+
// BSD sockets outright and there is no reason to keep a second, socket-based implementation
|
|
20
|
+
// around just for iOS/tvOS.
|
|
21
|
+
@protocol FBTCPSocketDelegate <NSObject>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
The callback which is fired on new TCP client connection
|
|
25
|
+
|
|
26
|
+
@param newClient The newly connected client
|
|
27
|
+
*/
|
|
28
|
+
- (void)didClientConnect:(nw_connection_t)newClient;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
The callback which is fired when the TCP server receives data from a connected client
|
|
32
|
+
|
|
33
|
+
@param client The client, which sent the data
|
|
34
|
+
@param data The received data
|
|
35
|
+
*/
|
|
36
|
+
- (void)client:(nw_connection_t)client didReceiveData:(NSData *)data;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
The callback which is fired when TCP client disconnects or finishes sending
|
|
40
|
+
|
|
41
|
+
A connection that failed is cancelled by the socket. One whose peer only finished sending stays
|
|
42
|
+
writable (the peer may be awaiting a response), and the delegate must cancel it once it has
|
|
43
|
+
nothing left to send - an uncancelled connection keeps its socket open.
|
|
44
|
+
|
|
45
|
+
@param client The actual disconnected client
|
|
46
|
+
*/
|
|
47
|
+
- (void)didClientDisconnect:(nw_connection_t)client;
|
|
48
|
+
|
|
49
|
+
@end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@interface FBTCPSocket : NSObject
|
|
53
|
+
|
|
54
|
+
#if __has_feature(objc_arc_weak)
|
|
55
|
+
@property (nullable, nonatomic, weak) id<FBTCPSocketDelegate> delegate;
|
|
56
|
+
#else
|
|
57
|
+
@property (nullable, nonatomic, assign) id<FBTCPSocketDelegate> delegate;
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
The port this socket is listening on. Equal to the port passed to -initWithPort: unless that was
|
|
62
|
+
0 ("let the system assign a port"), in which case this reflects the actually assigned port once
|
|
63
|
+
-startWithError: has returned successfully.
|
|
64
|
+
*/
|
|
65
|
+
@property (nonatomic, readonly) uint16_t port;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
The local IP address to bind the listener to, or nil to listen on all interfaces. Must be set
|
|
69
|
+
before -startWithError: is called.
|
|
70
|
+
*/
|
|
71
|
+
@property (nonatomic, copy, nullable) NSString *interface;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
Creates TCP socket isntance which is going to be started on the specified port
|
|
75
|
+
|
|
76
|
+
@param port The actual port number
|
|
77
|
+
@return self instance
|
|
78
|
+
*/
|
|
79
|
+
- (instancetype)initWithPort:(uint16_t)port;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
Starts TCP socket listener on the specified port
|
|
83
|
+
|
|
84
|
+
@param error The alias to the actual startup error descirption or nil if the socket has started and is listening
|
|
85
|
+
@return NO If there was an error
|
|
86
|
+
*/
|
|
87
|
+
- (BOOL)startWithError:(NSError **)error;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
Stops the socket if it is running
|
|
91
|
+
*/
|
|
92
|
+
- (void)stop;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
Writes data to the given connected client
|
|
96
|
+
|
|
97
|
+
@param data The data to send
|
|
98
|
+
@param client The destination client, as received via -didClientConnect: or -client:didReceiveData:
|
|
99
|
+
*/
|
|
100
|
+
- (void)writeData:(NSData *)data toClient:(nw_connection_t)client;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
Like -writeData:toClient:, but invokes completion once the send actually goes out. Use this
|
|
104
|
+
before cancelling the connection - nw_connection_send is async, so cancelling right away can
|
|
105
|
+
drop the write before it's sent.
|
|
106
|
+
|
|
107
|
+
@param data The data to send
|
|
108
|
+
@param client The destination client
|
|
109
|
+
@param completion Called once the send attempt finishes. `didSucceed` is NO if the send failed
|
|
110
|
+
(e.g. the peer went away mid-write), in which case nothing was delivered and the caller
|
|
111
|
+
must not treat the connection as usable.
|
|
112
|
+
*/
|
|
113
|
+
- (void)writeData:(NSData *)data toClient:(nw_connection_t)client completion:(nullable void (^)(BOOL didSucceed))completion;
|
|
114
|
+
|
|
115
|
+
@end
|
|
116
|
+
|
|
117
|
+
NS_ASSUME_NONNULL_END
|