appium_lib 9.7.1 → 9.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/docs/android_docs.md +199 -240
- data/docs/ios_docs.md +251 -292
- data/lib/appium_lib/appium.rb +20 -14
- data/lib/appium_lib/common/helper.rb +34 -5
- data/lib/appium_lib/common/http_client.rb +1 -0
- data/lib/appium_lib/common/log.rb +3 -0
- data/lib/appium_lib/common/multi_touch.rb +38 -39
- data/lib/appium_lib/common/touch_actions.rb +20 -17
- data/lib/appium_lib/core/common/error.rb +5 -0
- data/lib/appium_lib/core/core.rb +28 -0
- data/lib/appium_lib/core/driver.rb +99 -32
- data/lib/appium_lib/core/ios/uiautomation/bridge.rb +2 -1
- data/lib/appium_lib/core/ios/uiautomation/patch.rb +2 -2
- data/lib/appium_lib/driver.rb +78 -92
- data/lib/appium_lib/ios/common/helper.rb +1 -0
- data/lib/appium_lib/sauce_labs.rb +42 -1
- data/lib/appium_lib/version.rb +2 -2
- data/release_notes.md +6 -0
- metadata +2 -2
@@ -6,8 +6,8 @@ module Appium
|
|
6
6
|
# class_eval inside a method because class Selenium::WebDriver::Element
|
7
7
|
# will trigger as soon as the file is required. in contrast a method
|
8
8
|
# will trigger only when invoked.
|
9
|
-
def patch_webdriver_element
|
10
|
-
Selenium::WebDriver::Element.class_eval do
|
9
|
+
def self.patch_webdriver_element
|
10
|
+
::Selenium::WebDriver::Element.class_eval do
|
11
11
|
# Cross platform way of entering text into a textfield
|
12
12
|
def type(text, driver = $driver)
|
13
13
|
driver.execute_script %(au.getElement('#{ref}').setValue('#{text}');)
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -63,49 +63,46 @@ module Appium
|
|
63
63
|
#
|
64
64
|
# @example
|
65
65
|
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
# appium_lib: {
|
79
|
-
# wait_timeout: 30
|
80
|
-
# }
|
66
|
+
# require 'rubygems'
|
67
|
+
# require 'appium_lib'
|
68
|
+
#
|
69
|
+
# # platformName takes a string or a symbol.
|
70
|
+
# # Start iOS driver with global scope
|
71
|
+
# opts = {
|
72
|
+
# caps: {
|
73
|
+
# platformName: :ios,
|
74
|
+
# app: '/path/to/MyiOS.app'
|
75
|
+
# },
|
76
|
+
# appium_lib: {
|
77
|
+
# wait_timeout: 30
|
81
78
|
# }
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
79
|
+
# }
|
80
|
+
# Appium::Driver.new(opts, true).start_driver
|
81
|
+
#
|
82
|
+
# # Start Android driver with global scope
|
83
|
+
# opts = {
|
84
|
+
# caps: {
|
85
|
+
# platformName: :android,
|
86
|
+
# app: '/path/to/my.apk'
|
87
|
+
# },
|
88
|
+
# appium_lib: {
|
89
|
+
# wait_timeout: 30,
|
90
|
+
# wait_interval: 1
|
94
91
|
# }
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
92
|
+
# }
|
93
|
+
# Appium::Driver.new(opts, true).start_driver
|
94
|
+
#
|
95
|
+
# # Start iOS driver without global scope
|
96
|
+
# opts = {
|
97
|
+
# caps: {
|
98
|
+
# platformName: :ios,
|
99
|
+
# app: '/path/to/MyiOS.app'
|
100
|
+
# },
|
101
|
+
# appium_lib: {
|
102
|
+
# wait_timeout: 30
|
106
103
|
# }
|
107
|
-
#
|
108
|
-
#
|
104
|
+
# }
|
105
|
+
# Appium::Driver.new(opts, false).start_driver
|
109
106
|
#
|
110
107
|
# @param opts [Object] A hash containing various options.
|
111
108
|
# @param global_driver [Bool] A bool require global driver before initialize.
|
@@ -279,14 +276,13 @@ module Appium
|
|
279
276
|
|
280
277
|
# Returns the server's version info
|
281
278
|
#
|
282
|
-
#
|
283
|
-
#
|
279
|
+
# @example
|
280
|
+
# {
|
284
281
|
# "build" => {
|
285
282
|
# "version" => "0.18.1",
|
286
283
|
# "revision" => "d242ebcfd92046a974347ccc3a28f0e898595198"
|
287
284
|
# }
|
288
|
-
#
|
289
|
-
# ```
|
285
|
+
# }
|
290
286
|
#
|
291
287
|
# @return [Hash]
|
292
288
|
def appium_server_version
|
@@ -311,11 +307,11 @@ module Appium
|
|
311
307
|
|
312
308
|
# Returns the client's version info
|
313
309
|
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
#
|
310
|
+
# @example
|
311
|
+
#
|
312
|
+
# {
|
313
|
+
# "version" => "9.1.1"
|
314
|
+
# }
|
319
315
|
#
|
320
316
|
# @return [Hash]
|
321
317
|
def appium_client_version
|
@@ -378,7 +374,9 @@ module Appium
|
|
378
374
|
|
379
375
|
# Takes a png screenshot and saves to the target path.
|
380
376
|
#
|
381
|
-
#
|
377
|
+
# @example
|
378
|
+
#
|
379
|
+
# screenshot '/tmp/hi.png'
|
382
380
|
#
|
383
381
|
# @param png_save_path [String] the full path to save the png
|
384
382
|
# @return [nil]
|
@@ -397,9 +395,11 @@ module Appium
|
|
397
395
|
# @return [Selenium::WebDriver::Dimension]
|
398
396
|
#
|
399
397
|
# @example
|
398
|
+
#
|
400
399
|
# size = @driver.window_size
|
401
400
|
# size.width #=> Integer
|
402
401
|
# size.height #=> Integer
|
402
|
+
#
|
403
403
|
def window_size
|
404
404
|
@driver.window_size
|
405
405
|
end
|
@@ -408,23 +408,22 @@ module Appium
|
|
408
408
|
# You can customise http_client as the following
|
409
409
|
#
|
410
410
|
# @example
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
423
|
-
#
|
424
|
-
# wait_timeout: 30
|
425
|
-
# }
|
411
|
+
#
|
412
|
+
# require 'rubygems'
|
413
|
+
# require 'appium_lib'
|
414
|
+
#
|
415
|
+
# # platformName takes a string or a symbol.
|
416
|
+
# # Start iOS driver
|
417
|
+
# opts = {
|
418
|
+
# caps: {
|
419
|
+
# platformName: :ios,
|
420
|
+
# app: '/path/to/MyiOS.app'
|
421
|
+
# },
|
422
|
+
# appium_lib: {
|
423
|
+
# wait_timeout: 30
|
426
424
|
# }
|
427
|
-
#
|
425
|
+
# }
|
426
|
+
# Appium::Driver.new(opts).start_driver
|
428
427
|
#
|
429
428
|
# @option http_client_ops [Hash] :http_client Custom HTTP Client
|
430
429
|
# @option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
|
@@ -470,11 +469,11 @@ module Appium
|
|
470
469
|
|
471
470
|
# Set implicit wait. Default to @core.default_wait.
|
472
471
|
#
|
473
|
-
#
|
474
|
-
#
|
475
|
-
#
|
472
|
+
# @example
|
473
|
+
#
|
474
|
+
# set_wait 2
|
475
|
+
# set_wait # @core.default_wait
|
476
476
|
#
|
477
|
-
# ```
|
478
477
|
#
|
479
478
|
# @param timeout [Integer] the timeout in seconds
|
480
479
|
# @return [void]
|
@@ -526,18 +525,16 @@ module Appium
|
|
526
525
|
# Calls @driver.find_elements_with_appium
|
527
526
|
#
|
528
527
|
# @example
|
529
|
-
#
|
530
|
-
#
|
531
|
-
#
|
532
|
-
# ```
|
528
|
+
#
|
529
|
+
# @driver = Appium::Driver.new(opts, false)
|
530
|
+
# @driver.find_elements :predicate, yyy
|
533
531
|
#
|
534
532
|
# If you call `Appium.promote_appium_methods`, you can call `find_elements` directly.
|
535
533
|
#
|
536
534
|
# @example
|
537
|
-
#
|
538
|
-
#
|
539
|
-
#
|
540
|
-
# ```
|
535
|
+
#
|
536
|
+
# @driver = Appium::Driver.new(opts, false)
|
537
|
+
# @driver.find_elements :predicate, yyy
|
541
538
|
#
|
542
539
|
# If you call `Appium.promote_appium_methods`, you can call `find_elements` directly.
|
543
540
|
#
|
@@ -550,10 +547,9 @@ module Appium
|
|
550
547
|
# Calls @driver.find_element
|
551
548
|
#
|
552
549
|
# @example
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
# ```
|
550
|
+
#
|
551
|
+
# @driver = Appium::Driver.new(opts, false)
|
552
|
+
# @driver.find_element :accessibility_id, zzz
|
557
553
|
#
|
558
554
|
# If you call `Appium.promote_appium_methods`, you can call `find_element` directly.
|
559
555
|
#
|
@@ -586,16 +582,6 @@ module Appium
|
|
586
582
|
driver_quit
|
587
583
|
exit # exit pry
|
588
584
|
end
|
589
|
-
|
590
|
-
private
|
591
|
-
|
592
|
-
# @private
|
593
|
-
def write_session_id(session_id)
|
594
|
-
File.open('/tmp/appium_lib_session', 'w') { |f| f.puts session_id }
|
595
|
-
rescue IOError => e
|
596
|
-
::Appium::Logger.warn e
|
597
|
-
nil
|
598
|
-
end
|
599
585
|
end # class Driver
|
600
586
|
end # module Appium
|
601
587
|
|
@@ -4,9 +4,32 @@ module Appium
|
|
4
4
|
attr_reader :username
|
5
5
|
# Access Key for use on Sauce Labs. Set `false` to disable Sauce, even when SAUCE_ACCESS_KEY is in ENV.
|
6
6
|
attr_reader :access_key
|
7
|
-
# Override the Sauce Appium endpoint to allow e.g. TestObject tests
|
7
|
+
# Override the Sauce Appium endpoint to allow e.g. TestObject tests. Default is 'ondemand.saucelabs.com:443/wd/hub'.
|
8
8
|
attr_reader :endpoint
|
9
9
|
|
10
|
+
#
|
11
|
+
# Create a SauceLabs instance to manage sauce labs related attributes.
|
12
|
+
#
|
13
|
+
# @param [Hash] appium_lib_opts Appium library parameter
|
14
|
+
# @return [Appium::SauceLabs]
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
#
|
18
|
+
# opts_blank = {}
|
19
|
+
# sauce_labs_blank = Appium::SauceLabs.new(opts_blank)
|
20
|
+
# sauce_labs_blank.username #=> nil
|
21
|
+
# sauce_labs_blank.access_key #=> nil
|
22
|
+
# sauce_labs_blank.endpoint #=> "ondemand.saucelabs.com:443/wd/hub"
|
23
|
+
#
|
24
|
+
# opts = { sauce_username: "user-name",
|
25
|
+
# sauce_access_key: "access-key-to-sauce-labs",
|
26
|
+
# sauce_endpoint: "ondemand.other_saucelabs.com:443/wd/hub",
|
27
|
+
# }
|
28
|
+
# sauce_labs = Appium::SauceLabs.new(opts)
|
29
|
+
# sauce_labs.username #=> "user-name"
|
30
|
+
# sauce_labs.access_key #=> "access-key-to-sauce-labs"
|
31
|
+
# sauce_labs.endpoint #=> "ondemand.other-saucelabs.com:443/wd/hub"
|
32
|
+
#
|
10
33
|
def initialize(appium_lib_opts)
|
11
34
|
@username = appium_lib_opts.fetch :sauce_username, ENV['SAUCE_USERNAME']
|
12
35
|
@username = nil if !@username || (@username.is_a?(String) && @username.empty?)
|
@@ -18,10 +41,28 @@ module Appium
|
|
18
41
|
@endpoint = 'ondemand.saucelabs.com:443/wd/hub' if !@endpoint || (@endpoint.is_a?(String) && @endpoint.empty?)
|
19
42
|
end
|
20
43
|
|
44
|
+
#
|
45
|
+
# Return true if an instance of Appium::SauceLabs has sauce_username and sauce_access_key.
|
46
|
+
# @return [Boolean]
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# sauce_labs_blank.sauce_server_url? #=> false
|
51
|
+
# sauce_labs.sauce_server_url? #=> true
|
52
|
+
#
|
21
53
|
def sauce_server_url?
|
22
54
|
!username.nil? && !access_key.nil?
|
23
55
|
end
|
24
56
|
|
57
|
+
#
|
58
|
+
# Return a particular server url to access to. Default is the local address.
|
59
|
+
# @return [String]
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
#
|
63
|
+
# sauce_labs_blank.server_url #=> "http://127.0.0.1:4723/wd/hub"
|
64
|
+
# sauce_labs.server_url #=> "https://user-name:access-key-to-sauce-labs@ondemand.other-saucelabs.com:443/wd/hub"
|
65
|
+
#
|
25
66
|
def server_url
|
26
67
|
sauce_server_url? ? "https://#{username}:#{access_key}@#{endpoint}" : 'http://127.0.0.1:4723/wd/hub'
|
27
68
|
end
|
data/lib/appium_lib/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Appium
|
2
2
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
3
|
-
VERSION = '9.7.
|
4
|
-
DATE = '2017-10-
|
3
|
+
VERSION = '9.7.2'.freeze unless defined? ::Appium::VERSION
|
4
|
+
DATE = '2017-10-07'.freeze unless defined? ::Appium::DATE
|
5
5
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#### v9.7.1 2017-10-01
|
2
|
+
|
3
|
+
- [ebde85f](https://github.com/appium/ruby_lib/commit/ebde85fac616ac09e19a5f8215195e536d88344d) [Release 9 7 1 (#682)](https://github.com/appium/ruby_lib/issues/682)
|
4
|
+
- [db29b66](https://github.com/appium/ruby_lib/commit/db29b664172935f7814266c7357e099969404fe3) [fix: Fix appium version error (#681)](https://github.com/appium/ruby_lib/issues/681)
|
5
|
+
|
6
|
+
|
1
7
|
#### v9.7.0 2017-10-01
|
2
8
|
|
3
9
|
- [bf12459](https://github.com/appium/ruby_lib/commit/bf124597977514e4d338efaaea5a29bdcbef5578) [Release 9 7 0 (#679)](https://github.com/appium/ruby_lib/issues/679)
|
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: 9.7.
|
4
|
+
version: 9.7.2
|
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: 2017-10-
|
11
|
+
date: 2017-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|