Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,12 @@ matrix:
- os: osx
osx_image: xcode10.2
env: IPHONE_MODEL="iPhone X" IPAD_MODEL="iPad Air 2" IOS_VERSION="12.2" ACTION=int_test_3 DEST=ipad TARGET=lib SDK=sim

# Builds
- os: osx
osx_image: xcode10.2
env: DEST=tv TV_MODEL="Apple TV" TV_VERSION="12.2" ACTION=build TARGET=tv_runner SDK=tv_sim
# Analyze
- os: osx
osx_image: xcode10.2
env: DEST=tv TV_MODEL="Apple TV" TV_VERSION="12.2" ACTION=analyze TARGET=tv_runner SDK=tv_sim
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "appium/RoutingHTTPServer" "v1.0.2"
github "appium/YYCache" "1.0.5"
github "appium/YYCache" "1.1.0"
github "robbiehanson/CocoaAsyncSocket" "7.6.3"
8 changes: 4 additions & 4 deletions PrivateHeaders/XCTest/XCEventGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ typedef void (^XCEventGeneratorHandler)(XCSynthesizedEventRecord *record, NSErro
@property unsigned long long generation; // @synthesize generation=_generation;
//@property(readonly) NSObject<OS_dispatch_queue> *eventQueue; // @synthesize eventQueue=_eventQueue;

#if TARGET_OS_IPHONE
#if TARGET_OS_TV
// TODO: tvOS-specific headers

#elif TARGET_OS_IPHONE
- (double)rotateInRect:(CGRect)arg1 withRotation:(double)arg2 velocity:(double)arg3 orientation:(UIInterfaceOrientation)arg4 handler:(XCEventGeneratorHandler)arg5;
- (double)pinchInRect:(CGRect)arg1 withScale:(double)arg2 velocity:(double)arg3 orientation:(UIInterfaceOrientation)arg4 handler:(XCEventGeneratorHandler)arg5;
- (double)pressAtPoint:(CGPoint)arg1 forDuration:(double)arg2 liftAtPoint:(CGPoint)arg3 velocity:(double)arg4 orientation:(UIInterfaceOrientation)arg5 name:(NSString *)arg6 handler:(XCEventGeneratorHandler)arg7;
Expand All @@ -43,9 +46,6 @@ typedef void (^XCEventGeneratorHandler)(XCSynthesizedEventRecord *record, NSErro
// iOS 10.3 specific
- (double)forcePressAtPoint:(struct CGPoint)arg1 orientation:(long long)arg2 handler:(CDUnknownBlockType)arg3;

#elif TARGET_OS_TV
// TODO: tvOS-specific headers

#elif TARGET_OS_MAC
- (double)sendKeyboardInputs:(id)arg1 layout:(id)arg2 handler:(CDUnknownBlockType)arg3;
- (double)sendKey:(id)arg1 modifierFlags:(unsigned long long)arg2 handler:(CDUnknownBlockType)arg3;
Expand Down
5 changes: 5 additions & 0 deletions Scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ function define_xc_macros() {
case "$TARGET" in
"lib" ) XC_TARGET="WebDriverAgentLib";;
"runner" ) XC_TARGET="WebDriverAgentRunner";;
"tv_lib" ) XC_TARGET="WebDriverAgentLib_tvOS";;
"tv_runner" ) XC_TARGET="WebDriverAgentRunner_tvOS";;
*) echo "Unknown TARGET"; exit 1 ;;
esac

case "${DEST:-}" in
"iphone" ) XC_DESTINATION="-destination \"name=${IPHONE_MODEL},OS=${IOS_VERSION}\"";;
"ipad" ) XC_DESTINATION="-destination \"name=${IPAD_MODEL},OS=${IOS_VERSION}\"";;
"tv" ) XC_DESTINATION="-destination \"name=${TV_MODEL},OS=${TV_VERSION}\"";;
esac

