Skip to content

Commit

Permalink
feat: Add a new endpoint for element rotation (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Sep 8, 2019
1 parent 174bc3b commit 9eb3210
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions WebDriverAgentLib/Commands/FBElementCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ + (NSArray *)routes
#else
[[FBRoute POST:@"/wda/element/:uuid/swipe"] respondWithTarget:self action:@selector(handleSwipe:)],
[[FBRoute POST:@"/wda/element/:uuid/pinch"] respondWithTarget:self action:@selector(handlePinch:)],
[[FBRoute POST:@"/wda/element/:uuid/rotate"] respondWithTarget:self action:@selector(handleRotate:)],
[[FBRoute POST:@"/wda/element/:uuid/doubleTap"] respondWithTarget:self action:@selector(handleDoubleTap:)],
[[FBRoute POST:@"/wda/element/:uuid/twoFingerTap"] respondWithTarget:self action:@selector(handleTwoFingerTap:)],
[[FBRoute POST:@"/wda/element/:uuid/touchAndHold"] respondWithTarget:self action:@selector(handleTouchAndHold:)],
Expand Down Expand Up @@ -488,6 +489,20 @@ + (NSArray *)routes
[element pinchWithScale:scale velocity:velocity];
return FBResponseWithOK();
}

+ (id<FBResponsePayload>)handleRotate:(FBRouteRequest *)request
{
FBElementCache *elementCache = request.session.elementCache;
XCUIElement *element = [elementCache elementForUUID:request.parameters[@"uuid"]];
if (nil == element) {
return FBResponseWithStatus([FBCommandStatus staleElementReferenceErrorWithMessage:nil
traceback:nil]);
}
CGFloat rotation = (CGFloat)[request.arguments[@"rotation"] doubleValue];
CGFloat velocity = (CGFloat)[request.arguments[@"velocity"] doubleValue];
[element rotate:rotation withVelocity:velocity];
return FBResponseWithOK();
}
#endif

+ (id<FBResponsePayload>)handleForceTouch:(FBRouteRequest *)request
Expand Down

0 comments on commit 9eb3210

Please sign in to comment.