appium-webdriveragent 4.15.1 → 5.0.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/CHANGELOG.md +11 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.m +9 -20
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +1 -5
- package/WebDriverAgentLib/Categories/XCUIElement+FBTap.m +7 -36
- package/WebDriverAgentLib/Commands/FBCustomCommands.m +2 -4
- package/WebDriverAgentLib/Utilities/FBBaseActionsSynthesizer.m +8 -26
- package/WebDriverAgentLib/Utilities/FBKeyboard.m +1 -2
- package/WebDriverAgentLib/Utilities/FBScreen.m +2 -9
- package/WebDriverAgentLib/Utilities/FBScreenshot.m +0 -1
- package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.m +1 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [5.0.0](https://github.com/appium/WebDriverAgent/compare/v4.15.1...v5.0.0) (2023-05-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* The minimum supported xCode/iOS version is now 13/15.0
|
|
7
|
+
|
|
8
|
+
### Code Refactoring
|
|
9
|
+
|
|
10
|
+
* Drop workarounds for legacy iOS versions ([#696](https://github.com/appium/WebDriverAgent/issues/696)) ([bb562b9](https://github.com/appium/WebDriverAgent/commit/bb562b96db6aad476970ef7bd352cb8df4f1e6c2))
|
|
11
|
+
|
|
1
12
|
## [4.15.1](https://github.com/appium/WebDriverAgent/compare/v4.15.0...v4.15.1) (2023-05-06)
|
|
2
13
|
|
|
3
14
|
|
|
@@ -36,26 +36,15 @@ NSString *const FB_SAFARI_APP_NAME = @"Safari";
|
|
|
36
36
|
}];
|
|
37
37
|
NSPredicate *dstViewContainPredicate1 = [NSPredicate predicateWithFormat:@"elementType == %lu", XCUIElementTypeTextView];
|
|
38
38
|
NSPredicate *dstViewContainPredicate2 = [NSPredicate predicateWithFormat:@"elementType == %lu", XCUIElementTypeButton];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
containingPredicate:dstViewContainPredicate2].allElementsBoundByIndex.firstObject;
|
|
49
|
-
} else {
|
|
50
|
-
NSPredicate *webViewPredicate = [NSPredicate predicateWithFormat:@"elementType == %lu", XCUIElementTypeWebView];
|
|
51
|
-
// Find the first XCUIElementTypeOther which is the descendant of the scroll view
|
|
52
|
-
// and is horizontally aligned to the center of the screen
|
|
53
|
-
candidate = [[[[[scrollView.fb_query containingPredicate:webViewPredicate]
|
|
54
|
-
descendantsMatchingType:XCUIElementTypeOther]
|
|
55
|
-
matchingPredicate:dstViewMatchPredicate]
|
|
56
|
-
containingPredicate:dstViewContainPredicate1]
|
|
57
|
-
containingPredicate:dstViewContainPredicate2].allElementsBoundByIndex.firstObject;
|
|
58
|
-
}
|
|
39
|
+
// Find the first XCUIElementTypeOther which is the grandchild of the web view
|
|
40
|
+
// and is horizontally aligned to the center of the screen
|
|
41
|
+
XCUIElement *candidate = [[[[[[scrollView descendantsMatchingType:XCUIElementTypeAny]
|
|
42
|
+
matchingIdentifier:@"WebView"]
|
|
43
|
+
descendantsMatchingType:XCUIElementTypeOther]
|
|
44
|
+
matchingPredicate:dstViewMatchPredicate]
|
|
45
|
+
containingPredicate:dstViewContainPredicate1]
|
|
46
|
+
containingPredicate:dstViewContainPredicate2].allElementsBoundByIndex.firstObject;
|
|
47
|
+
|
|
59
48
|
if (nil == candidate) {
|
|
60
49
|
return nil;
|
|
61
50
|
}
|
|
@@ -86,11 +86,7 @@ static bool fb_isLocked;
|
|
|
86
86
|
[self pressButton:XCUIDeviceButtonHome];
|
|
87
87
|
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:FBHomeButtonCoolOffTime]];
|
|
88
88
|
#if !TARGET_OS_TV
|
|
89
|
-
|
|
90
|
-
[[FBApplication fb_activeApplication] swipeRight];
|
|
91
|
-
} else {
|
|
92
|
-
[self pressButton:XCUIDeviceButtonHome];
|
|
93
|
-
}
|
|
89
|
+
[self pressButton:XCUIDeviceButtonHome];
|
|
94
90
|
#else
|
|
95
91
|
[self pressButton:XCUIDeviceButtonHome];
|
|
96
92
|
#endif
|
|
@@ -9,52 +9,23 @@
|
|
|
9
9
|
|
|
10
10
|
#import "XCUIElement+FBTap.h"
|
|
11
11
|
|
|
12
|
-
#import "FBMacros.h"
|
|
13
|
-
#import "XCUIApplication+FBTouchAction.h"
|
|
14
|
-
#import "XCUIElement+FBUtilities.h"
|
|
15
|
-
|
|
16
12
|
|
|
17
13
|
#if !TARGET_OS_TV
|
|
18
14
|
@implementation XCUIElement (FBTap)
|
|
19
15
|
|
|
20
16
|
- (BOOL)fb_tapWithError:(NSError **)error
|
|
21
17
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return YES;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
NSArray<NSDictionary<NSString *, id> *> *tapGesture =
|
|
28
|
-
@[
|
|
29
|
-
@{@"action": @"tap",
|
|
30
|
-
@"options": @{@"element": self}
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
return [self.application fb_performAppiumTouchActions:tapGesture elementCache:nil error:error];
|
|
18
|
+
[self tap];
|
|
19
|
+
return YES;
|
|
34
20
|
}
|
|
35
21
|
|
|
36
22
|
- (BOOL)fb_tapCoordinate:(CGPoint)relativeCoordinate error:(NSError **)error
|
|
37
23
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
XCUICoordinate *dstCoordinate = [startCoordinate coordinateWithOffset:offset];
|
|
44
|
-
[dstCoordinate tap];
|
|
45
|
-
return YES;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
NSArray<NSDictionary<NSString *, id> *> *tapGesture =
|
|
49
|
-
@[
|
|
50
|
-
@{@"action": @"tap",
|
|
51
|
-
@"options": @{@"element": self,
|
|
52
|
-
@"x": @(relativeCoordinate.x),
|
|
53
|
-
@"y": @(relativeCoordinate.y)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
return [self.application fb_performAppiumTouchActions:tapGesture elementCache:nil error:error];
|
|
24
|
+
XCUICoordinate *startCoordinate = [self coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
|
|
25
|
+
CGVector offset = CGVectorMake(relativeCoordinate.x, relativeCoordinate.y);
|
|
26
|
+
XCUICoordinate *dstCoordinate = [startCoordinate coordinateWithOffset:offset];
|
|
27
|
+
[dstCoordinate tap];
|
|
28
|
+
return YES;
|
|
58
29
|
}
|
|
59
30
|
|
|
60
31
|
@end
|
|
@@ -423,10 +423,8 @@
|
|
|
423
423
|
#endif
|
|
424
424
|
}];
|
|
425
425
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
deviceInfo[@"thermalState"] = @(NSProcessInfo.processInfo.thermalState);
|
|
429
|
-
}
|
|
426
|
+
// https://developer.apple.com/documentation/foundation/nsprocessinfothermalstate
|
|
427
|
+
deviceInfo[@"thermalState"] = @(NSProcessInfo.processInfo.thermalState);
|
|
430
428
|
|
|
431
429
|
return FBResponseWithObject(deviceInfo);
|
|
432
430
|
}
|
|
@@ -48,24 +48,8 @@
|
|
|
48
48
|
// There is no need to recalculate anything for portrait orientation
|
|
49
49
|
return hitPoint;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// For Xcode11 it is always necessary to adjust the tap point coordinates
|
|
54
|
-
return FBInvertPointForApplication(hitPoint, appFrame.size, interfaceOrientation);
|
|
55
|
-
}
|
|
56
|
-
NSArray<id<FBXCElementSnapshot>> *ancestors = [FBXCElementSnapshotWrapper ensureWrapped:snapshot].fb_ancestors;
|
|
57
|
-
id<FBXCElementSnapshot> parentWindow = ancestors.count > 1 ? [ancestors objectAtIndex:ancestors.count - 2] : nil;
|
|
58
|
-
CGRect parentWindowFrame = nil == parentWindow ? snapshot.frame : parentWindow.frame;
|
|
59
|
-
if ((appFrame.size.height > appFrame.size.width && parentWindowFrame.size.height < parentWindowFrame.size.width) ||
|
|
60
|
-
(appFrame.size.height < appFrame.size.width && parentWindowFrame.size.height > parentWindowFrame.size.width)) {
|
|
61
|
-
/*
|
|
62
|
-
This is the indication of the fact that transformation is broken and coordinates should be
|
|
63
|
-
recalculated manually.
|
|
64
|
-
However, upside-down case cannot be covered this way, which is not important for Appium
|
|
65
|
-
*/
|
|
66
|
-
return FBInvertPointForApplication(hitPoint, appFrame.size, interfaceOrientation);
|
|
67
|
-
}
|
|
68
|
-
return hitPoint;
|
|
51
|
+
// For Xcode11+ it is always necessary to adjust the tap point coordinates
|
|
52
|
+
return FBInvertPointForApplication(hitPoint, self.application.frame.size, interfaceOrientation);
|
|
69
53
|
}
|
|
70
54
|
|
|
71
55
|
- (nullable NSValue *)hitpointWithElement:(nullable XCUIElement *)element positionOffset:(nullable NSValue *)positionOffset error:(NSError **)error
|
|
@@ -74,14 +58,12 @@
|
|
|
74
58
|
if (nil == element) {
|
|
75
59
|
// Only absolute offset is defined
|
|
76
60
|
hitPoint = [positionOffset CGPointValue];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
hitPoint = FBInvertPointForApplication(hitPoint, self.application.frame.size, self.application.interfaceOrientation);
|
|
84
|
-
}
|
|
61
|
+
/*
|
|
62
|
+
Since iOS 10.0 XCTest has a bug when it always returns portrait coordinates for UI elements
|
|
63
|
+
even if the device is not in portait mode. That is why we need to recalculate them manually
|
|
64
|
+
based on the current orientation value
|
|
65
|
+
*/
|
|
66
|
+
hitPoint = FBInvertPointForApplication(hitPoint, self.application.frame.size, self.application.interfaceOrientation);
|
|
85
67
|
} else {
|
|
86
68
|
// The offset relative to the element is defined
|
|
87
69
|
|
|
@@ -63,8 +63,7 @@
|
|
|
63
63
|
}];
|
|
64
64
|
XCUIElement *firstKey = [[app.keyboard descendantsMatchingType:XCUIElementTypeKey]
|
|
65
65
|
matchingPredicate:keySearchPredicate].allElementsBoundByIndex.firstObject;
|
|
66
|
-
return firstKey.exists
|
|
67
|
-
&& (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0") ? firstKey.hittable : firstKey.fb_isVisible);
|
|
66
|
+
return firstKey.exists && firstKey.hittable;
|
|
68
67
|
};
|
|
69
68
|
NSString* errMessage = @"The on-screen keyboard must be present to send keys";
|
|
70
69
|
if (timeout <= 0) {
|
|
@@ -22,17 +22,10 @@
|
|
|
22
22
|
|
|
23
23
|
+ (CGSize)statusBarSizeForApplication:(XCUIApplication *)application
|
|
24
24
|
{
|
|
25
|
-
XCUIApplication *app =
|
|
26
|
-
BOOL expectVisibleBar = YES;
|
|
27
|
-
|
|
25
|
+
XCUIApplication *app = FBApplication.fb_systemApplication;
|
|
28
26
|
// Since iOS 13 the status bar is no longer part of the application, it’s part of the SpringBoard
|
|
29
|
-
if (@available(iOS 13.0, *)) {
|
|
30
|
-
app = FBApplication.fb_systemApplication;
|
|
31
|
-
expectVisibleBar = NO;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
XCUIElement *mainStatusBar = app.statusBars.allElementsBoundByIndex.firstObject;
|
|
35
|
-
if (
|
|
28
|
+
if (nil == mainStatusBar) {
|
|
36
29
|
return CGSizeZero;
|
|
37
30
|
}
|
|
38
31
|
CGSize result = mainStatusBar.frame.size;
|
|
@@ -228,7 +228,6 @@ NSString *formatTimeInterval(NSTimeInterval interval) {
|
|
|
228
228
|
compressionQuality:(CGFloat)compressionQuality
|
|
229
229
|
error:(NSError **)error
|
|
230
230
|
{
|
|
231
|
-
// TODO: Use native accessors after we drop the support of Xcode 12.4 and below
|
|
232
231
|
Class imageEncodingClass = NSClassFromString(@"XCTImageEncoding");
|
|
233
232
|
if (nil == imageEncodingClass) {
|
|
234
233
|
[[[FBErrorBuilder builder]
|
|
@@ -297,9 +297,7 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
|
|
|
297
297
|
}
|
|
298
298
|
CGPoint recentPosition = self.previousItem.atPosition;
|
|
299
299
|
CGPoint offsetRelativeToRecentPosition = (nil == x && nil == y) ? CGPointMake(0.0, 0.0) : CGPointMake(x.floatValue, y.floatValue);
|
|
300
|
-
|
|
301
|
-
offsetRelativeToRecentPosition = FBInvertOffsetForOrientation(offsetRelativeToRecentPosition, self.application.interfaceOrientation);
|
|
302
|
-
}
|
|
300
|
+
offsetRelativeToRecentPosition = FBInvertOffsetForOrientation(offsetRelativeToRecentPosition, self.application.interfaceOrientation);
|
|
303
301
|
return [NSValue valueWithCGPoint:CGPointMake(recentPosition.x + offsetRelativeToRecentPosition.x, recentPosition.y + offsetRelativeToRecentPosition.y)];
|
|
304
302
|
}
|
|
305
303
|
|