case "$ACTION" in
Expand All @@ -40,6 +43,8 @@ function define_xc_macros() {
case "$SDK" in
"sim" ) XC_SDK="iphonesimulator";;
"device" ) XC_SDK="iphoneos";;
"tv_sim" ) XC_SDK="appletvos";;
"tv_device" ) XC_SDK="appletvsimulator";;
*) echo "Unknown SDK"; exit 1 ;;
esac
}
Expand Down
897 changes: 897 additions & 0 deletions WebDriverAgent.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -86,7 +85,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2C42240BAB800173FCB"
BuildableName = "WebDriverAgentLib_tvOS.framework"
BlueprintName = "WebDriverAgentLib_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2C42240BAB800173FCB"
BuildableName = "WebDriverAgentLib_tvOS.framework"
BlueprintName = "WebDriverAgentLib_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2C42240BAB800173FCB"
BuildableName = "WebDriverAgentLib_tvOS.framework"
BlueprintName = "WebDriverAgentLib_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
systemAttachmentLifetime = "keepNever"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
Expand All @@ -48,7 +47,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2D92240BBE300173FCB"
BuildableName = "WebDriverAgentRunner_tvOS.xctest"
BlueprintName = "WebDriverAgentRunner_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2D92240BBE300173FCB"
BuildableName = "WebDriverAgentRunner_tvOS.xctest"
BlueprintName = "WebDriverAgentRunner_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2D92240BBE300173FCB"
BuildableName = "WebDriverAgentRunner_tvOS.xctest"
BlueprintName = "WebDriverAgentRunner_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2D92240BBE300173FCB"
BuildableName = "WebDriverAgentRunner_tvOS.xctest"
BlueprintName = "WebDriverAgentRunner_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "USE_PORT"
value = "$(USE_PORT)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "UPGRADE_TIMESTAMP"
value = "$(UPGRADE_TIMESTAMP)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "MJPEG_SERVER_PORT"
value = "$(MJPEG_SERVER_PORT)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "WDA_PRODUCT_BUNDLE_IDENTIFIER"
value = "$(WDA_PRODUCT_BUNDLE_IDENTIFIER)"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "641EE2D92240BBE300173FCB"
BuildableName = "WebDriverAgentRunner_tvOS.xctest"
BlueprintName = "WebDriverAgentRunner_tvOS"
ReferencedContainer = "container:WebDriverAgent.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
24 changes: 24 additions & 0 deletions WebDriverAgentLib/Categories/XCUIApplication+FBFocused.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2018-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import <XCTest/XCTest.h>
#import "FBElement.h"

NS_ASSUME_NONNULL_BEGIN

@interface XCUIApplication (FBFocused)

/**
Return current focused element
*/
- (id<FBElement>)fb_focusedElement;

@end

NS_ASSUME_NONNULL_END
21 changes: 21 additions & 0 deletions WebDriverAgentLib/Categories/XCUIApplication+FBFocused.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) 2018-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import "XCUIApplication+FBFocused.h"
#import "XCUIElement+FBWebDriverAttributes.h"

@implementation XCUIApplication (FBFocused)

- (id<FBElement>) fb_focusedElement
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will move into XCUIApplication+FBHelpers.m in the next PR

{
XCUIElementQuery *query = [self descendantsMatchingType:XCUIElementTypeAny];
return [query elementMatchingPredicate: [NSPredicate predicateWithFormat:@"hasFocus == true"]];
}

@end
3 changes: 2 additions & 1 deletion WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (BOOL)fb_deactivateWithDuration:(NSTimeInterval)duration error:(NSError **)err
[self fb_activate];
return YES;
}
return [[FBSpringboardApplication fb_springboard] fb_tapApplicationWithIdentifier:applicationIdentifier error:error];
return [[FBSpringboardApplication fb_springboard] fb_openApplicationWithIdentifier:applicationIdentifier error:error];
}

- (NSDictionary *)fb_tree
Expand Down Expand Up @@ -91,6 +91,7 @@ + (NSDictionary *)dictionaryForElement:(XCElementSnapshot *)snapshot recursive:(
info[@"frame"] = NSStringFromCGRect(snapshot.wdFrame);
info[@"isEnabled"] = [@([snapshot isWDEnabled]) stringValue];
info[@"isVisible"] = [@([snapshot isWDVisible]) stringValue];
info[@"isFocused"] = [@([snapshot isWDFocused]) stringValue];

if (!recursive) {
return info.copy;
Expand Down
4 changes: 3 additions & 1 deletion WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#import "FBXCTestDaemonsProxy.h"
#import "XCEventGenerator.h"

#if !TARGET_OS_TV

@implementation XCUIApplication (FBTouchAction)

+ (BOOL)handleEventSynthesWithError:(NSError *)error
Expand Down Expand Up @@ -57,5 +59,5 @@ - (BOOL)fb_synthesizeEvent:(XCSynthesizedEventRecord *)event error:(NSError *__a
return [FBXCTestDaemonsProxy synthesizeEventWithRecord:event error:error];
}


@end
#endif
2 changes: 2 additions & 0 deletions WebDriverAgentLib/Categories/XCUICoordinate+FBFix.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

#import <XCTest/XCTest.h>

#if !TARGET_OS_TV
@interface XCUICoordinate (FBFix)

- (CGPoint)fb_screenPoint;

@end
#endif
Loading