appium_lib 8.0.2 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/android_tests/lib/android/specs/common/device_touchaction.rb +1 -1
- data/android_tests/lib/android/specs/device/touch_actions.rb +32 -0
- data/android_tests/lib/android/specs/driver.rb +2 -1
- data/appium_lib.gemspec +1 -1
- data/contributing.md +1 -1
- data/docs/android_docs.md +269 -204
- data/docs/ios_docs.md +252 -187
- data/ios_tests/appium.txt +1 -1
- data/ios_tests/lib/ios/specs/device/device.rb +1 -1
- data/ios_tests/lib/ios/specs/device/touch_actions.rb +15 -1
- data/ios_tests/lib/ios/specs/driver.rb +3 -2
- data/ios_tests/readme.md +1 -1
- data/lib/appium_lib/common/version.rb +2 -2
- data/lib/appium_lib/device/device.rb +19 -1
- data/lib/appium_lib/device/multi_touch.rb +4 -4
- data/lib/appium_lib/device/touch_actions.rb +45 -8
- data/lib/appium_lib/driver.rb +16 -4
- data/release_notes.md +19 -1
- metadata +6 -6
data/ios_tests/appium.txt
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
describe 'device/touch_actions' do
|
2
|
-
t
|
2
|
+
t 'swipe_default_duration' do
|
3
|
+
wait_true do
|
4
|
+
text('pickers').click
|
5
|
+
screen == 'Pickers'
|
6
|
+
end
|
7
|
+
|
8
|
+
ele_index('UIAStaticText', 2).text.must_equal 'John Appleseed - 0'
|
9
|
+
picker = ele_index('UIAPicker', 1)
|
10
|
+
loc = picker.location.to_h
|
11
|
+
size = picker.size.to_h
|
12
|
+
start_x = loc[:x] + size[:width] / 2
|
13
|
+
start_y = loc[:y] + size[:height] / 2
|
14
|
+
swipe start_x: start_x, start_y: start_y, delta_x: start_x, delta_y: - 50
|
15
|
+
ele_index('UIAStaticText', 2).text.must_equal 'Chris Armstrong - 0'
|
16
|
+
end
|
3
17
|
end
|
4
18
|
|
5
19
|
# TODO: write tests
|
@@ -36,7 +36,7 @@ describe 'driver' do
|
|
36
36
|
actual = driver_attributes
|
37
37
|
actual[:caps][:app] = File.basename actual[:caps][:app]
|
38
38
|
expected = { caps: { platformName: 'ios',
|
39
|
-
platformVersion: '
|
39
|
+
platformVersion: '9.3',
|
40
40
|
deviceName: 'iPhone Simulator',
|
41
41
|
app: 'UICatalog.app' },
|
42
42
|
custom_url: false,
|
@@ -47,7 +47,8 @@ describe 'driver' do
|
|
47
47
|
sauce_access_key: nil,
|
48
48
|
port: 4723,
|
49
49
|
device: :ios,
|
50
|
-
debug: true
|
50
|
+
debug: true,
|
51
|
+
listener: nil }
|
51
52
|
|
52
53
|
if actual != expected
|
53
54
|
diff = HashDiff.diff expected, actual
|
data/ios_tests/readme.md
CHANGED
@@ -12,7 +12,7 @@ ruby_lib's iOS tests. Requires `Ruby 1.9.3` or better.
|
|
12
12
|
|
13
13
|
`UICatalog6.1` is from [appium/appium](https://github.com/appium/appium/blob/master/assets/UICatalog6.1.app.zip)
|
14
14
|
|
15
|
-
The tests are now run against `iPhone 6 Simulator
|
15
|
+
The tests are now run against `iPhone 6 Simulator 9.3 (12F69)`
|
16
16
|
|
17
17
|
#### Documentation
|
18
18
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Appium
|
2
2
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
3
|
-
VERSION = '8.0
|
4
|
-
DATE = '2016-
|
3
|
+
VERSION = '8.1.0' unless defined? ::Appium::VERSION
|
4
|
+
DATE = '2016-11-18' unless defined? ::Appium::DATE
|
5
5
|
end
|
@@ -93,6 +93,15 @@ module Appium
|
|
93
93
|
# pull_folder '/data/local/tmp' #=> Get the folder at that path
|
94
94
|
# ```
|
95
95
|
|
96
|
+
# @!method touch_id
|
97
|
+
# iOS only; Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint.
|
98
|
+
# @param match (Boolean) fingerprint validity
|
99
|
+
# Defaults to true.
|
100
|
+
# ```ruby
|
101
|
+
# touch_id true #=> Simulate valid fingerprint
|
102
|
+
# touch_id false #=> Simulate invalid fingerprint
|
103
|
+
# ```
|
104
|
+
|
96
105
|
# @!method end_coverage
|
97
106
|
# Android only; Ends the test coverage and writes the results to the given path on device.
|
98
107
|
# @param path (String) Path on the device to write too.
|
@@ -252,6 +261,13 @@ module Appium
|
|
252
261
|
end
|
253
262
|
end
|
254
263
|
|
264
|
+
# TODO: TEST ME
|
265
|
+
add_endpoint_method(:touch_id, 'session/:session_id/appium/simulator/touch_id') do
|
266
|
+
def touch_id(match = true)
|
267
|
+
execute :touch_id, {}, match: match
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
255
271
|
# TODO: TEST ME
|
256
272
|
add_endpoint_method(:end_coverage, 'session/:session_id/appium/app/end_test_coverage') do
|
257
273
|
def end_coverage(path, intent)
|
@@ -343,7 +359,9 @@ module Appium
|
|
343
359
|
end
|
344
360
|
end
|
345
361
|
|
346
|
-
# @!method
|
362
|
+
# @!method find_element
|
363
|
+
# @!method find_elements
|
364
|
+
#
|
347
365
|
# find_element/s with their accessibility_id
|
348
366
|
#
|
349
367
|
# ```ruby
|
@@ -32,10 +32,10 @@ module Appium
|
|
32
32
|
i = 1 - p
|
33
33
|
|
34
34
|
top = TouchAction.new
|
35
|
-
top.swipe start_x: 1.0, start_y: 0.0,
|
35
|
+
top.swipe start_x: 1.0, start_y: 0.0, delta_x: i, delta_y: i, duration: 1
|
36
36
|
|
37
37
|
bottom = TouchAction.new
|
38
|
-
bottom.swipe(start_x: 0.0, start_y: 1.0,
|
38
|
+
bottom.swipe(start_x: 0.0, start_y: 1.0, delta_x: p, delta_y: p, duration: 1)
|
39
39
|
|
40
40
|
pinch = MultiTouch.new
|
41
41
|
pinch.add top
|
@@ -60,10 +60,10 @@ module Appium
|
|
60
60
|
i = 1 - p
|
61
61
|
|
62
62
|
top = TouchAction.new
|
63
|
-
top.swipe start_x: i, start_y: i,
|
63
|
+
top.swipe start_x: i, start_y: i, delta_x: 1, delta_y: 1, duration: 1
|
64
64
|
|
65
65
|
bottom = TouchAction.new
|
66
|
-
bottom.swipe start_x: p, start_y: p,
|
66
|
+
bottom.swipe start_x: p, start_y: p, delta_x: 1, delta_y: 1, duration: 1
|
67
67
|
|
68
68
|
zoom = MultiTouch.new
|
69
69
|
zoom.add top
|
@@ -8,7 +8,7 @@ module Appium
|
|
8
8
|
# action = TouchAction.new.press(x: 45, y: 100).wait(5).release
|
9
9
|
# action.perform
|
10
10
|
class TouchAction
|
11
|
-
ACTIONS = [:move_to, :long_press, :press, :release, :tap, :wait, :perform]
|
11
|
+
ACTIONS = [:move_to, :long_press, :double_tap, :two_finger_tap, :press, :release, :tap, :wait, :perform]
|
12
12
|
COMPLEX_ACTIONS = [:swipe]
|
13
13
|
|
14
14
|
class << self
|
@@ -84,6 +84,29 @@ module Appium
|
|
84
84
|
chain_method(:tap, args)
|
85
85
|
end
|
86
86
|
|
87
|
+
# Double tap an element on the screen
|
88
|
+
#
|
89
|
+
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
90
|
+
# @option opts [integer] :x x co-ordinate to tap
|
91
|
+
# @option opts [integer] :y y co-ordinate to tap
|
92
|
+
|
93
|
+
def double_tap(opts)
|
94
|
+
args = opts.select { |k, _v| [:element, :x, :y].include? k }
|
95
|
+
args = args_with_ele_ref(args)
|
96
|
+
chain_method(:doubleTap, args) # doubleTap is what the appium server expects
|
97
|
+
end
|
98
|
+
|
99
|
+
# Two finger tap an element on the screen
|
100
|
+
#
|
101
|
+
# @option opts [WebDriver::Element] :element (Optional) Element to restrict scope too.
|
102
|
+
# @option opts [integer] :x x co-ordinate to tap
|
103
|
+
# @option opts [integer] :y y co-ordinate to tap
|
104
|
+
def two_finger_tap(opts)
|
105
|
+
args = opts.select { |k, _v| [:element, :x, :y].include? k }
|
106
|
+
args = args_with_ele_ref(args)
|
107
|
+
chain_method(:twoFingerTap, args) # twoFingerTap is what the appium server expects
|
108
|
+
end
|
109
|
+
|
87
110
|
# Pause for a number of milliseconds before the next action
|
88
111
|
# @param milliseconds [integer] Number of milliseconds to pause for
|
89
112
|
def wait(milliseconds)
|
@@ -97,19 +120,33 @@ module Appium
|
|
97
120
|
#
|
98
121
|
# @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.
|
99
122
|
# @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.
|
100
|
-
# @option opts [int] :
|
101
|
-
# @option opts [int] :
|
102
|
-
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds.
|
123
|
+
# @option opts [int] :delta_x The distance from start to move, on the x axis. Default 0.
|
124
|
+
# @option opts [int] :delta_y The distance from start to move, on the y axis. Default 0.
|
125
|
+
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds. Default 200.
|
126
|
+
# @deprecated Please do not use end_x, end_y anymore
|
103
127
|
def swipe(opts)
|
104
128
|
start_x = opts.fetch :start_x, 0
|
105
129
|
start_y = opts.fetch :start_y, 0
|
106
|
-
|
107
|
-
|
108
|
-
|
130
|
+
delta_x = opts.fetch :delta_x, nil
|
131
|
+
delta_y = opts.fetch :delta_y, nil
|
132
|
+
end_x = opts.fetch :end_x, nil
|
133
|
+
end_y = opts.fetch :end_y, nil
|
134
|
+
|
135
|
+
if end_x || end_y
|
136
|
+
warn '[DEPRECATION] `end_x` and `end_y` are deprecated. Please use `delta_x` and `delta_y` instead.'
|
137
|
+
end
|
138
|
+
|
139
|
+
delta_x ||= end_x
|
140
|
+
delta_y ||= end_y
|
141
|
+
|
142
|
+
delta_x ||= 0
|
143
|
+
delta_y ||= 0
|
144
|
+
|
145
|
+
duration = opts.fetch :duration, 200
|
109
146
|
|
110
147
|
press x: start_x, y: start_y
|
111
148
|
wait(duration) if duration
|
112
|
-
move_to x:
|
149
|
+
move_to x: delta_x, y: delta_y
|
113
150
|
release
|
114
151
|
self
|
115
152
|
end
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -263,6 +263,8 @@ module Appium
|
|
263
263
|
attr_accessor :appium_device
|
264
264
|
# Boolean debug mode for the Appium Ruby bindings
|
265
265
|
attr_accessor :appium_debug
|
266
|
+
# instance of AbstractEventListener for logging support
|
267
|
+
attr_accessor :listener
|
266
268
|
|
267
269
|
# Returns the driver
|
268
270
|
# @return [Driver] the driver
|
@@ -309,6 +311,10 @@ module Appium
|
|
309
311
|
@sauce_access_key = nil if !@sauce_access_key || (@sauce_access_key.is_a?(String) && @sauce_access_key.empty?)
|
310
312
|
@appium_port = appium_lib_opts.fetch :port, 4723
|
311
313
|
|
314
|
+
# to pass it in Selenium.new.
|
315
|
+
# `listener = opts.delete(:listener)` is called in Selenium::Driver.new
|
316
|
+
@listener = appium_lib_opts.fetch :listener, nil
|
317
|
+
|
312
318
|
# Path to the .apk, .app or .app.zip.
|
313
319
|
# The path can be local or remote for Sauce.
|
314
320
|
if @caps && @caps[:app] && ! @caps[:app].empty?
|
@@ -361,7 +367,8 @@ module Appium
|
|
361
367
|
sauce_access_key: @sauce_access_key,
|
362
368
|
port: @appium_port,
|
363
369
|
device: @appium_device,
|
364
|
-
debug: @appium_debug
|
370
|
+
debug: @appium_debug,
|
371
|
+
listener: @listener
|
365
372
|
}
|
366
373
|
|
367
374
|
# Return duplicates so attributes are immutable
|
@@ -435,7 +442,7 @@ module Appium
|
|
435
442
|
def server_url
|
436
443
|
return @custom_url if @custom_url
|
437
444
|
if !@sauce_username.nil? && !@sauce_access_key.nil?
|
438
|
-
"
|
445
|
+
"https://#{@sauce_username}:#{@sauce_access_key}@ondemand.saucelabs.com:443/wd/hub"
|
439
446
|
else
|
440
447
|
"http://127.0.0.1:#{@appium_port}/wd/hub"
|
441
448
|
end
|
@@ -476,7 +483,12 @@ module Appium
|
|
476
483
|
|
477
484
|
begin
|
478
485
|
driver_quit
|
479
|
-
@driver =
|
486
|
+
@driver = Selenium::WebDriver.for(:remote,
|
487
|
+
http_client: @client,
|
488
|
+
desired_capabilities: @caps,
|
489
|
+
url: server_url,
|
490
|
+
listener: @listener)
|
491
|
+
|
480
492
|
# Load touch methods.
|
481
493
|
@driver.extend Selenium::WebDriver::DriverExtensions::HasTouchScreen
|
482
494
|
@driver.extend Selenium::WebDriver::DriverExtensions::HasLocation
|
@@ -489,7 +501,7 @@ module Appium
|
|
489
501
|
end rescue nil
|
490
502
|
end
|
491
503
|
rescue Errno::ECONNREFUSED
|
492
|
-
raise
|
504
|
+
raise "ERROR: Unable to connect to Appium. Is the server running on #{server_url}?"
|
493
505
|
end
|
494
506
|
|
495
507
|
@driver.manage.timeouts.implicit_wait = @default_wait
|
data/release_notes.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#### v8.1.0 2016-11-18
|
2
|
+
|
3
|
+
- [0b476e7](https://github.com/appium/ruby_lib/commit/0b476e7c78f8cb829a909de55a402c6585ac5159) Release 8.1.0
|
4
|
+
- [6c38ca5](https://github.com/appium/ruby_lib/commit/6c38ca5276342ade6168eb9080424a03608a1b3e) replace end_ to delta_ because end_ is deprecated in #380 (#392)
|
5
|
+
- [09654ab](https://github.com/appium/ruby_lib/commit/09654ab9dbc69a31eff7e7bd426db985da09e3b8) Add EventListener to Driver (#389)
|
6
|
+
- [2d8fc5f](https://github.com/appium/ruby_lib/commit/2d8fc5ff7acce9417847e66772b59fc691c1dbaa) Added touch id endpoint (#384)
|
7
|
+
- [11b80e3](https://github.com/appium/ruby_lib/commit/11b80e398e98fbc71e580f659764ba54f87da4f3) Added double_tap and two_finger_tap to Appium::TouchAction (#377)
|
8
|
+
- [2a9f79c](https://github.com/appium/ruby_lib/commit/2a9f79caae337e8770aa56c47d0bd9c17cf1569f) swipe proffers use of delta_x, delta_y instead of end_x, end_y which … (#380)
|
9
|
+
- [6705226](https://github.com/appium/ruby_lib/commit/67052266b601270d2432c18b47739c9681af5563) Use secure sauce endpoint (https://ondemand.saucelabs.com:443) (#378)
|
10
|
+
- [acdcff0](https://github.com/appium/ruby_lib/commit/acdcff06ae10f1ff4461ed94486346b4514a6e3a) Merge pull request #376 from sergey-plevako-badoo/add_double_tap_and_two_finger_tap
|
11
|
+
- [eea3a6f](https://github.com/appium/ruby_lib/commit/eea3a6feaccd317b8a8ac4e2f83cc867613cdd02) Added double_tap and two_finger_tap to Appium::TouchAction
|
12
|
+
- [ac03116](https://github.com/appium/ruby_lib/commit/ac03116756a72fbd624fa32ea886123b955d7089) Include url in raised connection error (#374)
|
13
|
+
- [924c28b](https://github.com/appium/ruby_lib/commit/924c28bfa675b23b2519565dbcb0ee3531f05cd9) Fix docs of find elements (#372)
|
14
|
+
- [8b71cdc](https://github.com/appium/ruby_lib/commit/8b71cdc81be8f50f5f97f0131aee5f3dc67c3eb7) Add default value for duration in swipe (#368)
|
15
|
+
- [f58c8aa](https://github.com/appium/ruby_lib/commit/f58c8aa5a9eb349a7224c5c460c5a866444ff5dd) Merge pull request #363 from SrinivasanTarget/master
|
16
|
+
- [f8cff26](https://github.com/appium/ruby_lib/commit/f8cff2659992962b6ab5bf49fa075b02d2d110ef) updated webdriver dependency
|
17
|
+
|
18
|
+
|
1
19
|
#### v8.0.2 2016-01-29
|
2
20
|
|
3
21
|
- [d67cbba](https://github.com/appium/ruby_lib/commit/d67cbbac43f511515f6e6f53197cfae2bb7671e0) Release 8.0.2
|
@@ -1254,4 +1272,4 @@
|
|
1254
1272
|
|
1255
1273
|
- [01f2d15](https://github.com/appium/ruby_lib/commit/01f2d150ae3d8e88970b361a8330c6ccc174097d) Release 0.0.19
|
1256
1274
|
- [10eec2f](https://github.com/appium/ruby_lib/commit/10eec2f197899395978b73de049aed08ceda55cc) AppLib => AppiumLib
|
1257
|
-
- [c1e3b4f](https://github.com/appium/ruby_lib/commit/c1e3b4f0a08be3a0aef65218220f09f4198683bf) AppLib => AppiumLib
|
1275
|
+
- [c1e3b4f](https://github.com/appium/ruby_lib/commit/c1e3b4f0a08be3a0aef65218220f09f4198683bf) AppLib => AppiumLib
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appium_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0
|
4
|
+
version: 8.1.0
|
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: 2016-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.50'
|
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: '2.
|
26
|
+
version: '2.50'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: awesome_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- android_tests/lib/android/specs/common/patch.rb
|
212
212
|
- android_tests/lib/android/specs/common/version.rb
|
213
213
|
- android_tests/lib/android/specs/common/web_context.rb
|
214
|
+
- android_tests/lib/android/specs/device/touch_actions.rb
|
214
215
|
- android_tests/lib/android/specs/driver.rb
|
215
216
|
- android_tests/lib/android/specs/install.rb
|
216
217
|
- android_tests/lib/format.rb
|
@@ -349,9 +350,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
349
350
|
version: '0'
|
350
351
|
requirements: []
|
351
352
|
rubyforge_project:
|
352
|
-
rubygems_version: 2.
|
353
|
+
rubygems_version: 2.6.6
|
353
354
|
signing_key:
|
354
355
|
specification_version: 4
|
355
356
|
summary: Ruby library for Appium
|
356
357
|
test_files: []
|
357
|
-
has_rdoc:
|