Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Notes:
Code reuse
I tried as much as possible not to touch any existing FB code, except where some refactoring made it possible to share an implementation more easily. The result is very little code duplication internally, and a repo which is very easily compatible with facebook/WebDriverAgent upstream (as an interesting aside, this makes it possible to actually share WebDriver Protocol and DeviceAgent protocol, so we can get the best of both worlds).
The vast majority of the changes can be found in distinct folders (
CBXCommands
andCBXUtilities
). All of our DeviceAgent code has been ported withCBX
prefix so it's easy to tell.The largest challenge in reusing code is that for Appium we expect you have an element UUID before performing a gesture, which means we have a direct reference to an
XCUIElement *
and can just call its own native gesture methods. For DeviceAgent, we mostly just have coordinates. Unfortunately, theXCUICoordinate
class doesn't have API parity with theXCUIElement
class. To bridge this gap, I added a few methods, e.g.cbx_twoFingerTapAtCoordinate
,cbx_pinchAtCoordinate
, both of which share the same logic as FB'sfb_tapWithError:
(i.e, using theXCEventGenerator
APIs which allow for coordinate-based gestures).Compatibility
This repo should be usable for Appium tests exactly as though it were upstream facebook/WebDriverAgent. The only difference might be that the server port is now fixed (27753).
All DeviceAgent routes are implemented with the exception of 1.0/query and related general query routes. So it should be fully compatible with any test that doesn't make use of
1.0/query
(see below).1.0/Query
I have not implemented
1.0/query
. I originally thought it wasn't necessary, since I thought DeviceAgent queries were only used for SpringBoard alerts (which is implemented via GET 1.0/springboard-alert). However, when running our internal tests, I realized that we make heavy use of1.0/query
internally. Is this supported publicly? Should it be? Can we refactor our tests not to use1.0/query
?Next steps/TODO:
rotate
. It's not hard to do, just got lazy.iOSDeviceManager start_test
(currently uses theiOSDeviceManager
default, which is a mismatch)UITest
is compatible1.0/query
iOSAutomationAgent