Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOSAutomationAgent #1

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

iOSAutomationAgent #1

wants to merge 13 commits into from

Conversation

sapieneptus
Copy link

@sapieneptus sapieneptus commented Dec 18, 2016

Motivation:

  • To stop doing redundant work that FB has already done :/
  • To share more code between internal teams
  • To use the WebDriverAgent gesture implementations and general automation features, which now seem to be more up to date than ours.

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 and CBXUtilities). All of our DeviceAgent code has been ported with CBX 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, the XCUICoordinate class doesn't have API parity with the XCUIElement 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's fb_tapWithError: (i.e, using the XCEventGenerator 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 of 1.0/query internally. Is this supported publicly? Should it be? Can we refactor our tests not to use 1.0/query?

Next steps/TODO:

  • Implement rotate. It's not hard to do, just got lazy.
  • Testing
  • Refactor RunLoop to accept a test runner bundle_id to pass to iOSDeviceManager start_test (currently uses the iOSDeviceManager default, which is a mismatch)
  • Ensure UITest is compatible
  • Discuss 1.0/query
  • Build scripts, polish, etc...
  • Increment route version 1.0 -> 2.0
  • Rename to iOSAutomationAgent

@sapieneptus sapieneptus changed the title Feature/device agent iOSAutomationAgent Dec 18, 2016
@sapieneptus
Copy link
Author

@jmoody @john7doe Here are my changes for reference.

jmoody added a commit to calabash/run_loop that referenced this pull request Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant