appium_lib 15.0.0 → 15.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Thorfile +0 -8
- data/appium_lib.gemspec +6 -7
- data/lib/appium_lib/android/common/helper.rb +1 -1
- data/lib/appium_lib/android/element/button.rb +1 -1
- data/lib/appium_lib/android/espresso/element/button.rb +1 -1
- data/lib/appium_lib/android/uiautomator2/element/button.rb +1 -1
- data/lib/appium_lib/appium.rb +7 -7
- data/lib/appium_lib/driver.rb +53 -11
- data/lib/appium_lib/error.rb +22 -0
- data/lib/appium_lib/ios/common/helper.rb +11 -11
- data/lib/appium_lib/ios/element/textfield.rb +1 -1
- data/lib/appium_lib/ios/xcuitest/element/textfield.rb +1 -1
- data/lib/appium_lib/version.rb +2 -2
- data/release_notes.md +30 -0
- metadata +29 -49
- data/docs/android_docs.md +0 -2590
- data/docs/ios_docs.md +0 -3232
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f88a026a704b43d222f8d8bf91db42122ff2980d5035aa392ab4071713806d7f
|
4
|
+
data.tar.gz: 8d7dd97d70126fe283dc11d60a215301119f9463d2a90e03df701bf547ac9b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4fd237d52479e5209a04198184b280fc818bcca6a3e1f7c4498207229d4672cd78241b676aa266c076418f5885510c46fe02c5259aa7a9e11612bef111c77e
|
7
|
+
data.tar.gz: 7995667f533503dbc6e48d09bce54596ee771cab6675b6d3ea64d38f709310527a075fdf54e48505a095ac52151d641f2fdfe49ff78a8a6487951484faab7d83
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@ Commit based release not is [release_notes.md](./release_notes.md)
|
|
3
3
|
|
4
4
|
Release tags are https://github.com/appium/ruby_lib/releases .
|
5
5
|
|
6
|
+
## 15.2.0 - 2024-07-20
|
7
|
+
- Raise defined errors instead of Ruby general errors by appium_lib's own errors
|
8
|
+
|
9
|
+
## 15.1.0 - 2024-05-19
|
10
|
+
- Use appium_lib_core 9.0.0
|
11
|
+
|
12
|
+
## 15.0.1 - 2024-04-26
|
13
|
+
- Bump release module (internal only)
|
14
|
+
|
6
15
|
## 15.0.0 - 2024-04-11
|
7
16
|
- Breaking
|
8
17
|
- Use appium_lib_core 8.0.0 and up
|
data/Thorfile
CHANGED
@@ -4,12 +4,4 @@ Appium::Thor::Config.set do
|
|
4
4
|
gem_name 'appium_lib'
|
5
5
|
github_name 'ruby_lib'
|
6
6
|
version_file 'lib/appium_lib/version.rb'
|
7
|
-
docs_block do
|
8
|
-
common_globs = %w(/lib/appium_lib/*.rb /lib/appium_lib/device/*.rb /lib/appium_lib/common/**/*.rb)
|
9
|
-
android_globs = common_globs + %w(/lib/appium_lib/android/**/*.rb)
|
10
|
-
ios_globs = common_globs + %w(/lib/appium_lib/ios/**/*.rb)
|
11
|
-
|
12
|
-
run 'docs/android_docs.md', globs(android_globs)
|
13
|
-
run 'docs/ios_docs.md', globs(ios_globs)
|
14
|
-
end
|
15
7
|
end
|
data/appium_lib.gemspec
CHANGED
@@ -5,7 +5,6 @@ Gem::Specification.new do |s|
|
|
5
5
|
|
6
6
|
s.name = 'appium_lib'
|
7
7
|
s.version = Appium::VERSION
|
8
|
-
s.date = Appium::DATE
|
9
8
|
s.license = 'Apache-2.0'
|
10
9
|
s.description = 'Ruby library for Appium.'
|
11
10
|
s.summary = 'Ruby library for Appium'
|
@@ -14,20 +13,20 @@ Gem::Specification.new do |s|
|
|
14
13
|
s.homepage = 'https://github.com/appium/ruby_lib' # published as appium_lib
|
15
14
|
s.require_paths = ['lib']
|
16
15
|
|
17
|
-
s.add_runtime_dependency 'appium_lib_core', '~>
|
16
|
+
s.add_runtime_dependency 'appium_lib_core', '~> 9.0'
|
18
17
|
s.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.1'
|
19
18
|
s.add_runtime_dependency 'tomlrb', '>= 1.1', '< 3.0'
|
20
19
|
|
21
|
-
s.add_development_dependency 'appium_thor', '~>
|
20
|
+
s.add_development_dependency 'appium_thor', '~> 2.0'
|
22
21
|
s.add_development_dependency 'fakefs', '~> 2.5.0'
|
23
22
|
s.add_development_dependency 'hashdiff', '~> 1.1.0'
|
24
|
-
s.add_development_dependency '
|
23
|
+
s.add_development_dependency 'minitest', '~> 5.0'
|
24
|
+
s.add_development_dependency 'minitest-reporters', '~> 1.1'
|
25
25
|
s.add_development_dependency 'pry'
|
26
26
|
s.add_development_dependency 'rake', '~> 13.0'
|
27
|
-
s.add_development_dependency 'rubocop', '1.
|
27
|
+
s.add_development_dependency 'rubocop', '1.65.0'
|
28
28
|
s.add_development_dependency 'yard', '~> 0.9.11'
|
29
|
-
s.add_development_dependency 'minitest', '~> 5.0'
|
30
|
-
s.add_development_dependency 'minitest-reporters', '~> 1.1'
|
31
29
|
|
32
30
|
s.files = `git ls-files`.split("\n").reject { |v| v.match(/\A^(ios_tests|android_tests|grid|test_apps)\/.+/) }
|
31
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
33
32
|
end
|
@@ -29,7 +29,7 @@ module Appium
|
|
29
29
|
# Android needs to combine button and image button to match iOS.
|
30
30
|
if value.is_a? Numeric
|
31
31
|
index = value
|
32
|
-
raise "#{index} is not a valid index. Must be >= 1" if index <= 0
|
32
|
+
raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0
|
33
33
|
|
34
34
|
# 1 indexed
|
35
35
|
return find_element :uiautomator, _button_visible_selectors(index: index)
|
@@ -25,7 +25,7 @@ module Appium
|
|
25
25
|
# Android needs to combine button and image button to match iOS.
|
26
26
|
if value.is_a? Numeric
|
27
27
|
index = value
|
28
|
-
raise "#{index} is not a valid index. Must be >= 1" if index <= 0
|
28
|
+
raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0
|
29
29
|
|
30
30
|
# zero index
|
31
31
|
_button_visible_selectors_xpath(index: index - 1)
|
@@ -25,7 +25,7 @@ module Appium
|
|
25
25
|
# Android needs to combine button and image button to match iOS.
|
26
26
|
if value.is_a? Numeric
|
27
27
|
index = value
|
28
|
-
raise "#{index} is not a valid index. Must be >= 1" if index <= 0
|
28
|
+
raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0
|
29
29
|
|
30
30
|
result = find_elements :uiautomator, _button_visible_selectors(index: index)
|
31
31
|
raise _no_such_element if result.empty?
|
data/lib/appium_lib/appium.rb
CHANGED
@@ -56,11 +56,11 @@ module Appium
|
|
56
56
|
# @param opts [Hash] file: '/path/to/appium.txt', verbose: true
|
57
57
|
# @return [hash] the symbolized hash with updated :app and :require keys
|
58
58
|
def load_settings(opts = {})
|
59
|
-
raise 'opts must be a hash' unless opts.is_a? Hash
|
60
|
-
raise 'opts must not be empty' if opts.empty?
|
59
|
+
raise ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
|
60
|
+
raise ArgumentError, 'opts must not be empty' if opts.empty?
|
61
61
|
|
62
62
|
toml = opts[:file]
|
63
|
-
raise 'Must pass a capability file which has [caps] and [appium_lib]' unless toml
|
63
|
+
raise ArgumentError, 'Must pass a capability file which has [caps] and [appium_lib]' unless toml
|
64
64
|
|
65
65
|
verbose = opts.fetch :verbose, false
|
66
66
|
|
@@ -69,7 +69,7 @@ module Appium
|
|
69
69
|
toml_exists = File.exist? toml
|
70
70
|
Appium::Logger.info "Exists? #{toml_exists}" if verbose
|
71
71
|
|
72
|
-
raise "toml doesn't exist #{toml}" unless toml_exists
|
72
|
+
raise ArgumentError, "toml doesn't exist #{toml}" unless toml_exists
|
73
73
|
|
74
74
|
require 'tomlrb'
|
75
75
|
Appium::Logger.info "Loading #{toml}" if verbose
|
@@ -151,7 +151,7 @@ module Appium
|
|
151
151
|
# @param [Array<Module>] modules An array of modules
|
152
152
|
# @param [Driver] driver A driver to extend for
|
153
153
|
def promote_singleton_appium_methods(modules, driver = $driver)
|
154
|
-
raise 'Global $driver is nil' if driver.nil?
|
154
|
+
raise ArgumentError, 'Global $driver is nil' if driver.nil?
|
155
155
|
|
156
156
|
target_modules = []
|
157
157
|
|
@@ -160,7 +160,7 @@ module Appium
|
|
160
160
|
target_modules << modules.const_get(sub_module)
|
161
161
|
end
|
162
162
|
else
|
163
|
-
raise 'modules must be a module or an array' unless modules.is_a? Array
|
163
|
+
raise ArgumentError, 'modules must be a module or an array' unless modules.is_a? Array
|
164
164
|
|
165
165
|
target_modules = modules
|
166
166
|
end
|
@@ -205,7 +205,7 @@ module Appium
|
|
205
205
|
# Appium.promote_appium_methods Minitest::Spec
|
206
206
|
#
|
207
207
|
def promote_appium_methods(class_array, driver = $driver)
|
208
|
-
raise 'Driver is nil' if driver.nil?
|
208
|
+
raise ArgumentError, 'Driver is nil' if driver.nil?
|
209
209
|
|
210
210
|
# Wrap single class into an array
|
211
211
|
class_array = [class_array] unless class_array.instance_of? Array
|
data/lib/appium_lib/driver.rb
CHANGED
@@ -156,7 +156,7 @@ module Appium
|
|
156
156
|
|
157
157
|
$driver&.driver_quit if global_driver
|
158
158
|
|
159
|
-
raise 'opts must be a hash' unless opts.is_a? Hash
|
159
|
+
raise ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
|
160
160
|
|
161
161
|
@core = ::Appium::Core.for(opts)
|
162
162
|
extend ::Appium::Core::Device
|
@@ -329,7 +329,7 @@ module Appium
|
|
329
329
|
# action.click(element).perform # The `click` is a part of `PointerActions`
|
330
330
|
#
|
331
331
|
def action
|
332
|
-
@driver
|
332
|
+
@driver&.action
|
333
333
|
end
|
334
334
|
|
335
335
|
# Returns the server's version info
|
@@ -384,12 +384,12 @@ module Appium
|
|
384
384
|
#
|
385
385
|
# @return [String] APP_PATH as an absolute path
|
386
386
|
def self.absolute_app_path(opts)
|
387
|
-
raise 'opts must be a hash' unless opts.is_a? Hash
|
387
|
+
raise ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
|
388
388
|
|
389
389
|
# FIXME: 'caps' and 'app' will be correct
|
390
390
|
caps = opts[:caps] || opts['caps'] || {}
|
391
391
|
app_path = caps[:app] || caps['app']
|
392
|
-
raise 'absolute_app_path invoked and app is not set!' if app_path.nil? || app_path.empty?
|
392
|
+
raise ArgumentError, 'absolute_app_path invoked and app is not set!' if app_path.nil? || app_path.empty?
|
393
393
|
# Sauce storage API. http://saucelabs.com/docs/rest#storage
|
394
394
|
return app_path if app_path.start_with? 'sauce-storage:'
|
395
395
|
return app_path if app_path =~ URI::DEFAULT_PARSER.make_regexp # public URL for Sauce
|
@@ -431,7 +431,7 @@ module Appium
|
|
431
431
|
# @param png_save_path [String] the full path to save the png
|
432
432
|
# @return [File]
|
433
433
|
def screenshot(png_save_path)
|
434
|
-
@driver
|
434
|
+
@driver&.save_screenshot png_save_path
|
435
435
|
end
|
436
436
|
|
437
437
|
# Takes a png screenshot of particular element's area
|
@@ -445,7 +445,7 @@ module Appium
|
|
445
445
|
# @param [String] png_save_path the full path to save the png
|
446
446
|
# @return [File]
|
447
447
|
def element_screenshot(element, png_save_path)
|
448
|
-
@driver
|
448
|
+
@driver&.take_element_screenshot element, png_save_path
|
449
449
|
nil
|
450
450
|
end
|
451
451
|
|
@@ -469,6 +469,9 @@ module Appium
|
|
469
469
|
# size.height #=> Integer
|
470
470
|
#
|
471
471
|
def window_size
|
472
|
+
# maybe exception is expected as no driver created
|
473
|
+
raise NoDriverInstanceError if @driver.nil?
|
474
|
+
|
472
475
|
@driver.window_size
|
473
476
|
end
|
474
477
|
|
@@ -484,6 +487,8 @@ module Appium
|
|
484
487
|
# size.y #=> Integer
|
485
488
|
#
|
486
489
|
def window_rect
|
490
|
+
raise NoDriverInstanceError if @driver.nil?
|
491
|
+
|
487
492
|
@driver.window_rect
|
488
493
|
end
|
489
494
|
|
@@ -555,7 +560,7 @@ module Appium
|
|
555
560
|
|
556
561
|
# Set implicit wait to zero.
|
557
562
|
def no_wait
|
558
|
-
@driver
|
563
|
+
@driver&.manage&.timeouts&.implicit_wait = 0
|
559
564
|
end
|
560
565
|
|
561
566
|
# Set implicit wait. Default to @default_wait.
|
@@ -570,7 +575,7 @@ module Appium
|
|
570
575
|
# @return [void]
|
571
576
|
def set_wait(timeout = nil)
|
572
577
|
timeout = @default_wait if timeout.nil?
|
573
|
-
@driver
|
578
|
+
@driver&.manage&.timeouts&.implicit_wait = timeout
|
574
579
|
end
|
575
580
|
|
576
581
|
# Returns existence of element.
|
@@ -589,9 +594,9 @@ module Appium
|
|
589
594
|
# do not uset set_wait here.
|
590
595
|
# it will cause problems with other methods reading the default_wait of 0
|
591
596
|
# which then gets converted to a 1 second wait.
|
592
|
-
@driver
|
597
|
+
@driver&.manage&.timeouts&.implicit_wait = pre_check
|
593
598
|
# the element exists unless an error is raised.
|
594
|
-
exists
|
599
|
+
exists = true
|
595
600
|
|
596
601
|
begin
|
597
602
|
yield # search for element
|
@@ -600,7 +605,7 @@ module Appium
|
|
600
605
|
end
|
601
606
|
|
602
607
|
# restore wait
|
603
|
-
@driver
|
608
|
+
@driver&.manage&.timeouts&.implicit_wait = post_check if post_check != pre_check
|
604
609
|
|
605
610
|
exists
|
606
611
|
end
|
@@ -610,6 +615,8 @@ module Appium
|
|
610
615
|
# @param [*args] args The args to pass to the script
|
611
616
|
# @return [Object]
|
612
617
|
def execute_script(script, *args)
|
618
|
+
raise NoDriverInstanceError if @driver.nil?
|
619
|
+
|
613
620
|
@driver.execute_script script, *args
|
614
621
|
end
|
615
622
|
|
@@ -618,6 +625,8 @@ module Appium
|
|
618
625
|
###
|
619
626
|
# Get the window handles of open browser windows
|
620
627
|
def execute_async_script(script, *args)
|
628
|
+
raise NoDriverInstanceError if @driver.nil?
|
629
|
+
|
621
630
|
@driver.execute_async_script script, *args
|
622
631
|
end
|
623
632
|
|
@@ -650,41 +659,59 @@ module Appium
|
|
650
659
|
# r.logs #=> The `logs` key part as `{'log' => [], 'warn' => [], 'error' => []}`
|
651
660
|
#
|
652
661
|
def execute_driver(script: '', type: 'webdriverio', timeout_ms: nil)
|
662
|
+
raise NoDriverInstanceError if @driver.nil?
|
663
|
+
|
653
664
|
@driver.execute_driver(script: script, type: type, timeout_ms: timeout_ms)
|
654
665
|
end
|
655
666
|
|
656
667
|
def window_handles
|
668
|
+
raise NoDriverInstanceError if @driver.nil?
|
669
|
+
|
657
670
|
@driver.window_handles
|
658
671
|
end
|
659
672
|
|
660
673
|
# Get the current window handle
|
661
674
|
def window_handle
|
675
|
+
raise NoDriverInstanceError if @driver.nil?
|
676
|
+
|
662
677
|
@driver.window_handle
|
663
678
|
end
|
664
679
|
|
665
680
|
def navigate
|
681
|
+
raise NoDriverInstanceError if @driver.nil?
|
682
|
+
|
666
683
|
@driver.navigate
|
667
684
|
end
|
668
685
|
|
669
686
|
def manage
|
687
|
+
raise NoDriverInstanceError if @driver.nil?
|
688
|
+
|
670
689
|
@driver.manage
|
671
690
|
end
|
672
691
|
|
673
692
|
def get(url)
|
693
|
+
raise NoDriverInstanceError if @driver.nil?
|
694
|
+
|
674
695
|
@driver.get(url)
|
675
696
|
end
|
676
697
|
|
677
698
|
def current_url
|
699
|
+
raise NoDriverInstanceError if @driver.nil?
|
700
|
+
|
678
701
|
@driver.current_url
|
679
702
|
end
|
680
703
|
|
681
704
|
def title
|
705
|
+
raise NoDriverInstanceError if @driver.nil?
|
706
|
+
|
682
707
|
@driver.title
|
683
708
|
end
|
684
709
|
|
685
710
|
# @return [TargetLocator]
|
686
711
|
# @see TargetLocator
|
687
712
|
def switch_to
|
713
|
+
raise NoDriverInstanceError if @driver.nil?
|
714
|
+
|
688
715
|
@driver.switch_to
|
689
716
|
end
|
690
717
|
###
|
@@ -712,6 +739,8 @@ module Appium
|
|
712
739
|
# @param [*args] args The args to use
|
713
740
|
# @return [Array<Element>] Array is empty when no elements are found.
|
714
741
|
def find_elements(*args)
|
742
|
+
raise NoDriverInstanceError if @driver.nil?
|
743
|
+
|
715
744
|
@driver.find_elements(*args)
|
716
745
|
end
|
717
746
|
|
@@ -728,6 +757,8 @@ module Appium
|
|
728
757
|
# @param [*args] args The args to use
|
729
758
|
# @return [Element]
|
730
759
|
def find_element(*args)
|
760
|
+
raise NoDriverInstanceError if @driver.nil?
|
761
|
+
|
731
762
|
@driver.find_element(*args)
|
732
763
|
end
|
733
764
|
|
@@ -743,6 +774,8 @@ module Appium
|
|
743
774
|
# @driver.find_element_by_image './test/functional/data/test_element_image.png'
|
744
775
|
#
|
745
776
|
def find_element_by_image(png_img_path)
|
777
|
+
raise NoDriverInstanceError if @driver.nil?
|
778
|
+
|
746
779
|
@driver.find_element_by_image(png_img_path)
|
747
780
|
end
|
748
781
|
|
@@ -758,6 +791,8 @@ module Appium
|
|
758
791
|
# @driver.find_elements_by_image ['./test/functional/data/test_element_image.png']
|
759
792
|
#
|
760
793
|
def find_elements_by_image(png_img_paths)
|
794
|
+
raise NoDriverInstanceError if @driver.nil?
|
795
|
+
|
761
796
|
@driver.find_elements_by_image(png_img_paths)
|
762
797
|
end
|
763
798
|
|
@@ -771,6 +806,8 @@ module Appium
|
|
771
806
|
# @option opts [Float] :altitude the altitude, defaulting to 75
|
772
807
|
# @return [Selenium::WebDriver::Location] the location constructed by the selenium webdriver
|
773
808
|
def set_location(opts = {})
|
809
|
+
raise NoDriverInstanceError if @driver.nil?
|
810
|
+
|
774
811
|
latitude = opts.fetch(:latitude)
|
775
812
|
longitude = opts.fetch(:longitude)
|
776
813
|
altitude = opts.fetch(:altitude, 75)
|
@@ -794,10 +831,13 @@ module Appium
|
|
794
831
|
# # 'appium:anotherEvent' => 1572959315}
|
795
832
|
#
|
796
833
|
def log_event(vendor:, event:)
|
834
|
+
raise NoDriverInstanceError if @driver.nil?
|
835
|
+
|
797
836
|
@driver.logs.event vendor: vendor, event: event
|
798
837
|
end
|
799
838
|
|
800
839
|
def log_event=(log_event)
|
840
|
+
raise if @driver.nil?
|
801
841
|
unless log_event.is_a?(Hash)
|
802
842
|
raise ::Appium::Core::Error::ArgumentError('log_event should be Hash like { vendor: "appium", event: "funEvent"}')
|
803
843
|
end
|
@@ -817,6 +857,8 @@ module Appium
|
|
817
857
|
# log_events #=> {'commands' => [{'cmd' => 123455, ....}], 'startTime' => 1572954894127, }
|
818
858
|
#
|
819
859
|
def log_events(type = nil)
|
860
|
+
raise NoDriverInstanceError if @driver.nil?
|
861
|
+
|
820
862
|
@driver.logs.events(type)
|
821
863
|
end
|
822
864
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module Appium
|
16
|
+
class Error < StandardError; end
|
17
|
+
|
18
|
+
# Driver instance hasn't been created yet.
|
19
|
+
class NoDriverInstanceError < Appium::Error; end
|
20
|
+
|
21
|
+
class ArgumentError < ArgumentError; end
|
22
|
+
end
|
@@ -107,7 +107,7 @@ module Appium
|
|
107
107
|
# @param index [Integer] the index
|
108
108
|
# @return [Element]
|
109
109
|
def ele_index(class_name, index)
|
110
|
-
raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)
|
110
|
+
raise ArgumentError, 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)
|
111
111
|
|
112
112
|
elements = tags(class_name)
|
113
113
|
|
@@ -376,7 +376,7 @@ module Appium
|
|
376
376
|
#
|
377
377
|
def _all_pred(opts)
|
378
378
|
predicate = opts[:predicate]
|
379
|
-
raise 'predicate must be provided' unless predicate
|
379
|
+
raise ArgumentError, 'predicate must be provided' unless predicate
|
380
380
|
|
381
381
|
visible = opts.fetch :visible, true
|
382
382
|
%($.mainApp().getAllWithPredicate("#{predicate}", #{visible});)
|
@@ -404,23 +404,23 @@ module Appium
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def _validate_object(*objects)
|
407
|
-
raise 'objects must be an array' unless objects.is_a? Array
|
407
|
+
raise ArgumentError, 'objects must be an array' unless objects.is_a? Array
|
408
408
|
|
409
409
|
objects.each do |obj|
|
410
410
|
next unless obj # obj may be nil. if so, ignore.
|
411
411
|
|
412
412
|
valid_keys = %i[target substring insensitive]
|
413
413
|
unknown_keys = obj.keys - valid_keys
|
414
|
-
raise "Unknown keys: #{unknown_keys}" unless unknown_keys.empty?
|
414
|
+
raise ArgumentError, "Unknown keys: #{unknown_keys}" unless unknown_keys.empty?
|
415
415
|
|
416
416
|
target = obj[:target]
|
417
|
-
raise 'target must be a string' unless target.is_a? String
|
417
|
+
raise ArgumentError, 'target must be a string' unless target.is_a? String
|
418
418
|
|
419
419
|
substring = obj[:substring]
|
420
|
-
raise 'substring must be a boolean' unless [true, false].include? substring
|
420
|
+
raise ArgumentError, 'substring must be a boolean' unless [true, false].include? substring
|
421
421
|
|
422
422
|
insensitive = obj[:insensitive]
|
423
|
-
raise 'insensitive must be a boolean' unless [true, false].include? insensitive
|
423
|
+
raise ArgumentError, 'insensitive must be a boolean' unless [true, false].include? insensitive
|
424
424
|
end
|
425
425
|
end
|
426
426
|
|
@@ -456,16 +456,16 @@ module Appium
|
|
456
456
|
def _by_json(opts)
|
457
457
|
valid_keys = %i(typeArray onlyFirst onlyVisible name label value)
|
458
458
|
unknown_keys = opts.keys - valid_keys
|
459
|
-
raise "Unknown keys: #{unknown_keys}" unless unknown_keys.empty?
|
459
|
+
raise ArgumentError, "Unknown keys: #{unknown_keys}" unless unknown_keys.empty?
|
460
460
|
|
461
461
|
type_array = opts[:typeArray]
|
462
|
-
raise 'typeArray must be an array' unless type_array.is_a? Array
|
462
|
+
raise ArgumentError, 'typeArray must be an array' unless type_array.is_a? Array
|
463
463
|
|
464
464
|
only_first = opts[:onlyFirst]
|
465
|
-
raise 'onlyFirst must be a boolean' unless [true, false].include? only_first
|
465
|
+
raise ArgumentError, 'onlyFirst must be a boolean' unless [true, false].include? only_first
|
466
466
|
|
467
467
|
only_visible = opts[:onlyVisible]
|
468
|
-
raise 'onlyVisible must be a boolean' unless [true, false].include? only_visible
|
468
|
+
raise ArgumentError, 'onlyVisible must be a boolean' unless [true, false].include? only_visible
|
469
469
|
|
470
470
|
# name/label/value are optional. when searching for class only, then none
|
471
471
|
# will be present.
|
@@ -42,7 +42,7 @@ module Appium
|
|
42
42
|
def textfield(value)
|
43
43
|
if value.is_a? Numeric
|
44
44
|
index = value
|
45
|
-
raise "#{index} is not a valid index. Must be >= 1" if index <= 0
|
45
|
+
raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0
|
46
46
|
|
47
47
|
index -= 1 # eles_by_json and _textfields_with_predicate is 0 indexed.
|
48
48
|
result = eles_by_json(_textfield_visible)[index]
|
@@ -37,7 +37,7 @@ module Appium
|
|
37
37
|
def textfield(value)
|
38
38
|
if value.is_a? Numeric
|
39
39
|
index = value
|
40
|
-
raise "#{index} is not a valid index. Must be >= 1" if index <= 0
|
40
|
+
raise ArgumentError, "#{index} is not a valid index. Must be >= 1" if index <= 0
|
41
41
|
|
42
42
|
index -= 1 # eles_by_json and _textfields_with_predicate is 0 indexed.
|
43
43
|
result = _textfields_with_predicate[index]
|
data/lib/appium_lib/version.rb
CHANGED
@@ -14,6 +14,6 @@
|
|
14
14
|
|
15
15
|
module Appium
|
16
16
|
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
|
17
|
-
VERSION = '15.
|
18
|
-
DATE = '2024-
|
17
|
+
VERSION = '15.2.0' unless defined? ::Appium::VERSION
|
18
|
+
DATE = '2024-07-20' unless defined? ::Appium::DATE
|
19
19
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
#### v15.2.0 2024-07-20
|
2
|
+
|
3
|
+
- [d73525e](https://github.com/appium/ruby_lib/commit/d73525eec584c3c31690dcd55a6c52d641d43f9f) Release 15.2.0
|
4
|
+
- [6b5d969](https://github.com/appium/ruby_lib/commit/6b5d9693f10e64a521f6ac5d31c78d71e5f0f6be) feat: raise its own defined errors (#1035)
|
5
|
+
- [4a74c60](https://github.com/appium/ruby_lib/commit/4a74c60937e66bf028a66e4f05a324ce8b2077ce) chore: Update rubocop requirement from = 1.64.1 to = 1.65.0 (#1034)
|
6
|
+
- [fa4cea4](https://github.com/appium/ruby_lib/commit/fa4cea4e5bea0aa4e3ed7052ba77812c82684fe0) chore: Update rubocop requirement from = 1.64.0 to = 1.64.1 (#1033)
|
7
|
+
- [96ce262](https://github.com/appium/ruby_lib/commit/96ce26264d985b5260e99573486e8f712bfb12e3) chore: Update rubocop requirement from = 1.63.5 to = 1.64.0 (#1032)
|
8
|
+
- [14590cc](https://github.com/appium/ruby_lib/commit/14590cce6f6cbef8c20e12ae10b00bf3f7b5ab3a) chore: tweak changelog format
|
9
|
+
|
10
|
+
|
11
|
+
#### v15.1.0 2024-05-19
|
12
|
+
|
13
|
+
- [b1534cc](https://github.com/appium/ruby_lib/commit/b1534cc8e781e37f9632fa1cbaa6e2422b6a768d) Release 15.1.0
|
14
|
+
- [f6cc482](https://github.com/appium/ruby_lib/commit/f6cc482e6bcf75cd4388911355700e31da74b578) chore: tweak deps
|
15
|
+
- [c034ec5](https://github.com/appium/ruby_lib/commit/c034ec5cb74e442db6db4cfc8365a43c903cbbfc) feat: update ruby lib core to v9 (#1030)
|
16
|
+
- [50bca8f](https://github.com/appium/ruby_lib/commit/50bca8f8acd2c4c144684cd33dd0ea9787a40bf5) chore: Update rubocop requirement from = 1.63.4 to = 1.63.5 (#1028)
|
17
|
+
- [415b3c6](https://github.com/appium/ruby_lib/commit/415b3c6b52e28f3b43cdd95a0684b1e9aadc0ae8) chore: Update rubocop requirement from = 1.63.3 to = 1.63.4 (#1027)
|
18
|
+
- [7461e6a](https://github.com/appium/ruby_lib/commit/7461e6a44569245b6dbd1b352f3ff76503bb1bbb) docs: remove no longer used docs
|
19
|
+
- [66e323c](https://github.com/appium/ruby_lib/commit/66e323c08dbc9616366e55ebf3835530549edf37) chore: remove unused docs_block
|
20
|
+
|
21
|
+
|
22
|
+
#### v15.0.1 2024-04-26
|
23
|
+
|
24
|
+
- [3ab38a7](https://github.com/appium/ruby_lib/commit/3ab38a7339bf077dd85d9b700f08ddfe2ca608e5) Release 15.0.1
|
25
|
+
- [720dfdd](https://github.com/appium/ruby_lib/commit/720dfdd31f0feacf5926f668ff15e521920e360c) chore: bump thor and remove unused posix
|
26
|
+
- [c869327](https://github.com/appium/ruby_lib/commit/c869327d50d2046a2c45e3a360b8667e006f9f56) chore: Update rubocop requirement from = 1.63.2 to = 1.63.3 (#1026)
|
27
|
+
- [6543765](https://github.com/appium/ruby_lib/commit/65437658a89b234fbc431246266a383a0988009a) chore: Update rubocop requirement from = 1.63.1 to = 1.63.2 (#1025)
|
28
|
+
- [2b428b5](https://github.com/appium/ruby_lib/commit/2b428b5e714e83ee283bce993fd3eba61827a287) chore: Update rubocop requirement from = 1.63.0 to = 1.63.1 (#1024)
|
29
|
+
|
30
|
+
|
1
31
|
#### v15.0.0 2024-04-11
|
2
32
|
|
3
33
|
- [203a605](https://github.com/appium/ruby_lib/commit/203a6052db42039c89cd000f245f1534379bc86b) Release 15.0.0
|