appium_console 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTM1OWIyZmQ4ZjA2OTYwYThkNGM5ODMzOTBhMGE4OTA3MWRjZjJjZA==
5
+ data.tar.gz: !binary |-
6
+ NTcyNTFlZGFjYjY3MGExMGQ5NmM3N2NkYjVkYjhlZmY2MzQ3M2E3Yw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZThjNWJhZjBkNjMzMDg2YTNkYmUzYmU4YTc4YTRiZjU1ZmQzMjdmYTIzOTY0
10
+ MDA3MDJkOGRiMTZkYzllZTE0ZmVhYjMzODcyODk5MzVhZWMzZTFmZThmY2Vj
11
+ N2VhYWY1NzcwYjA4MDkzNDk1N2E2MWI0YzQ4NWQyOTY4Y2E4MWY=
12
+ data.tar.gz: !binary |-
13
+ MzMyNTRkODA0MzQ0NWE5NzY1MWM1NWRiNDdjNmQxYTYwOGU2N2JlOWU0NDU2
14
+ MjczZDEwZWMwNDQ4YTlhNDAwZjcyYjg5ODVjN2NiODg2YjAxNTAwOWQ1Mzcw
15
+ MDAxZGRhNTUxNjE4YTUxYWM0N2EwZGVmMjcyZGQ2YzM3Y2Q3OTQ=
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,84 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+
5
+ # Defines gem name.
6
+ def repo_name; 'appium_console'; end
7
+ def version_file; "lib/#{repo_name}/version.rb"; end
8
+ def version_rgx; /VERSION = '([^']+)'/m; end
9
+
10
+ def version
11
+ @version = @version || File.read(version_file).match(version_rgx)[1]
12
+ end
13
+
14
+ def bump
15
+ data = File.read version_file
16
+
17
+ v_line = data.match version_rgx
18
+ d_line = data.match /DATE = '([^']+)'/m
19
+
20
+ old_v = v_line[0]
21
+ old_d = d_line[0]
22
+
23
+ old_num = v_line[1]
24
+ new_num = old_num.split('.')
25
+ new_num[-1] = new_num[-1].to_i + 1
26
+ new_num = new_num.join '.'
27
+
28
+ new_v = old_v.sub old_num, new_num
29
+ puts "#{old_num} -> #{new_num}"
30
+
31
+ old_date = d_line[1]
32
+ new_date = Date.today.to_s
33
+ new_d = old_d.sub old_date, new_date
34
+ puts "#{old_date} -> #{new_date}" unless old_date == new_date
35
+
36
+ data.sub! old_v, new_v
37
+ data.sub! old_d, new_d
38
+
39
+ File.write version_file, data
40
+ end
41
+
42
+ desc 'Bump the version number and update the date.'
43
+ task :bump do
44
+ bump
45
+ end
46
+
47
+ # Inspired by Gollum's Rakefile
48
+ desc 'Build and release a new gem to rubygems.org'
49
+ task :release => :gem do
50
+ unless `git branch`.include? '* master'
51
+ puts 'Master branch required to release.'
52
+ exit!
53
+ end
54
+
55
+ # Commit then pull before pushing.
56
+ sh "git commit --allow-empty -am 'Release #{version}'"
57
+ sh 'git pull'
58
+ sh "git tag v#{version}"
59
+ sh 'git push origin master'
60
+ sh "git push origin v#{version}"
61
+ sh "gem push #{repo_name}-#{version}.gem"
62
+ end
63
+
64
+ desc 'Build and release a new gem to rubygems.org (same as release)'
65
+ task :publish => :release do
66
+ end
67
+
68
+ desc 'Build a new gem'
69
+ task :gem do
70
+ `chmod 0600 ~/.gem/credentials`
71
+ sh "gem build #{repo_name}.gemspec"
72
+ end
73
+
74
+ desc 'Build a new gem (same as gem task)'
75
+ task :build => :gem do
76
+ end
77
+
78
+ desc 'Install gem'
79
+ task :install => :gem do
80
+ `gem uninstall -aIx #{repo_name}`
81
+ # Ensure we have the latest app_lib
82
+ `gem uninstall -aIx app_lib`
83
+ sh "gem install --no-rdoc --no-ri #{repo_name}-#{version}.gem"
84
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ def self.add_to_path path
4
+ path = File.expand_path "../#{path}/", __FILE__
5
+
6
+ $:.unshift path unless $:.include? path
7
+ end
8
+
9
+ add_to_path 'lib'
10
+
11
+ require 'appium_console/version'
12
+
13
+ Gem::Specification.new do |s|
14
+ # 1.8.x is not supported
15
+ s.required_ruby_version = '>= 1.9.3'
16
+
17
+ s.name = 'appium_console'
18
+ s.version = AppiumConsole::VERSION
19
+ s.date = AppiumConsole::DATE
20
+ s.license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
21
+ s.description = s.summary = 'Ruby console for use with Appium'
22
+ s.description += '.' # avoid identical warning
23
+ s.authors = s.email = [ 'code@bootstraponline.com' ]
24
+ s.homepage = 'https://github.com/appium/ruby_console' # published as appium_console
25
+ s.require_paths = [ 'lib' ]
26
+
27
+ # app_lib version must match ruby console version.
28
+ s.add_runtime_dependency 'appium_lib', ">= #{AppiumConsole::VERSION}"
29
+ s.add_runtime_dependency 'pry', '~> 0.9.12'
30
+
31
+ # Why are these required?
32
+ # WARN: Unresolved specs during Gem::Specification.reset:
33
+ # multi_json (~> 1.0)
34
+ # ffi (>= 1.0.6, ~> 1.0)
35
+ s.add_runtime_dependency 'multi_json', '~> 1.7.1'
36
+ s.add_runtime_dependency 'ffi', '~> 1.5.0'
37
+
38
+ s.add_development_dependency 'rake', '~> 10.0.3'
39
+
40
+ s.executables = [ 'arc' ]
41
+ s.files = `git ls-files`.split "\n"
42
+ end
data/bin/arc ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # appium ruby console = arc
3
+ require 'rubygems'
4
+ require 'appium_console'
data/docs.md ADDED
@@ -0,0 +1,44 @@
1
+ Automatically convert yard's HTML output to Markdown. Run in Chrome Dev Tools console.
2
+
3
+ ```javascript
4
+ // http://localhost:8808/docs/toplevel
5
+
6
+ var methods = $x('//*[@id="content"]/ul/li');
7
+
8
+ var sig = function(method) { return method.children[0].children[0].textContent.trim().substr(2); };
9
+ var desc = function(method) { return method.children[1].children[0].textContent.trim(); };
10
+
11
+ // All element methods must include the element name.
12
+ // Check textfield before text because text is included in textfield.
13
+ var elements = [ 'alert', 'button', 'textfield', 'text', 'window' ];
14
+ var output = {};
15
+
16
+ for (var b = 0; b < elements.length; b++) {
17
+ output[elements[b]] = [];
18
+ }
19
+
20
+ for (var a = 0; a < methods.length; a++) {
21
+ var name = sig(methods[a]);
22
+ var text = desc(methods[a]);
23
+ var index = '';
24
+
25
+ for (var b = 0; b < elements.length; b++) {
26
+ if (name.indexOf(elements[b]) !== -1 && name.indexOf('find_ele') === -1) {
27
+ index = elements[b];
28
+ break;
29
+ }
30
+ }
31
+
32
+ if (index === '') { continue; }
33
+ output[index].push( [name, text] );
34
+ }
35
+
36
+ for (var b = 0; b < elements.length; b++) {
37
+ var eles = output[elements[b]];
38
+ console.log("\n" + '#### ' + elements[b]);
39
+ for (var c = 0; c < eles.length; c++) {
40
+ var ele = eles[c];
41
+ console.log('0. `' + ele[0] + '` ' + ele[1]);
42
+ }
43
+ }
44
+ ```
Binary file
Binary file
Binary file
@@ -0,0 +1,39 @@
1
+ #### Notes on iOS and Android Appium compatibility
2
+
3
+
4
+ #### iPhone vs iPad
5
+
6
+ iPad will contain elements from visible background screens. iPhone will have only one screen, however the keyboard can only be dismissed by clicking somewhere.
7
+ The iPad has a hide keyboard button. The iPhone will use `Next` and `Go` on a typical login screen via the on screen keyboard.
8
+
9
+ - setValue will immediately set the value
10
+ - hideKeyboard will attempt to hide the iPad keyboard and fail on iPhone
11
+ - find_element(:tag_name, :window).click should work everywhere
12
+
13
+ ##### Tag Names
14
+
15
+ `secure` is not possible to implement on Android using uiautomator. `textfield` and `secure` are both considered `edittext`.
16
+
17
+ `textfield` returns all textfields, including secure on Android. `secure` will error on Android.
18
+ on iOS `textfield` will not match secure text fields.
19
+
20
+ ##### Search strategy
21
+
22
+ Android
23
+
24
+ - `android:id` is not accessible via uiautomator
25
+ - `name` content description (defined in activity XML or dynamically)
26
+ - `text` text content of the UI widget
27
+ - `tag_name` the android class
28
+
29
+ `text` is [not a selenium search strategy](https://github.com/appium/appium/issues/241#issuecomment-14582659) so use XPath.
30
+
31
+ `secure` on iOS will return value.
32
+
33
+ `EditText` used as password field on Andorid will always return an empty string.
34
+
35
+ --
36
+
37
+ iOS .name returns the [accessibility attribute](http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Reference/UIAElementClassReference/UIAElement/UIAElement.html#//apple_ref/javascript/instm/UIAElement/name) if it's set. if not set, the string value is used.
38
+
39
+ Android .name returns the accessibility attribute and nothing if it's not set.
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'pry'
4
+ require 'appium_lib'
5
+
6
+ start = File.expand_path "../start.rb", __FILE__
7
+ cmd = ['-r', start]
8
+ $stdout.puts 'pry ' + cmd.join(' ')
9
+ Pry::CLI.parse_options cmd
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ module AppiumConsole
3
+ VERSION = '0.0.21' unless defined? ::AppiumConsole::VERSION
4
+ DATE = '2013-03-22' unless defined? ::AppiumConsole::DATE
5
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'appium_lib'
5
+
6
+ # Setup driver
7
+ start_driver if $driver.nil?
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+ #
3
+ # run with
4
+ # ruby my_test.rb
5
+ #
6
+ # Example use of running a test standalone. Useful for debugging a single test.
7
+
8
+ require 'rubygems'
9
+ require 'app_lib'
10
+
11
+ def sign_in
12
+ button('Sign In').click
13
+ end
14
+
15
+ start_driver
16
+
17
+ sign_in
18
+
19
+ # Quit
20
+ x
data/osx.md ADDED
@@ -0,0 +1,84 @@
1
+ #### Getting Started
2
+
3
+ This document is written for OS X. Appium does not yet work on Windows.
4
+ Appium Android should run on Linux however iOS testing requires OS X.
5
+
6
+ - Clone appium_console
7
+
8
+ `$ git clone git://github.com/appium/ruby_console.git`
9
+
10
+ - Ensure you have Ruby 1.9.3+ (1.8 is not supported). If you don't have 1.9.3+, install it with rvm.
11
+
12
+ `$ ruby --version`
13
+
14
+ - Install appium_console gem.
15
+
16
+ `gem install appium_console`
17
+
18
+ - Export APP_PATH, APP_PACKAGE, APP_ACTIVITY
19
+
20
+ ```
21
+ export APP_PATH="`pwd`/my.apk" ;\
22
+ export APP_PACKAGE="com.my.Pkg" ;\
23
+ export APP_ACTIVITY="MyActivity"
24
+ ```
25
+
26
+ - Echo the values to make sure they're set correctly
27
+
28
+ `$ echo $APP_PATH $APP_PACKAGE $APP_ACTIVITY`
29
+
30
+ - Install [nodejs](http://nodejs.org/)
31
+
32
+ `$ node --version`
33
+
34
+ `$ npm --version`
35
+
36
+ - Install grunt.
37
+
38
+ ` sudo npm install -g grunt grunt-cli`
39
+
40
+ ```bash
41
+ $ grunt --version
42
+ grunt-cli v0.1.6
43
+ grunt v0.4.1
44
+ ```
45
+
46
+ - Clone appium
47
+
48
+ `$ git clone git@github.com:appium/appium.git`
49
+
50
+ - Run reset.sh. You may have to run this twice as described below due to permission issues.
51
+
52
+ `cd appium; sudo ./reset.sh; ./reset.sh`
53
+
54
+ - Start appium. `-V` enables verbose and `--fast-reset` enables fast rest for Android.
55
+
56
+ `node server.js -V --fast-reset`
57
+
58
+ - Install dmg [hax module](http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager). See the [install guide](http://software.intel.com/en-us/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-macosx).
59
+ - [Direct link to hax module dmg](http://software.intel.com/sites/default/files/article/184952/intelhaxm-1.0.4-hotfix-androidonmac.zip)
60
+
61
+ - Use intel [system image](http://software.intel.com/en-us/articles/android-4-2-jelly-bean-x86-emulator-system-image) at least API 17 (Jelly Bean)
62
+
63
+ - Install using Android package tool. For API 17, install `SDK Platform`, `Intel x86 Atom System Image`, `Google APIs` as in the picture.
64
+ If there are any problems viewing or downloading the packages, go to `Packages -> Reload` and try again.
65
+
66
+ `android`
67
+
68
+ ![](img/packages.png)
69
+
70
+ - Create a new Android virtual device that uses the Intel image.
71
+
72
+ `android avd`
73
+
74
+ ![](img/avd_settings.png)
75
+
76
+ - Check that `hax is working`
77
+
78
+ ![](img/hax.png)
79
+
80
+ - After launching the emulator, check that it's listed in adb devices. Run the following commands a few times until it's listed.
81
+
82
+ `adb kill-server; adb devices`
83
+
84
+ If you see `error: protocol fault (no status)` just keep running the command until the emulator is detected.
@@ -0,0 +1,283 @@
1
+ #### Ruby Console for Appium [![Dependency Status](https://gemnasium.com/appium/ruby_console.png)](https://gemnasium.com/appium/ruby_console)
2
+
3
+ - [appium_console on RubyGems](https://rubygems.org/gems/appium_console)
4
+
5
+ #### Update system
6
+
7
+ Paste the following into Terminal. If you're not using [RVM](https://rvm.io/), you may have to prefix gem commands with sudo.
8
+
9
+ ```bash
10
+ gem update --system ;\
11
+ gem update bundler
12
+ ```
13
+
14
+ #### Install / Upgrade Ruby Console
15
+
16
+ ```bash
17
+ gem uninstall -aIx appium_lib ;\
18
+ gem uninstall -aIx appium_console ;\
19
+ gem install --no-rdoc --no-ri appium_console
20
+ ```
21
+
22
+ #### Update Appium
23
+
24
+ To update `appium` from source (assuming node.js requires sudo):
25
+
26
+ Clone appium if you haven't already.
27
+
28
+ `git clone git@github.com:appium/appium.git`
29
+
30
+ then in the `appium` folder:
31
+
32
+ ```bash
33
+ git pull ;\
34
+ sudo ./reset.sh ; ./reset.sh
35
+ ```
36
+
37
+ You should uninstall the `ap` gem because it breaks awesome_print.
38
+
39
+ `gem uninstall -aIx ap`
40
+
41
+ #### Run
42
+
43
+ The `arc` command starts Appium Ruby Console.
44
+
45
+ Ruby 1.9.3 and Appium from GitHub are required. Run Appium from source.
46
+
47
+ `node server.js -V --fast-reset`
48
+
49
+ For OS X, export the path to your .app bundle `MyApp.app` or zipped app bundle `MyApp.app.zip`
50
+
51
+ `export APP_PATH="../MyApp.app"`
52
+
53
+ For Android:
54
+
55
+ ```
56
+ export APP_PATH="/path/to/my.apk" ;\
57
+ export APP_PACKAGE="com.my.Pkg" ;\
58
+ export APP_ACTIVITY="MyActivity"
59
+ ```
60
+
61
+ You may want to define the environment variables in `~/.bash_profile` so you don't have to export them again.
62
+
63
+ #### Reset Appium
64
+
65
+ Reset Appium after pulling the latest changes.
66
+
67
+ `$ ./reset.sh`
68
+
69
+ #### Documentation
70
+
71
+ - find_elements returns an empty array [] when no elements are found.
72
+
73
+ ##### [app_lib on rubydoc.info](http://www.rubydoc.info/github/appium/ruby_lib/master/toplevel)
74
+
75
+ - [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()"
76
+ `
77
+ - [Android UIAutomator](http://developer.android.com/tools/help/uiautomator/index.html)
78
+ - [Ruby selenium-webdriver](http://selenium.googlecode.com/svn/trunk/docs/api/rb/index.html)
79
+ - [Appium](https://github.com/appium/appium/blob/master/README.md)
80
+ - [Appium extension](https://github.com/appium/appium/wiki/Automating-mobile-gestures)
81
+ - [mechanic names of elements](https://github.com/jaykz52/mechanic/blob/8c490e1d225f384847e47ffdafb47cc2248bb96c/src/mechanic-core.js#L28)
82
+ - [All methods supported by Appium](https://github.com/appium/appium/wiki/JSON-Wire-Protocol:-Supported-Methods)
83
+ - [Appium's mobile gesture docs](https://github.com/appium/appium/wiki/Automating-mobile-gestures)
84
+ -
85
+ Example use of Appium's mobile gesture.
86
+
87
+ > @driver.execute_script 'mobile: tap', :x => 0, :y => 500
88
+
89
+ `console.rb` uses some code from [simple_test.rb](
90
+ 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.
91
+
92
+ --
93
+
94
+ Tag Name | UIA
95
+ --:|:--
96
+ button | UIAButton
97
+ textfield | UIATextField
98
+ secure | UIASecureTextField
99
+ text | UIAStaticText
100
+
101
+
102
+ --
103
+
104
+ - `source` Prints a JSON view of the current page.
105
+
106
+ --
107
+
108
+ #### alert
109
+ 0. `(void) alert_accept` Accept the alert.
110
+ 0. `(String) alert_accept_text` Get the text of the alert's accept button.
111
+ 0. `(void) alert_click(value)` iOS only Tap the alert button identified by value.
112
+ 0. `(void) alert_dismiss` Dismiss the alert.
113
+ 0. `(String) alert_dismiss_text` Get the text of the alert's dismiss button.
114
+ 0. `(String) alert_text` Get the alert message text.
115
+
116
+ #### button
117
+ 0. `(Button) button(index)` Find a button by index.
118
+ 0. `(Button) button(text, number = 0)` Find a button by text and optionally number.
119
+ 0. `(Button) button_include(text)` Get the first button that includes text.
120
+ 0. `(Array<String>, Array<Buttons>) buttons(text = nil)` Get an array of button texts or button elements if text is provided.
121
+ 0. `(Array<Button>) buttons_include(text)` Get all buttons that include text.
122
+ 0. `(Button) first_button` Get the first button element.
123
+ 0. `(Button) last_button` Get the last button element.
124
+
125
+ #### textfield
126
+ 0. `(Textfield) textfield(index)` Find a textfield by index.
127
+ 0. `(Array<Textfield>) e_textfields` Get an array of textfield elements.
128
+ 0. `(Textfield) first_textfield` Get the first textfield element.
129
+ 0. `(Textfield) last_textfield` Get the last textfield element.
130
+ 0. `(Textfield) textfield(text)` Get the first textfield that matches text.
131
+ 0. `(Textfield) textfield_include(text)` Get the first textfield that includes text.
132
+ 0. `(Array<String>) textfields` Get an array of textfield texts.
133
+
134
+ #### text
135
+ 0. `(Text) text(index)` Find a text by index.
136
+ 0. `(Array<Text>) e_texts` Get an array of text elements.
137
+ 0. `(Text) first_text` Get the first text element.
138
+ 0. `(Text) last_text` Get the last text element.
139
+ 0. `(Text) text(text)` Get the first element that matches text.
140
+ 0. `(Text) text_include(text)` Get the first textfield that includes text.
141
+ 0. `(Array<String>) texts` Get an array of text texts.
142
+
143
+ #### window
144
+ 0. `(Object) window_size` Get the window's size.
145
+
146
+ --
147
+
148
+ ```ruby
149
+ e.name # button, text
150
+ e.value # secure, textfield
151
+ e.type
152
+ e.tag_name # calls .type (patch.rb)
153
+ e.text
154
+ e.size
155
+ e.location
156
+ e.rel_location
157
+ e.click
158
+ e.send_keys 'keys to send'
159
+ e.set_value 'value to set' # ruby_console specific
160
+
161
+ # alert example without helper methods
162
+ alert = $driver.switch_to.alert
163
+ alert.text
164
+ alert.accept
165
+ alert.dismiss
166
+
167
+ # Secure textfield example.
168
+ #
169
+ # Find using default value
170
+ s = secure 'Password'
171
+ # Enter password
172
+ s.send_keys 'hello'
173
+ # Check value
174
+ s.value == password('hello'.length)
175
+ ```
176
+
177
+ [routing.js](https://github.com/appium/appium/blob/master/app/routing.js#L69) lists not yet implemented end points.
178
+
179
+ --
180
+
181
+ #### Driver
182
+
183
+ `start_driver` will restart the driver.
184
+
185
+ `x` will quit the driver and exit Pry.
186
+
187
+ `execute_script` calls `$driver.execute_script`
188
+
189
+ `find_element` calls `$driver.find_element`
190
+
191
+ `find_elements` calls `$driver.find_elements`
192
+
193
+ `mobile :swipe, endX: 100, endY: 100, duration: 0.01` calls `$driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01`
194
+
195
+ `no_wait` will set implicit wait to 0. `$driver.manage.timeouts.implicit_wait = 0`
196
+
197
+ `set_wait` will set implicit wait to default 30 seconds. `$driver.manage.timeouts.implicit_wait = 30`
198
+
199
+ `set_wait(timeout_seconds)` will set implicit wait to desired timeout. `$driver.manage.timeouts.implicit_wait = timeout`
200
+
201
+ .click to tap an element.
202
+ .send_keys to type on an element.
203
+
204
+ #### Raw UIAutomation
205
+
206
+ `execute_script "au.lookup('button')[0].tap()"` is the same as
207
+ `execute_script 'UIATarget.localTarget().frontMostApp().buttons()[0].tap()'`
208
+
209
+ See [app.js](https://github.com/appium/appium/blob/master/app/uiauto/appium/app.js#L3) for more au methods.
210
+ Note that raw UIAutomation commands are not offically supported.
211
+
212
+ Advanced au.
213
+
214
+ In this example we lookup two tags, combine the results, wrap with $, and then return the elements.
215
+
216
+ ```ruby
217
+ s = %(
218
+ var t = au.lookup('textfield');
219
+ var s = au.lookup('secure');
220
+ var r = $(t.concat(s));
221
+ au._returnElems(r);
222
+ )
223
+
224
+ execute_script s
225
+ ```
226
+
227
+ #### XPath
228
+
229
+ See [#194](https://github.com/appium/appium/pull/194/files) for details.
230
+
231
+ ```ruby
232
+ find_element :xpath, 'button'
233
+ find_elements :xpath, 'button'
234
+
235
+ find_element :xpath, 'button[@name="Sign In"]'
236
+ find_elements :xpath, 'button[@name="Sign In"]'
237
+
238
+ find_element :xpath, 'button[contains(@name, "Sign In")]'
239
+ find_elements :xpath, 'button[contains(@name, "Sign")]'
240
+
241
+ find_element :xpath, 'textfield[@value="Email"]'
242
+ find_element :xpath, 'textfield[contains(@value, "Email")]'
243
+
244
+ find_element :xpath, 'text[contains(@name, "Reset")]'
245
+ find_elements :xpath, 'text[contains(@name, "agree")]'
246
+ ```
247
+
248
+ #### Cucumber Sauce Integration
249
+
250
+ Reset after each test and when done report the result to Sauce after quiting the driver.
251
+
252
+ ```ruby
253
+ require 'rest_client' # https://github.com/archiloque/rest-client
254
+ require 'json' # for .to_json
255
+
256
+ $passed = true
257
+
258
+ After do |scenario|
259
+ $driver.execute_script 'mobile: reset'
260
+
261
+ if $passed
262
+ $passed = false if scenario.failed?
263
+ end
264
+ end
265
+
266
+ at_exit do
267
+ ID = $driver.send(:bridge).session_id
268
+ $driver.quit
269
+
270
+ if !SAUCE_USERNAME.nil? && !SAUCE_ACCESS_KEY.nil?
271
+ URL = "https://#{SAUCE_USERNAME}:#{SAUCE_ACCESS_KEY}@saucelabs.com/rest/v1/#{SAUCE_USERNAME}/jobs/#{ID}"
272
+
273
+ # Keep trying until passed is set correctly. Give up after 30 seconds.
274
+ wait do
275
+ response = RestClient.put URL, { 'passed' => $passed }.to_json, :content_type => :json, :accept => :json
276
+ response = JSON.parse(response)
277
+
278
+ # Check that the server responded with the right value.
279
+ response['passed'] == $passed
280
+ end
281
+ end
282
+ end
283
+ ```
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appium_console
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.21
5
+ platform: ruby
6
+ authors:
7
+ - code@bootstraponline.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appium_lib
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.21
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.21
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.12
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.12
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.7.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.7.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: ffi
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 10.0.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 10.0.3
83
+ description: Ruby console for use with Appium.
84
+ email:
85
+ - code@bootstraponline.com
86
+ executables:
87
+ - arc
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE-2.0.txt
94
+ - Rakefile
95
+ - appium_console.gemspec
96
+ - bin/arc
97
+ - docs.md
98
+ - img/avd_settings.png
99
+ - img/hax.png
100
+ - img/packages.png
101
+ - ios_v_android.md
102
+ - lib/appium_console.rb
103
+ - lib/appium_console/version.rb
104
+ - lib/start.rb
105
+ - my_test.rb
106
+ - osx.md
107
+ - readme.md
108
+ homepage: https://github.com/appium/ruby_console
109
+ licenses:
110
+ - http://www.apache.org/licenses/LICENSE-2.0.txt
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: 1.9.3
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.0.3
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Ruby console for use with Appium
132
+ test_files: []