Skip to content

Commit 930d4c7

Browse files
authored
add documentations (#410)
* add documentations * add xcuitest
1 parent e765d1f commit 930d4c7

File tree

4 files changed

+44
-16
lines changed

4 files changed

+44
-16
lines changed

docs/docs.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
#### Documentation
1+
### Documentation
22

33
- find_elements returns an empty array [] when no elements are found.
44
- button(int), textfield(int) use xpath so 1 is the first button, 2 the second etc. 0 is invalid.
55

6-
##### [app_lib on rubydoc.info](http://www.rubydoc.info/github/appium/ruby_lib/master/toplevel)
6+
#### [app_lib on rubydoc.info](http://www.rubydoc.info/github/appium/ruby_lib/master/toplevel)
7+
##### General
8+
- [Appium](https://github.com/appium/appium/blob/master/README.md)
9+
- [Ruby selenium-webdriver](https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings)
10+
- [All methods supported by Appium](https://github.com/appium/appium-base-driver/blob/master/docs/mjsonwp/protocol-methods.md)
11+
- [MiniTest Expectations](http://docs.seattlerb.org/minitest/Minitest/Expectations.html)
712

13+
##### iOS
814
- [iOS UI Automation](http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html) Example use `@driver.execute_script "UIATarget.localTarget().frontMostApp().mainWindow().rect()"
915
`
16+
- [mechanic names of elements](https://github.com/jaykz52/mechanic/blob/8c490e1d225f384847e47ffdafb47cc2248bb96c/src/mechanic-core.js#L28)
17+
- [WebDriverAgent](https://github.com/facebook/WebDriverAgent)
18+
19+
##### Android
1020
- [Android UIAutomator](http://developer.android.com/tools/help/uiautomator/index.html)
1121
- [UiSelector.java](https://android.googlesource.com/platform/frameworks/testing/+/master/uiautomator/library/core-src/com/android/uiautomator/core/UiSelector.java)
12-
- [Ruby selenium-webdriver](http://selenium.googlecode.com/svn/trunk/docs/api/rb/index.html)
13-
- [Appium](https://github.com/appium/appium/blob/master/README.md)
14-
- [Appium extension](https://github.com/appium/appium/wiki/Automating-mobile-gestures)
15-
- [mechanic names of elements](https://github.com/jaykz52/mechanic/blob/8c490e1d225f384847e47ffdafb47cc2248bb96c/src/mechanic-core.js#L28)
16-
- [All methods supported by Appium](https://github.com/appium/appium/wiki/JSON-Wire-Protocol:-Supported-Methods)
17-
- [Appium's mobile gesture docs](https://github.com/appium/appium/wiki/Automating-mobile-gestures)
18-
- [MiniTest Expectations](http://docs.seattlerb.org/minitest/Minitest/Expectations.html)
19-
2022

2123
--
2224

@@ -36,7 +38,7 @@ Example of automating the built in Android settings.
3638
```ruby
3739
# run Pry, and paste the following
3840
apk = {
39-
platformName: :android,
41+
platformName: 'android',
4042
deviceName: :nexus,
4143
appPackage: 'com.android.settings',
4244
appActivity: '.Settings',
@@ -49,7 +51,7 @@ Appium::Driver.new(caps: apk).start_driver
4951

5052
Example use of Appium's mobile gesture.
5153

52-
> @driver.execute_script 'mobile: tap', :x => 0, :y => 500
54+
> @driver.find_element()
5355
5456
`console.rb` uses some code from [simple_test.rb](
5557
https://github.com/appium/appium/blob/82995f47408530c80c3376f4e07a1f649d96ba22/sample-code/examples/ruby/simple_test.rb) and is released under the [same license](https://github.com/appium/appium/blob/c58eeb66f2d6fa3b9a89d188a2e657cca7cb300f/LICENSE) as Appium. The [Accessibility Inspector](https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/iPhoneAccessibility/Testing_Accessibility/Testing_Accessibility.html) is helpful for discovering button names and textfield values.
@@ -59,7 +61,7 @@ Long click on an ImageView in Android.
5961

6062
```
6163
last_image = find_elements(:tag_name, :ImageView).last
62-
mobile(:longClick, element: last_image.ref)
64+
long_press(element: last_image)
6365
```
6466

6567
Rotate examples.
@@ -216,7 +218,7 @@ au._returnElems(r);
216218
execute_script s
217219
```
218220

219-
#### XPath
221+
#### XPath(UIAutomation)
220222

221223
See [#194](https://github.com/appium/appium/pull/194/files) for details.
222224

@@ -304,7 +306,7 @@ mobile gestures on iOS are known to be crashy. Fix by adding pre/post event slee
304306

305307
```ruby
306308
sleep 3
307-
mobile :tap, x: 10, y: 100, duration: 0.5
309+
tap(x: 10, y: 100)
308310
sleep 1
309311
```
310312

docs/ios_xcuitest.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## XCUITest
2+
- Over Appium1.6.0 provides `XCUITest` automation name based on WebDriverAgent.
3+
- [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver)
4+
- [WebDriverAgent](https://github.com/facebook/WebDriverAgent)
5+
- How to migrate XCUITest from UIAutomation
6+
- [Migrating your iOS tests from UIAutomation](https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md)
7+
8+
9+
### Elements
10+
- supported elements by find_element is:
11+
- [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver/blob/master/lib/commands/find.js#L17)
12+
- [WebDriverAgent](https://github.com/facebook/WebDriverAgent/blob/8346199212bffceab24192e81bc0118d65132466/WebDriverAgentLib/Commands/FBFindElementCommands.m#L111)
13+
- Mapping
14+
- https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Utilities/FBElementTypeTransformer.m#L19
15+
16+
### XPath
17+
- It is better to avoid XPath strategy.
18+
- https://github.com/appium/appium/blob/v1.6.2/docs/en/advanced-concepts/migrating-to-xcuitest.md#xpath-locator-strategy
19+
> Try not to use XPath locators unless there is absolutely no other alternatives. In general, xpath locators might be times slower, than other types of locators like accessibility id, class name and predicate (up to 100 times slower in some special cases). They are so slow, because xpath location is not natively supported by Apple's XCTest framework.
20+
- Improved performance a bit
21+
- https://github.com/appium/appium/issues/6842
22+
- https://github.com/facebook/WebDriverAgent/issues/306
23+
- XPath in WebDriverAgent
24+
- https://github.com/facebook/WebDriverAgent/blob/2158a8d0f305549532f1338fe1e4628cfbd53cd9/WebDriverAgentLib/Categories/XCElementSnapshot%2BFBHelpers.m#L57
25+

lib/appium_lib/device/touch_actions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def swipe(opts, ele = nil)
149149
move_to x: start_x + delta_x, y: start_y + delta_y, element: ele
150150
release
151151
else
152-
press x: start_x, y: start_y, element: ele
152+
press x: start_x, y: start_y
153153
wait(duration) if duration
154154
move_to x: start_x + delta_x, y: start_y + delta_y
155155
release

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ gem install --no-rdoc --no-ri appium_lib
5454
- [Overview](https://github.com/appium/ruby_lib/blob/master/docs/docs.md)
5555
- [Ruby Android methods](https://github.com/appium/ruby_lib/blob/master/docs/android_docs.md)
5656
- [Ruby iOS methods](https://github.com/appium/ruby_lib/blob/master/docs/ios_docs.md)
57+
- [Tips for XCUITest for iOS](https://github.com/appium/ruby_lib/blob/master/docs/ios_xcuitest.md)
5758
- [Appium Server docs](https://github.com/appium/appium/tree/master/docs)
5859

5960
#### Logging

0 commit comments

Comments
 (0)