Skip to content

Commit

Permalink
feat: Remove obsolete MJSONWP touch actions (#847)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The following REST endpoints have been removed, use W3C actions instead:
- /wda/touch/perform
- /wda/touch/multi/perform
  • Loading branch information
mykola-mokhnach authored Feb 12, 2024
1 parent 17b94de commit d77f640
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 1,269 deletions.
20 changes: 0 additions & 20 deletions WebDriverAgent.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

37 changes: 0 additions & 37 deletions WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,6 @@ NS_ASSUME_NONNULL_BEGIN

@interface XCUIApplication (FBTouchAction)

/**
Perform complex touch action in scope of the current application.
Touch actions are represented as lists of dictionaries with predefined sets of values and keys.
Each dictionary must contain 'action' key, which is one of the following:
- 'tap' to perform a single tap
- 'longPress' to perform long tap
- 'press' to perform press
- 'release' to release the finger
- 'moveTo' to move the virtual finger
- 'wait' to modify the duration of the preceeding action
- 'cancel' to cancel the preceeding action in the chain
Each dictionary can also contain 'options' key with additional parameters dictionary related to the appropriate action.
The following options are mandatory for 'tap', 'longPress', 'press' and 'moveTo' actions:
- 'x' the X coordinate of the action
- 'y' the Y coordinate of the action
- 'element' the corresponding element instance, for which the action is going to be performed
If only 'element' is set then hit point coordinates of this element will be used.
If only 'x' and 'y' are set then these will be considered as absolute coordinates.
If both 'element' and 'x'/'y' are set then these will act as relative element coordinates.
It is also mandatory, that 'release' and 'wait' actions are preceeded with at least one chain item, which contains absolute coordinates, like 'tap', 'press' or 'longPress'. Empty chains are not allowed.
The following additional options are available for different actions:
- 'tap': 'count' (defines count of taps to be performed in a row; 1 by default)
- 'longPress': 'duration' (number of milliseconds to hold/move the virtual finger; 500.0 ms by default)
- 'wait': 'ms' (number of milliseconds to wait for the preceeding action; 0.0 ms by default)
List of lists can be passed there is order to perform multi-finger touch action. Each single actions chain is going to be executed by a separate virtual finger in such case.
@param actions Either array of dictionaries, whose format is described above to peform single-finger touch action or array of array to perform multi-finger touch action.
@param elementCache Cached elements mapping for the currrent application. The method assumes all elements are already represented by their actual instances if nil value is set
@param error If there is an error, upon return contains an NSError object that describes the problem
@return YES If the touch action has been successfully performed without errors
*/
- (BOOL)fb_performAppiumTouchActions:(NSArray *)actions elementCache:(nullable FBElementCache *)elementCache error:(NSError * _Nullable*)error;

/**
Perform complex touch action in scope of the current application.
Expand Down
15 changes: 0 additions & 15 deletions WebDriverAgentLib/Categories/XCUIApplication+FBTouchAction.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#import "XCUIApplication+FBTouchAction.h"

#import "FBAppiumActionsSynthesizer.h"
#import "FBBaseActionsSynthesizer.h"
#import "FBConfiguration.h"
#import "FBExceptions.h"
Expand Down Expand Up @@ -54,20 +53,6 @@ - (BOOL)fb_performActionsWithSynthesizerType:(Class)synthesizerType
return [self fb_synthesizeEvent:eventRecord error:error];
}

- (BOOL)fb_performAppiumTouchActions:(NSArray *)actions
elementCache:(FBElementCache *)elementCache
error:(NSError **)error
{
if (![self fb_performActionsWithSynthesizerType:FBAppiumActionsSynthesizer.class
actions:actions
elementCache:elementCache
error:error]) {
return NO;
}
[self fb_waitUntilStableWithTimeout:FBConfiguration.animationCoolOffTimeout];
return YES;
}

- (BOOL)fb_performW3CActions:(NSArray *)actions
elementCache:(FBElementCache *)elementCache
error:(NSError **)error
Expand Down
13 changes: 0 additions & 13 deletions WebDriverAgentLib/Commands/FBTouchActionCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,12 @@ + (NSArray *)routes
{
return
@[
[[FBRoute POST:@"/wda/touch/perform"] respondWithTarget:self action:@selector(handlePerformAppiumTouchActions:)],
[[FBRoute POST:@"/wda/touch/multi/perform"] respondWithTarget:self action:@selector(handlePerformAppiumTouchActions:)],
[[FBRoute POST:@"/actions"] respondWithTarget:self action:@selector(handlePerformW3CTouchActions:)],
];
}

#pragma mark - Commands

+ (id<FBResponsePayload>)handlePerformAppiumTouchActions:(FBRouteRequest *)request
{
XCUIApplication *application = request.session.activeApplication;
NSArray *actions = (NSArray *)request.arguments[@"actions"];
NSError *error;
if (![application fb_performAppiumTouchActions:actions elementCache:request.session.elementCache error:&error]) {
return FBResponseWithUnknownError(error);
}
return FBResponseWithOK();
}

+ (id<FBResponsePayload>)handlePerformW3CTouchActions:(FBRouteRequest *)request
{
XCUIApplication *application = request.session.activeApplication;
Expand Down
20 changes: 0 additions & 20 deletions WebDriverAgentLib/Utilities/FBAppiumActionsSynthesizer.h

This file was deleted.

Loading

0 comments on commit d77f640

Please sign in to comment.