appium-webdriveragent 4.1.5 → 4.2.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/PrivateHeaders/XCTest/XCTestManager_ManagerInterface-Protocol.h +4 -2
- package/PrivateHeaders/XCTest/XCUIDevice.h +8 -1
- package/PrivateHeaders/XCTest/XCUIScreen.h +4 -3
- package/README.md +0 -1
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.h +15 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +17 -0
- package/WebDriverAgentLib/Commands/FBCustomCommands.m +20 -0
- package/WebDriverAgentLib/Utilities/FBMjpegServer.m +1 -1
- package/WebDriverAgentLib/Utilities/FBScreenshot.h +1 -1
- package/WebDriverAgentLib/Utilities/FBScreenshot.m +3 -3
- package/WebDriverAgentRunner-Runner.app.zip +0 -0
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceHelperTests.m +10 -0
- package/package.json +1 -1
|
@@ -42,8 +42,10 @@
|
|
|
42
42
|
- (void)_XCT_exchangeProtocolVersion:(unsigned long long)arg1 reply:(void (^)(unsigned long long))arg2;
|
|
43
43
|
|
|
44
44
|
// Available since Xcode9
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// The first screenID type changed from "unsigned int" to "long long" since Xcode 13.3 in XCTAutomationSupport.framework/XCTScreenshotRequest.h
|
|
46
|
+
// but this place is still "unsigned int" in the header. Appium/WDA changes to "long long" for Xcode 13.3 x iOS 15.4 environment.
|
|
47
|
+
- (void)_XCT_requestScreenshotOfScreenWithID:(long long)arg1 withRect:(struct CGRect)arg2 uti:(NSString *)arg3 compressionQuality:(double)arg4 withReply:(void (^)(NSData *, NSError *))arg5;
|
|
48
|
+
- (void)_XCT_requestScreenshotOfScreenWithID:(long long)arg1 withRect:(struct CGRect)arg2 withReply:(void (^)(NSData *, NSError *))arg3;
|
|
47
49
|
- (void)_XCT_requestSnapshotForElement:(XCAccessibilityElement *)arg1 attributes:(NSArray *)arg2 parameters:(NSDictionary *)arg3 reply:(void (^)(XCElementSnapshot *, NSError *))arg4;
|
|
48
50
|
|
|
49
51
|
// Available since Xcode 12.5. Required (!!!) to use since Xcode 13
|
|
@@ -11,9 +11,16 @@
|
|
|
11
11
|
// Since Xcode 10.2
|
|
12
12
|
@property (readonly) id accessibilityInterface; // implements XCUIAccessibilityInterface
|
|
13
13
|
@property (readonly) id eventSynthesizer; // implements XCUIEventSynthesizing
|
|
14
|
-
@property(readonly) id screenDataSource; // @synthesize screenDataSource=_screenDataSource;
|
|
14
|
+
@property (readonly) id screenDataSource; // @synthesize screenDataSource=_screenDataSource;
|
|
15
|
+
|
|
15
16
|
- (_Bool)performDeviceEvent:(id)arg1 error:(id *)arg2;
|
|
16
17
|
|
|
18
|
+
// Since Xcode 13
|
|
19
|
+
// 1 - Light
|
|
20
|
+
// 2 - Dark
|
|
21
|
+
- (void)setAppearanceMode:(long long)arg1;
|
|
22
|
+
- (long long)appearanceMode;
|
|
23
|
+
|
|
17
24
|
- (void)pressLockButton;
|
|
18
25
|
- (void)holdHomeButtonForDuration:(double)arg1;
|
|
19
26
|
- (void)_silentPressButton:(long long)arg1;
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
@interface XCUIScreen()
|
|
8
8
|
{
|
|
9
9
|
_Bool _isMainScreen;
|
|
10
|
-
|
|
10
|
+
long long _displayID;
|
|
11
11
|
}
|
|
12
12
|
@property(readonly) _Bool isMainScreen; // @synthesize isMainScreen=_isMainScreen;
|
|
13
|
-
@property(readonly)
|
|
13
|
+
@property(readonly) long long displayID; // @synthesize displayID=_displayID;
|
|
14
14
|
|
|
15
15
|
- (id)_clippedScreenshotData:(id)arg1 quality:(long long)arg2 rect:(struct CGRect)arg3 scale:(double)arg4;
|
|
16
16
|
- (id)_screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3;
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
- (id)screenshot;
|
|
21
21
|
- (id)_imageFromData:(id)arg1;
|
|
22
22
|
- (double)scale;
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
- (id)initWithDisplayID:(long long)arg1 isMainScreen:(_Bool)arg2 device:(id)arg3 screenDataSource:(id)arg4;
|
|
24
25
|
|
|
25
26
|
@end
|
|
26
27
|
|
package/README.md
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
NS_ASSUME_NONNULL_BEGIN
|
|
13
13
|
|
|
14
|
+
typedef NS_ENUM(NSUInteger, FBUIInterfaceAppearance) {
|
|
15
|
+
FBUIInterfaceAppearanceUnspecified,
|
|
16
|
+
FBUIInterfaceAppearanceLight,
|
|
17
|
+
FBUIInterfaceAppearanceDark
|
|
18
|
+
};
|
|
19
|
+
|
|
14
20
|
@interface XCUIDevice (FBHelpers)
|
|
15
21
|
|
|
16
22
|
/**
|
|
@@ -120,6 +126,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
120
126
|
duration:(NSTimeInterval)duration
|
|
121
127
|
error:(NSError **)error;
|
|
122
128
|
|
|
129
|
+
/**
|
|
130
|
+
Allows to set device appearance
|
|
131
|
+
|
|
132
|
+
@param appearance The desired appearance value
|
|
133
|
+
@param error If there is an error, upon return contains an NSError object that describes the problem.
|
|
134
|
+
@return YES if the appearance has been successfully set
|
|
135
|
+
*/
|
|
136
|
+
- (BOOL)fb_setAppearance:(FBUIInterfaceAppearance)appearance error:(NSError **)error;
|
|
137
|
+
|
|
123
138
|
@end
|
|
124
139
|
|
|
125
140
|
NS_ASSUME_NONNULL_END
|
|
@@ -309,4 +309,21 @@ static bool fb_isLocked;
|
|
|
309
309
|
return [self performDeviceEvent:event error:error];
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
- (BOOL)fb_setAppearance:(FBUIInterfaceAppearance)appearance error:(NSError **)error
|
|
313
|
+
{
|
|
314
|
+
SEL selector = NSSelectorFromString(@"setAppearanceMode:");
|
|
315
|
+
if (nil != selector && [self respondsToSelector:selector]) {
|
|
316
|
+
NSMethodSignature *signature = [self methodSignatureForSelector:selector];
|
|
317
|
+
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
|
318
|
+
[invocation setSelector:selector];
|
|
319
|
+
[invocation setTarget:self];
|
|
320
|
+
[invocation setArgument:&appearance atIndex:2];
|
|
321
|
+
[invocation invoke];
|
|
322
|
+
return YES;
|
|
323
|
+
}
|
|
324
|
+
return [[[FBErrorBuilder builder]
|
|
325
|
+
withDescriptionFormat:@"Current Xcode SDK does not support appearance changing"]
|
|
326
|
+
buildError:error];
|
|
327
|
+
}
|
|
328
|
+
|
|
312
329
|
@end
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
[[FBRoute GET:@"/wda/device/info"] respondWithTarget:self action:@selector(handleGetDeviceInfo:)],
|
|
64
64
|
[[FBRoute POST:@"/wda/resetAppAuth"] respondWithTarget:self action:@selector(handleResetAppAuth:)],
|
|
65
65
|
[[FBRoute GET:@"/wda/device/info"].withoutSession respondWithTarget:self action:@selector(handleGetDeviceInfo:)],
|
|
66
|
+
[[FBRoute POST:@"/wda/device/appearance"].withoutSession respondWithTarget:self action:@selector(handleSetDeviceAppearance:)],
|
|
66
67
|
[[FBRoute GET:@"/wda/device/location"] respondWithTarget:self action:@selector(handleGetLocation:)],
|
|
67
68
|
[[FBRoute GET:@"/wda/device/location"].withoutSession respondWithTarget:self action:@selector(handleGetLocation:)],
|
|
68
69
|
[[FBRoute OPTIONS:@"/*"].withoutSession respondWithTarget:self action:@selector(handlePingCommand:)],
|
|
@@ -369,6 +370,25 @@
|
|
|
369
370
|
return FBResponseWithOK();
|
|
370
371
|
}
|
|
371
372
|
|
|
373
|
+
+ (id<FBResponsePayload>)handleSetDeviceAppearance:(FBRouteRequest *)request
|
|
374
|
+
{
|
|
375
|
+
NSString *name = [request.arguments[@"name"] lowercaseString];
|
|
376
|
+
if (nil == name || !([name isEqualToString:@"light"] || [name isEqualToString:@"dark"])) {
|
|
377
|
+
NSString *message = @"The appearance name must be either 'light' or 'dark'";
|
|
378
|
+
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message traceback:nil]);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
FBUIInterfaceAppearance appearance = [name isEqualToString:@"light"]
|
|
382
|
+
? FBUIInterfaceAppearanceLight
|
|
383
|
+
: FBUIInterfaceAppearanceDark;
|
|
384
|
+
NSError *error;
|
|
385
|
+
if (![XCUIDevice.sharedDevice fb_setAppearance:appearance error:&error]) {
|
|
386
|
+
return FBResponseWithStatus([FBCommandStatus unknownErrorWithMessage:error.description
|
|
387
|
+
traceback:nil]);
|
|
388
|
+
}
|
|
389
|
+
return FBResponseWithOK();
|
|
390
|
+
}
|
|
391
|
+
|
|
372
392
|
+ (id<FBResponsePayload>)handleGetDeviceInfo:(FBRouteRequest *)request
|
|
373
393
|
{
|
|
374
394
|
// Returns locale like ja_EN and zh-Hant_US. The format depends on OS
|
|
@@ -33,7 +33,7 @@ static const char *QUEUE_NAME = "JPEG Screenshots Provider Queue";
|
|
|
33
33
|
@property (nonatomic, readonly) NSMutableArray<GCDAsyncSocket *> *listeningClients;
|
|
34
34
|
@property (nonatomic, readonly) mach_timebase_info_data_t timebaseInfo;
|
|
35
35
|
@property (nonatomic, readonly) FBImageIOScaler *imageScaler;
|
|
36
|
-
@property (nonatomic, readonly)
|
|
36
|
+
@property (nonatomic, readonly) long long mainScreenID;
|
|
37
37
|
|
|
38
38
|
@end
|
|
39
39
|
|
|
@@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
51
51
|
@param error If there is an error, upon return contains an NSError object that describes the problem.
|
|
52
52
|
@return Device screenshot as PNG- or JPG-encoded data or nil in case of failure
|
|
53
53
|
*/
|
|
54
|
-
+ (nullable NSData *)takeInOriginalResolutionWithScreenID:(
|
|
54
|
+
+ (nullable NSData *)takeInOriginalResolutionWithScreenID:(long long)screenID
|
|
55
55
|
compressionQuality:(CGFloat)compressionQuality
|
|
56
56
|
uti:(NSString *)uti
|
|
57
57
|
timeout:(NSTimeInterval)timeout
|
|
@@ -123,7 +123,7 @@ NSString *formatTimeInterval(NSTimeInterval interval) {
|
|
|
123
123
|
return screenshotData;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
+ (NSData *)takeWithScreenID:(
|
|
126
|
+
+ (NSData *)takeWithScreenID:(long long)screenID
|
|
127
127
|
scale:(CGFloat)scale
|
|
128
128
|
compressionQuality:(CGFloat)compressionQuality
|
|
129
129
|
rect:(CGRect)rect
|
|
@@ -146,7 +146,7 @@ NSString *formatTimeInterval(NSTimeInterval interval) {
|
|
|
146
146
|
error:error];
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
+ (NSData *)takeInOriginalResolutionWithScreenID:(
|
|
149
|
+
+ (NSData *)takeInOriginalResolutionWithScreenID:(long long)screenID
|
|
150
150
|
compressionQuality:(CGFloat)compressionQuality
|
|
151
151
|
uti:(NSString *)uti
|
|
152
152
|
timeout:(NSTimeInterval)timeout
|
|
@@ -254,7 +254,7 @@ NSString *formatTimeInterval(NSTimeInterval interval) {
|
|
|
254
254
|
return imageEncoding;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
+ (nullable id)screenshotRequestWithScreenID:(
|
|
257
|
+
+ (nullable id)screenshotRequestWithScreenID:(long long)screenID
|
|
258
258
|
rect:(struct CGRect)rect
|
|
259
259
|
uti:(NSString *)uti
|
|
260
260
|
compressionQuality:(CGFloat)compressionQuality
|
|
Binary file
|
|
@@ -156,4 +156,14 @@
|
|
|
156
156
|
XCTAssertNil(error);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
- (void)testAppearance
|
|
160
|
+
{
|
|
161
|
+
if (SYSTEM_VERSION_LESS_THAN(@"15.0")) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
NSError *error;
|
|
165
|
+
XCTAssertTrue([XCUIDevice.sharedDevice fb_setAppearance:FBUIInterfaceAppearanceDark error:&error]);
|
|
166
|
+
XCTAssertNil(error);
|
|
167
|
+
}
|
|
168
|
+
|
|
159
169
|
@end
|