appium-webdriveragent 16.1.3 → 16.1.4
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/CHANGELOG.md +7 -0
- package/WebDriverAgent.xcodeproj/project.pbxproj +297 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationApp_tvOS.xcscheme +78 -0
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_tvOS.xcscheme +86 -0
- package/WebDriverAgentLib/Categories/XCUIElement+FBTVFocuse.m +4 -4
- package/WebDriverAgentLib/Commands/FBElementCommands.m +3 -3
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker-Private.h +10 -0
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker.h +29 -4
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker.m +62 -27
- 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/IntegrationTests_tvOS/FBTVFocusIntegrationTests.m +84 -0
- package/WebDriverAgentTests/IntegrationTests_tvOS/Info.plist +24 -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/FBTVNavigationTrackerTests.m +48 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>en</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>com.facebook.wda.integrationTests.tvOS</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>BNDL</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleSignature</key>
|
|
20
|
+
<string>????</string>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>1</string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
|
@@ -0,0 +1,27 @@
|
|
|
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/Foundation.h>
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
Minimal fake of the private `id<FBXCAccessibilityElement>` handle every
|
|
15
|
+
real snapshot carries, just enough for `FBElementUtils uidWithAccessibilityElement:`
|
|
16
|
+
to derive a stable, distinct `wdUID` per fake element id.
|
|
17
|
+
*/
|
|
18
|
+
@interface FBXCAccessibilityElementDouble : NSObject
|
|
19
|
+
|
|
20
|
+
@property (nonatomic, readonly) id payload;
|
|
21
|
+
@property (nonatomic, readonly) int processIdentifier;
|
|
22
|
+
|
|
23
|
+
- (instancetype)initWithElementId:(unsigned long long)elementId;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,23 @@
|
|
|
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 "FBXCAccessibilityElementDouble.h"
|
|
10
|
+
|
|
11
|
+
@implementation FBXCAccessibilityElementDouble
|
|
12
|
+
|
|
13
|
+
- (instancetype)initWithElementId:(unsigned long long)elementId
|
|
14
|
+
{
|
|
15
|
+
self = [super init];
|
|
16
|
+
if (self) {
|
|
17
|
+
_payload = @{@"uid.elementID": @(elementId)};
|
|
18
|
+
_processIdentifier = 1;
|
|
19
|
+
}
|
|
20
|
+
return self;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@end
|
|
@@ -0,0 +1,43 @@
|
|
|
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/Foundation.h>
|
|
10
|
+
|
|
11
|
+
#import "FBXCAccessibilityElementDouble.h"
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Fake `id<FBXCElementSnapshot>` leaf node. Deliberately does NOT declare
|
|
17
|
+
formal conformance to the (large, mostly-unrelated) `FBXCElementSnapshot`
|
|
18
|
+
protocol - it only implements the selectors
|
|
19
|
+
`FBTVNavigationTracker`'s `-directionTowardsTargetFromFocusedElementSnapshot:`
|
|
20
|
+
actually reads: `frame`, `hasFocus` and `accessibilityElement` (the latter
|
|
21
|
+
indirectly, via `FBXCElementSnapshotWrapper.wdUID`). Cast to
|
|
22
|
+
`id<FBXCElementSnapshot>` at the call site. Lets tests supply a fake focused
|
|
23
|
+
element snapshot without a live app/device.
|
|
24
|
+
*/
|
|
25
|
+
@interface FBXCElementSnapshotDouble : NSObject
|
|
26
|
+
|
|
27
|
+
@property (nonatomic, assign) CGRect frame;
|
|
28
|
+
@property (nonatomic, assign) BOOL hasFocus;
|
|
29
|
+
@property (nonatomic, strong, nullable) FBXCAccessibilityElementDouble *accessibilityElement;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
@param elementId Fake AX element id, used to derive a distinct `wdUID`
|
|
33
|
+
@param frame The snapshot's frame
|
|
34
|
+
@param hasFocus Whether this node should report `hasFocus == YES`
|
|
35
|
+
@return A snapshot double
|
|
36
|
+
*/
|
|
37
|
+
+ (instancetype)snapshotWithElementId:(unsigned long long)elementId
|
|
38
|
+
frame:(CGRect)frame
|
|
39
|
+
hasFocus:(BOOL)hasFocus;
|
|
40
|
+
|
|
41
|
+
@end
|
|
42
|
+
|
|
43
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,24 @@
|
|
|
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 "FBXCElementSnapshotDouble.h"
|
|
10
|
+
|
|
11
|
+
@implementation FBXCElementSnapshotDouble
|
|
12
|
+
|
|
13
|
+
+ (instancetype)snapshotWithElementId:(unsigned long long)elementId
|
|
14
|
+
frame:(CGRect)frame
|
|
15
|
+
hasFocus:(BOOL)hasFocus
|
|
16
|
+
{
|
|
17
|
+
FBXCElementSnapshotDouble *snapshot = [self new];
|
|
18
|
+
snapshot.accessibilityElement = [[FBXCAccessibilityElementDouble alloc] initWithElementId:elementId];
|
|
19
|
+
snapshot.frame = frame;
|
|
20
|
+
snapshot.hasFocus = hasFocus;
|
|
21
|
+
return snapshot;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@end
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
#import <XCTest/XCTest.h>
|
|
10
|
+
#import <WebDriverAgentLib/FBXCElementSnapshot.h>
|
|
10
11
|
|
|
11
12
|
#import "XCUIElementDouble.h"
|
|
13
|
+
#import "FBXCElementSnapshotDouble.h"
|
|
12
14
|
#import "FBTVNavigationTracker.h"
|
|
13
15
|
#import "FBTVNavigationTracker-Private.h"
|
|
14
16
|
|
|
@@ -83,4 +85,50 @@
|
|
|
83
85
|
XCTAssertEqual(FBTVDirectionNone, direction);
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
#pragma mark - directionTowardsTargetFromFocusedElementSnapshot:
|
|
89
|
+
|
|
90
|
+
- (FBTVNavigationTracker *)trackerWithTargetFrame:(CGRect)targetFrame
|
|
91
|
+
{
|
|
92
|
+
XCUIElementDouble *targetElement = XCUIElementDouble.new;
|
|
93
|
+
targetElement.wdFrame = targetFrame;
|
|
94
|
+
return [FBTVNavigationTracker trackerWithTargetElement:(XCUIElement *)targetElement];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (void)testDirectionTowardsTargetFromFocusedElementSnapshotShouldPointRight
|
|
98
|
+
{
|
|
99
|
+
// Target sits to the right of the currently focused element.
|
|
100
|
+
FBTVNavigationTracker *tracker = [self trackerWithTargetFrame:CGRectMake(100, 0, 0, 0)];
|
|
101
|
+
FBXCElementSnapshotDouble *focusedSnapshot = [FBXCElementSnapshotDouble snapshotWithElementId:1 frame:CGRectMake(0, 0, 0, 0) hasFocus:YES];
|
|
102
|
+
|
|
103
|
+
FBTVDirection direction = [tracker directionTowardsTargetFromFocusedElementSnapshot:(id<FBXCElementSnapshot>)focusedSnapshot];
|
|
104
|
+
|
|
105
|
+
XCTAssertEqual(FBTVDirectionRight, direction);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (void)testDirectionTowardsTargetFromFocusedElementSnapshotShouldPointUp
|
|
109
|
+
{
|
|
110
|
+
// Target sits above the currently focused element.
|
|
111
|
+
FBTVNavigationTracker *tracker = [self trackerWithTargetFrame:CGRectMake(0, -100, 0, 0)];
|
|
112
|
+
FBXCElementSnapshotDouble *focusedSnapshot = [FBXCElementSnapshotDouble snapshotWithElementId:1 frame:CGRectMake(0, 0, 0, 0) hasFocus:YES];
|
|
113
|
+
|
|
114
|
+
FBTVDirection direction = [tracker directionTowardsTargetFromFocusedElementSnapshot:(id<FBXCElementSnapshot>)focusedSnapshot];
|
|
115
|
+
|
|
116
|
+
XCTAssertEqual(FBTVDirectionUp, direction);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
- (void)testDirectionTowardsTargetFromFocusedElementSnapshotShouldNotSuggestTheSameDirectionTwiceInARow
|
|
120
|
+
{
|
|
121
|
+
// Same (unmoved) focused snapshot polled twice: the horizontal move gets
|
|
122
|
+
// suggested once, then withheld on the next call, per the "don't repeat a
|
|
123
|
+
// direction" bookkeeping in -directionWithItem:delta:positiveDirection:negativeDirection:.
|
|
124
|
+
FBTVNavigationTracker *tracker = [self trackerWithTargetFrame:CGRectMake(100, 0, 0, 0)];
|
|
125
|
+
FBXCElementSnapshotDouble *focusedSnapshot = [FBXCElementSnapshotDouble snapshotWithElementId:1 frame:CGRectMake(0, 0, 0, 0) hasFocus:YES];
|
|
126
|
+
|
|
127
|
+
FBTVDirection firstDirection = [tracker directionTowardsTargetFromFocusedElementSnapshot:(id<FBXCElementSnapshot>)focusedSnapshot];
|
|
128
|
+
XCTAssertEqual(FBTVDirectionRight, firstDirection);
|
|
129
|
+
|
|
130
|
+
FBTVDirection secondDirection = [tracker directionTowardsTargetFromFocusedElementSnapshot:(id<FBXCElementSnapshot>)focusedSnapshot];
|
|
131
|
+
XCTAssertEqual(FBTVDirectionNone, secondDirection);
|
|
132
|
+
}
|
|
133
|
+
|
|
86
134
|
@end
|