appium_console 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Rakefile +47 -3
- data/appium_console.gemspec +1 -1
- data/bin/arc +45 -0
- data/lib/appium_console/version.rb +2 -2
- data/lib/appium_console.rb +34 -1
- data/osx.md +13 -23
- data/readme.md +8 -220
- data/release_notes.md +1 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjM2M2FjYmM5YWU0ZjgyM2FjNjI2OTI5YmQ2YjhmMGYxYWY0M2I1NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWJhZDhiODkyNGMzMDUwMjFmNGY2YmVkOTZjY2JlMmI1ZTljZGQ2Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmEwY2ZhOTc0M2YxZDNlNjg0NDQ2NzA2YzI5ZDI1ZjBiZDk5NjI2MjU2ZmIx
|
10
|
+
NDRjYWJkZTQ5MTAyMjdiYmZiYzhkMTNkYzc5N2MwNzdhYTVmYzlhMmUwMGNi
|
11
|
+
NjVkMDk0ZGMxOGMzZGM5ZjA4YjNkOWEzZmRlYzg4NjExZjAyNzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDAwMDYwNzg4NGIwNDUyZTY1NWFjYjJhYzc5OTE5NTMyYWRhMDc4MjUxNThi
|
14
|
+
ODUxMzk3YThjMjI2ZWFiMWFjYzdmNWI2YzBlYWQ1MTFkODg3M2U0MDAwMDFl
|
15
|
+
MDA0ZWEzY2ZkZDE2ZmNkMGE2ZDc5MmIxMTlkNjkzN2IyNmM5NTM=
|
data/Rakefile
CHANGED
@@ -3,7 +3,8 @@ require 'rake'
|
|
3
3
|
require 'date'
|
4
4
|
|
5
5
|
# Defines gem name.
|
6
|
-
def repo_name; 'appium_console'; end
|
6
|
+
def repo_name; 'appium_console'; end # ruby_console published as appium_console
|
7
|
+
def gh_name; 'ruby_console'; end # the name as used on github.com
|
7
8
|
def version_file; "lib/#{repo_name}/version.rb"; end
|
8
9
|
def version_rgx; /VERSION = '([^']+)'/m; end
|
9
10
|
|
@@ -56,6 +57,9 @@ task :release => :gem do
|
|
56
57
|
sh "git commit --allow-empty -am 'Release #{version}'"
|
57
58
|
sh 'git pull'
|
58
59
|
sh "git tag v#{version}"
|
60
|
+
# update notes now that there's a new tag
|
61
|
+
Rake::Task['notes'].execute
|
62
|
+
sh "git commit --allow-empty -am 'Update release notes'"
|
59
63
|
sh 'git push origin master'
|
60
64
|
sh "git push origin v#{version}"
|
61
65
|
sh "gem push #{repo_name}-#{version}.gem"
|
@@ -78,7 +82,47 @@ end
|
|
78
82
|
desc 'Install gem'
|
79
83
|
task :install => :gem do
|
80
84
|
`gem uninstall -aIx #{repo_name}`
|
81
|
-
# Ensure we have the latest
|
82
|
-
`gem uninstall -aIx
|
85
|
+
# Ensure we have the latest appium_lib
|
86
|
+
`gem uninstall -aIx appium_lib`
|
83
87
|
sh "gem install --no-rdoc --no-ri #{repo_name}-#{version}.gem"
|
84
88
|
end
|
89
|
+
|
90
|
+
desc 'Update release notes'
|
91
|
+
task :notes do
|
92
|
+
tags = `git tag`.split "\n"
|
93
|
+
pairs = []
|
94
|
+
tags.each_index { |a| pairs.push tags[a] + '...' + tags[a+1] unless tags[a+1].nil? }
|
95
|
+
|
96
|
+
notes = ''
|
97
|
+
|
98
|
+
dates = `git log --tags --simplify-by-decoration --pretty="format:%d %ad" --date=short`.split "\n"
|
99
|
+
pairs.reverse! # pairs are in reverse order.
|
100
|
+
|
101
|
+
tag_date = []
|
102
|
+
pairs.each do |pair|
|
103
|
+
tag = pair.split('...').last
|
104
|
+
dates.each do |line|
|
105
|
+
# regular tag, or tag on master.
|
106
|
+
if line.include?('(' + tag + ')') || line.include?(tag + ',')
|
107
|
+
tag_date.push tag + ' ' + line.match(/\d{4}-\d{2}-\d{2}/)[0]
|
108
|
+
break
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
pairs.each_index do |a|
|
114
|
+
data =`git log --pretty=oneline #{pairs[a]}`
|
115
|
+
new_data = ''
|
116
|
+
data.split("\n").each do |line|
|
117
|
+
hex = line.match(/[a-zA-Z0-9]+/)[0];
|
118
|
+
# use first 7 chars to match GitHub
|
119
|
+
new_data += "- [#{hex[0...7]}](https://github.com/appium/#{gh_name}/commit/#{hex}) #{line.gsub(hex, '').strip}\n"
|
120
|
+
end
|
121
|
+
data = new_data + "\n"
|
122
|
+
|
123
|
+
# last pair is the released version.
|
124
|
+
notes += "#### #{tag_date[a]}\n\n" + data + "\n"
|
125
|
+
end
|
126
|
+
|
127
|
+
File.open('release_notes.md', 'w') { |f| f.write notes.to_s.strip }
|
128
|
+
end
|
data/appium_console.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
# appium_lib version must match ruby console version.
|
28
28
|
s.add_runtime_dependency 'appium_lib', ">= #{AppiumConsole::VERSION}"
|
29
29
|
s.add_runtime_dependency 'pry', '~> 0.9.12'
|
30
|
-
|
30
|
+
s.add_runtime_dependency 'toml', '~> 0.0.4'
|
31
31
|
s.add_development_dependency 'rake', '~> 10.0.3'
|
32
32
|
|
33
33
|
s.executables = [ 'arc' ]
|
data/bin/arc
CHANGED
@@ -1,4 +1,49 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# appium ruby console = arc
|
3
3
|
require 'rubygems'
|
4
|
+
|
5
|
+
def print_version
|
6
|
+
require 'appium_console/version'
|
7
|
+
require 'appium_lib/version'
|
8
|
+
puts "appium_console: v#{::AppiumConsole::VERSION}"
|
9
|
+
puts " appium_lib: v#{::AppiumLib::VERSION}"
|
10
|
+
end
|
11
|
+
|
12
|
+
ARGV.each_index do |idx|
|
13
|
+
a = ARGV[idx]
|
14
|
+
b = ARGV[idx + 1]
|
15
|
+
if a.match /-?-?v/i
|
16
|
+
print_version
|
17
|
+
exit
|
18
|
+
elsif a.match /upgrade/i
|
19
|
+
[ 'gem uninstall -aIx appium_lib',
|
20
|
+
'gem uninstall -aIx appium_console',
|
21
|
+
'gem install --no-rdoc --no-ri appium_console'
|
22
|
+
].each { |cmd| puts cmd; `#{cmd}` }
|
23
|
+
print_version
|
24
|
+
puts "Upgrade complete."
|
25
|
+
exit
|
26
|
+
elsif a.match /setup/i
|
27
|
+
toml = File.join Dir.pwd, 'appium.txt'
|
28
|
+
if !b
|
29
|
+
puts 'setup called without android or ios. exiting.'
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
File.open toml, 'w' do |f|
|
33
|
+
if b && b.match(/android/i)
|
34
|
+
f.puts %Q(APP_PATH="#{ENV['APP_PATH'] || '/path/to/my.apk'}")
|
35
|
+
f.puts %Q(APP_PACKAGE="#{ENV['APP_PACKAGE'] || 'com.my.Pkg'}")
|
36
|
+
f.puts %Q(APP_ACTIVITY="#{ENV['APP_ACTIVITY'] || 'StartActivity'}")
|
37
|
+
f.puts %Q(APP_WAIT_ACTIVITY="#{ENV['APP_WAIT_ACTIVITY'] || 'SplashActivity'}")
|
38
|
+
elsif b && b.match(/ios/i)
|
39
|
+
# iOS requires only APP_PATH
|
40
|
+
ios = ENV['APP_PATH']
|
41
|
+
ios = false if File.extname(ios).downcase == '.apk'
|
42
|
+
f.puts %Q(APP_PATH="#{ios || '/path/to/myiOS.app'}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
4
49
|
require 'appium_console'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module AppiumConsole
|
3
|
-
VERSION = '0.0.
|
4
|
-
DATE = '2013-04-
|
3
|
+
VERSION = '0.0.28' unless defined? ::AppiumConsole::VERSION
|
4
|
+
DATE = '2013-04-11' unless defined? ::AppiumConsole::DATE
|
5
5
|
end
|
data/lib/appium_console.rb
CHANGED
@@ -2,9 +2,42 @@
|
|
2
2
|
require 'rubygems'
|
3
3
|
Gem::Specification.class_eval { def self.warn( args ); end }
|
4
4
|
require 'pry'
|
5
|
+
|
6
|
+
# Check for env vars in .txt
|
7
|
+
toml = File.join Dir.pwd, 'appium.txt'
|
8
|
+
|
9
|
+
if File.exists? toml
|
10
|
+
require 'toml'
|
11
|
+
require 'ap'
|
12
|
+
puts "Loading #{toml}"
|
13
|
+
|
14
|
+
# bash requires A="OK"
|
15
|
+
# toml requires A = "OK"
|
16
|
+
#
|
17
|
+
# A="OK" => A = "OK"
|
18
|
+
data = File.read(toml).gsub /([^\s])\=(")/, "\\1 = \\2"
|
19
|
+
data = TOML::Parser.new(data).parsed
|
20
|
+
ap data
|
21
|
+
|
22
|
+
app_path = 'APP_PATH'
|
23
|
+
app_package = 'APP_PACKAGE'
|
24
|
+
app_activity = 'APP_ACTIVITY'
|
25
|
+
app_wait_activity = 'APP_WAIT_ACTIVITY'
|
26
|
+
|
27
|
+
path = data[app_path]
|
28
|
+
pkg = data[app_package]
|
29
|
+
act = data[app_activity]
|
30
|
+
wait_act = data[app_wait_activity]
|
31
|
+
|
32
|
+
ENV[app_path] = path if path
|
33
|
+
ENV[app_package] = pkg if pkg
|
34
|
+
ENV[app_activity] = act if act
|
35
|
+
ENV[app_wait_activity] = wait_act if wait_act
|
36
|
+
end
|
37
|
+
|
5
38
|
require 'appium_lib'
|
6
39
|
|
7
40
|
start = File.expand_path "../start.rb", __FILE__
|
8
41
|
cmd = ['-r', start]
|
9
42
|
$stdout.puts 'pry ' + cmd.join(' ')
|
10
|
-
Pry::CLI.parse_options cmd
|
43
|
+
Pry::CLI.parse_options cmd
|
data/osx.md
CHANGED
@@ -3,10 +3,6 @@
|
|
3
3
|
This document is written for OS X. Appium does not yet work on Windows.
|
4
4
|
Appium Android should run on Linux however iOS testing requires OS X.
|
5
5
|
|
6
|
-
- Clone appium_console
|
7
|
-
|
8
|
-
`$ git clone git://github.com/appium/ruby_console.git`
|
9
|
-
|
10
6
|
- Ensure you have Ruby 1.9.3+ (1.8 is not supported). Install the latest stable patch release of Ruby 1.9.3 (not Ruby 2.0).
|
11
7
|
|
12
8
|
`$ \curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3`
|
@@ -38,19 +34,9 @@ gem uninstall -aIx appium_console ;\
|
|
38
34
|
gem install --no-rdoc --no-ri appium_console
|
39
35
|
```
|
40
36
|
|
41
|
-
- Export APP_PATH, APP_PACKAGE, APP_ACTIVITY
|
42
|
-
|
43
|
-
```
|
44
|
-
export APP_PATH="`pwd`/my.apk" ;\
|
45
|
-
export APP_PACKAGE="com.my.Pkg" ;\
|
46
|
-
export APP_ACTIVITY="MyActivity"
|
47
|
-
```
|
48
|
-
|
49
|
-
- Echo the values to make sure they're set correctly
|
50
|
-
|
51
|
-
`$ echo $APP_PATH $APP_PACKAGE $APP_ACTIVITY`
|
52
|
-
|
53
37
|
- Install [nodejs](http://nodejs.org/) using the big green install button. Node should be `v0.10.1` or better.
|
38
|
+
If you have `brew` installed then `brew install node` can be run instead of the nodejs.org pkg.
|
39
|
+
The advantage of using brew is that npm commands will not require sudo.
|
54
40
|
|
55
41
|
`$ node --version`
|
56
42
|
|
@@ -68,9 +54,10 @@ grunt v0.4.1
|
|
68
54
|
|
69
55
|
- Clone appium
|
70
56
|
|
71
|
-
`$ git clone git
|
57
|
+
`$ git clone git://github.com/appium/appium.git`
|
72
58
|
|
73
59
|
- Run reset.sh. You may have to run this twice as described below due to permission issues.
|
60
|
+
If you installed node with brew, reset only has to be run once and doesn't require sudo.
|
74
61
|
|
75
62
|
`cd appium; sudo ./reset.sh; ./reset.sh`
|
76
63
|
|
@@ -78,10 +65,9 @@ grunt v0.4.1
|
|
78
65
|
|
79
66
|
`node server.js -V --fast-reset`
|
80
67
|
|
81
|
-
- Install
|
82
|
-
|
83
|
-
|
84
|
-
- 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)
|
68
|
+
- Install `Intel x86 Emulator Accelerator (HAXM)` under Extras using the `android`` tool.
|
69
|
+
- Use Intel [system image](http://software.intel.com/en-us/articles/android-4-2-jelly-bean-x86-emulator-system-image)
|
70
|
+
at least API 17 (Jelly Bean). This is also installed via the `android` tool.
|
85
71
|
|
86
72
|
- Install using Android package tool. For API 17, install `SDK Platform`, `Intel x86 Atom System Image`, `Google APIs` as in the picture.
|
87
73
|
If there are any problems viewing or downloading the packages, go to `Packages -> Reload` and try again.
|
@@ -118,6 +104,10 @@ export APP_ACTIVITY="StartActivity"
|
|
118
104
|
export APP_WAIT_ACTIVITY="SplashActivity"
|
119
105
|
```
|
120
106
|
|
121
|
-
|
107
|
+
- Echo the values to make sure they're set correctly
|
108
|
+
|
109
|
+
`$ echo $APP_PATH $APP_PACKAGE $APP_ACTIVITY $APP_WAIT_ACTIVITY`
|
122
110
|
|
123
|
-
|
111
|
+
- Start appium console
|
112
|
+
|
113
|
+
`arc`
|
data/readme.md
CHANGED
@@ -19,6 +19,8 @@ gem uninstall -aIx appium_console ;\
|
|
19
19
|
gem install --no-rdoc --no-ri appium_console
|
20
20
|
```
|
21
21
|
|
22
|
+
If `appium_console` is already installed, run `arc upgrade` to automatically update.
|
23
|
+
|
22
24
|
#### Update Appium
|
23
25
|
|
24
26
|
To update `appium` from source (assuming node.js requires sudo):
|
@@ -42,6 +44,11 @@ You should uninstall the `ap` gem because it breaks awesome_print.
|
|
42
44
|
|
43
45
|
The `arc` command starts Appium Ruby Console.
|
44
46
|
|
47
|
+
- `arc version` prints the current version of appium console and appium lib.
|
48
|
+
- `arc upgrade` upgrades appium_console and appium_lib.
|
49
|
+
- `arc setup android` creates `appium.txt` for android in the current working dir.
|
50
|
+
- `arc setup ios` creates `appium.txt` for ios in the current working dir.
|
51
|
+
|
45
52
|
Ruby 1.9.3 and Appium from GitHub are required. Run Appium from source.
|
46
53
|
|
47
54
|
`node server.js -V --fast-reset`
|
@@ -72,223 +79,4 @@ Reset Appium after pulling the latest changes.
|
|
72
79
|
|
73
80
|
#### Documentation
|
74
81
|
|
75
|
-
|
76
|
-
|
77
|
-
##### [app_lib on rubydoc.info](http://www.rubydoc.info/github/appium/ruby_lib/master/toplevel)
|
78
|
-
|
79
|
-
- [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()"
|
80
|
-
`
|
81
|
-
- [Android UIAutomator](http://developer.android.com/tools/help/uiautomator/index.html)
|
82
|
-
- [Ruby selenium-webdriver](http://selenium.googlecode.com/svn/trunk/docs/api/rb/index.html)
|
83
|
-
- [Appium](https://github.com/appium/appium/blob/master/README.md)
|
84
|
-
- [Appium extension](https://github.com/appium/appium/wiki/Automating-mobile-gestures)
|
85
|
-
- [mechanic names of elements](https://github.com/jaykz52/mechanic/blob/8c490e1d225f384847e47ffdafb47cc2248bb96c/src/mechanic-core.js#L28)
|
86
|
-
- [All methods supported by Appium](https://github.com/appium/appium/wiki/JSON-Wire-Protocol:-Supported-Methods)
|
87
|
-
- [Appium's mobile gesture docs](https://github.com/appium/appium/wiki/Automating-mobile-gestures)
|
88
|
-
-
|
89
|
-
Example use of Appium's mobile gesture.
|
90
|
-
|
91
|
-
> @driver.execute_script 'mobile: tap', :x => 0, :y => 500
|
92
|
-
|
93
|
-
`console.rb` uses some code from [simple_test.rb](
|
94
|
-
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.
|
95
|
-
|
96
|
-
--
|
97
|
-
|
98
|
-
Tag Name | UIA
|
99
|
-
--:|:--
|
100
|
-
button | UIAButton
|
101
|
-
textfield | UIATextField
|
102
|
-
secure | UIASecureTextField
|
103
|
-
text | UIAStaticText
|
104
|
-
|
105
|
-
|
106
|
-
--
|
107
|
-
|
108
|
-
#### generic
|
109
|
-
|
110
|
-
- `source` Prints a JSON view of the current page.
|
111
|
-
- `page` Prints the content descriptions and text values on the current page.
|
112
|
-
- `(Element) name(name)` Returns the first element matching name. Android name is the content description.
|
113
|
-
iOS uses accessibility label with a fallback to text.
|
114
|
-
- `(Array<Element>) names(name)` Returns all elements matching name.
|
115
|
-
|
116
|
-
--
|
117
|
-
|
118
|
-
#### alert
|
119
|
-
0. `(void) alert_accept` Accept the alert.
|
120
|
-
0. `(String) alert_accept_text` Get the text of the alert's accept button.
|
121
|
-
0. `(void) alert_click(value)` iOS only Tap the alert button identified by value.
|
122
|
-
0. `(void) alert_dismiss` Dismiss the alert.
|
123
|
-
0. `(String) alert_dismiss_text` Get the text of the alert's dismiss button.
|
124
|
-
0. `(String) alert_text` Get the alert message text.
|
125
|
-
|
126
|
-
#### button
|
127
|
-
0. `(Button) button(index)` Find a button by index.
|
128
|
-
0. `(Button) button(text, number = 0)` Find a button by text and optionally number.
|
129
|
-
0. `(Button) button_include(text)` Get the first button that includes text.
|
130
|
-
0. `(Array<String>, Array<Buttons>) buttons(text = nil)` Get an array of button texts or button elements if text is provided.
|
131
|
-
0. `(Array<Button>) buttons_include(text)` Get all buttons that include text.
|
132
|
-
0. `(Button) first_button` Get the first button element.
|
133
|
-
0. `(Button) last_button` Get the last button element.
|
134
|
-
|
135
|
-
#### textfield
|
136
|
-
0. `(Textfield) textfield(index)` Find a textfield by index.
|
137
|
-
0. `(Array<Textfield>) e_textfields` Get an array of textfield elements.
|
138
|
-
0. `(Textfield) first_textfield` Get the first textfield element.
|
139
|
-
0. `(Textfield) last_textfield` Get the last textfield element.
|
140
|
-
0. `(Textfield) textfield(text)` Get the first textfield that matches text.
|
141
|
-
0. `(Textfield) textfield_include(text)` Get the first textfield that includes text.
|
142
|
-
0. `(Array<String>) textfields` Get an array of textfield texts.
|
143
|
-
|
144
|
-
#### text
|
145
|
-
0. `(Text) text(index)` Find a text by index.
|
146
|
-
0. `(Array<Text>) e_texts` Get an array of text elements.
|
147
|
-
0. `(Text) first_text` Get the first text element.
|
148
|
-
0. `(Text) last_text` Get the last text element.
|
149
|
-
0. `(Text) text(text)` Get the first element that matches text.
|
150
|
-
0. `(Text) text_include(text)` Get the first textfield that includes text.
|
151
|
-
0. `(Array<String>) texts` Get an array of text texts.
|
152
|
-
|
153
|
-
#### window
|
154
|
-
0. `(Object) window_size` Get the window's size.
|
155
|
-
|
156
|
-
--
|
157
|
-
|
158
|
-
```ruby
|
159
|
-
e.name # button, text
|
160
|
-
e.value # secure, textfield
|
161
|
-
e.type
|
162
|
-
e.tag_name # calls .type (patch.rb)
|
163
|
-
e.text
|
164
|
-
e.size
|
165
|
-
e.location
|
166
|
-
e.rel_location
|
167
|
-
e.click
|
168
|
-
e.send_keys 'keys to send'
|
169
|
-
e.set_value 'value to set' # ruby_console specific
|
170
|
-
|
171
|
-
# alert example without helper methods
|
172
|
-
alert = $driver.switch_to.alert
|
173
|
-
alert.text
|
174
|
-
alert.accept
|
175
|
-
alert.dismiss
|
176
|
-
|
177
|
-
# Secure textfield example.
|
178
|
-
#
|
179
|
-
# Find using default value
|
180
|
-
s = secure 'Password'
|
181
|
-
# Enter password
|
182
|
-
s.send_keys 'hello'
|
183
|
-
# Check value
|
184
|
-
s.value == password('hello'.length)
|
185
|
-
```
|
186
|
-
|
187
|
-
[routing.js](https://github.com/appium/appium/blob/master/app/routing.js#L69) lists not yet implemented end points.
|
188
|
-
|
189
|
-
--
|
190
|
-
|
191
|
-
#### Driver
|
192
|
-
|
193
|
-
`start_driver` will restart the driver.
|
194
|
-
|
195
|
-
`x` will quit the driver and exit Pry.
|
196
|
-
|
197
|
-
`execute_script` calls `$driver.execute_script`
|
198
|
-
|
199
|
-
`find_element` calls `$driver.find_element`
|
200
|
-
|
201
|
-
`find_elements` calls `$driver.find_elements`
|
202
|
-
|
203
|
-
`mobile :swipe, endX: 100, endY: 100, duration: 0.01` calls `$driver.execute_script 'mobile: swipe', endX: 100, endY: 100, duration: 0.01`
|
204
|
-
|
205
|
-
`no_wait` will set implicit wait to 0. `$driver.manage.timeouts.implicit_wait = 0`
|
206
|
-
|
207
|
-
`set_wait` will set implicit wait to default 30 seconds. `$driver.manage.timeouts.implicit_wait = 30`
|
208
|
-
|
209
|
-
`set_wait(timeout_seconds)` will set implicit wait to desired timeout. `$driver.manage.timeouts.implicit_wait = timeout`
|
210
|
-
|
211
|
-
.click to tap an element.
|
212
|
-
.send_keys to type on an element.
|
213
|
-
|
214
|
-
#### Raw UIAutomation
|
215
|
-
|
216
|
-
`execute_script "au.lookup('button')[0].tap()"` is the same as
|
217
|
-
`execute_script 'UIATarget.localTarget().frontMostApp().buttons()[0].tap()'`
|
218
|
-
|
219
|
-
See [app.js](https://github.com/appium/appium/blob/master/app/uiauto/appium/app.js#L3) for more au methods.
|
220
|
-
Note that raw UIAutomation commands are not offically supported.
|
221
|
-
|
222
|
-
Advanced au.
|
223
|
-
|
224
|
-
In this example we lookup two tags, combine the results, wrap with $, and then return the elements.
|
225
|
-
|
226
|
-
```ruby
|
227
|
-
s = %(
|
228
|
-
var t = au.lookup('textfield');
|
229
|
-
var s = au.lookup('secure');
|
230
|
-
var r = $(t.concat(s));
|
231
|
-
au._returnElems(r);
|
232
|
-
)
|
233
|
-
|
234
|
-
execute_script s
|
235
|
-
```
|
236
|
-
|
237
|
-
#### XPath
|
238
|
-
|
239
|
-
See [#194](https://github.com/appium/appium/pull/194/files) for details.
|
240
|
-
|
241
|
-
```ruby
|
242
|
-
find_element :xpath, 'button'
|
243
|
-
find_elements :xpath, 'button'
|
244
|
-
|
245
|
-
find_element :xpath, 'button[@name="Sign In"]'
|
246
|
-
find_elements :xpath, 'button[@name="Sign In"]'
|
247
|
-
|
248
|
-
find_element :xpath, 'button[contains(@name, "Sign In")]'
|
249
|
-
find_elements :xpath, 'button[contains(@name, "Sign")]'
|
250
|
-
|
251
|
-
find_element :xpath, 'textfield[@value="Email"]'
|
252
|
-
find_element :xpath, 'textfield[contains(@value, "Email")]'
|
253
|
-
|
254
|
-
find_element :xpath, 'text[contains(@name, "Reset")]'
|
255
|
-
find_elements :xpath, 'text[contains(@name, "agree")]'
|
256
|
-
```
|
257
|
-
|
258
|
-
#### Cucumber Sauce Integration
|
259
|
-
|
260
|
-
Reset after each test and when done report the result to Sauce after quiting the driver.
|
261
|
-
|
262
|
-
```ruby
|
263
|
-
require 'rest_client' # https://github.com/archiloque/rest-client
|
264
|
-
require 'json' # for .to_json
|
265
|
-
|
266
|
-
$passed = true
|
267
|
-
|
268
|
-
After do |scenario|
|
269
|
-
# Reset scenario unless the feature was tagged @keep
|
270
|
-
$driver.execute_script 'mobile: reset' unless scenario.feature.source_tag_names.include? '@keep'
|
271
|
-
|
272
|
-
if $passed
|
273
|
-
$passed = false if scenario.failed?
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
at_exit do
|
278
|
-
ID = $driver.send(:bridge).session_id
|
279
|
-
$driver.quit
|
280
|
-
|
281
|
-
if !SAUCE_USERNAME.nil? && !SAUCE_ACCESS_KEY.nil?
|
282
|
-
URL = "https://#{SAUCE_USERNAME}:#{SAUCE_ACCESS_KEY}@saucelabs.com/rest/v1/#{SAUCE_USERNAME}/jobs/#{ID}"
|
283
|
-
|
284
|
-
# Keep trying until passed is set correctly. Give up after 30 seconds.
|
285
|
-
wait do
|
286
|
-
response = RestClient.put URL, { 'passed' => $passed }.to_json, :content_type => :json, :accept => :json
|
287
|
-
response = JSON.parse(response)
|
288
|
-
|
289
|
-
# Check that the server responded with the right value.
|
290
|
-
response['passed'] == $passed
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
294
|
-
```
|
82
|
+
See [docs.md](https://github.com/appium/ruby_lib/blob/master/docs.md)
|
data/release_notes.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appium_lib
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.28
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.28
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.9.12
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: toml
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.4
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.4
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,6 +91,7 @@ files:
|
|
77
91
|
- my_test.rb
|
78
92
|
- osx.md
|
79
93
|
- readme.md
|
94
|
+
- release_notes.md
|
80
95
|
homepage: https://github.com/appium/ruby_console
|
81
96
|
licenses:
|
82
97
|
- http://www.apache.org/licenses/LICENSE-2.0.txt
|