diff --git a/lib/appium_lib_core.rb b/lib/appium_lib_core.rb index 77e8ce27..3532e2e1 100644 --- a/lib/appium_lib_core.rb +++ b/lib/appium_lib_core.rb @@ -36,7 +36,7 @@ def self.symbolize_keys(hash, nested: false, enable_deprecation_msg: true) # the methods which expect the symbol first. raise ::Appium::Core::Error::ArgumentError, 'symbolize_keys requires a hash' unless hash.is_a? Hash - hash.each_with_object({}) do |pair, acc| + hash.each_with_object({}) do |pair, acc| # steep:ignore key = begin if enable_deprecation_msg && !(pair[0].is_a? Symbol) ::Appium::Logger.warn("[Deprecation] The key '#{pair[0]}' must be a symbol while currently it " \ diff --git a/lib/appium_lib_core/common/base/bridge.rb b/lib/appium_lib_core/common/base/bridge.rb index b3f3ff51..a6666d27 100644 --- a/lib/appium_lib_core/common/base/bridge.rb +++ b/lib/appium_lib_core/common/base/bridge.rb @@ -112,7 +112,7 @@ def create_session(capabilities) @available_commands = ::Appium::Core::Commands::COMMANDS.dup always_match = add_appium_prefix(capabilities) - response = execute(:new_session, {}, { capabilities: { alwaysMatch: always_match, firstMatch: [{}] } }) + response = execute(:new_session, {}, { capabilities: { alwaysMatch: always_match, firstMatch: [{}] } }) # steep:ignore @session_id = response['sessionId'] raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id @@ -273,7 +273,7 @@ def set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil) # No implementation for W3C webdriver module def available_log_types types = execute :get_available_log_types - Array(types).map(&:to_sym) + Array(types).map(&:to_sym) # steep:ignore end # For Appium @@ -297,7 +297,7 @@ def log_event(vendor, event) # For Appium def log_events(type = nil) - args = {} + args = {} # steep:ignore args['type'] = type unless type.nil? execute :get_log_events, {}, args diff --git a/lib/appium_lib_core/common/command.rb b/lib/appium_lib_core/common/command.rb index 7b44a8ce..d978c8bc 100644 --- a/lib/appium_lib_core/common/command.rb +++ b/lib/appium_lib_core/common/command.rb @@ -208,7 +208,7 @@ module Commands chrome_send_command: [:post, 'session/:session_id/goog/cdp/execute'] }.freeze - COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).freeze + COMMANDS = {}.merge(COMMAND).merge(COMMAND_ANDROID).freeze # steep:ignore end # module Commands end # module Core end # module Appium diff --git a/lib/appium_lib_core/common/device/app_management.rb b/lib/appium_lib_core/common/device/app_management.rb index 057b402a..f1fcc11d 100644 --- a/lib/appium_lib_core/common/device/app_management.rb +++ b/lib/appium_lib_core/common/device/app_management.rb @@ -18,7 +18,7 @@ class Base module Device module AppManagement def app_strings(language = nil) - opts = language ? { language: language } : {} + opts = language ? { language: language } : {} # steep:ignore execute_script 'mobile:getAppStrings', opts end @@ -27,7 +27,7 @@ def background_app(duration = 0) raise NotImplementedError end - def install_app(path, options = {}) + def install_app(path, options = {}) # steep:ignore args = { appPath: path } args[:options] = options unless options&.empty? diff --git a/lib/appium_lib_core/common/device/device.rb b/lib/appium_lib_core/common/device/device.rb index fa19dd67..a22c7862 100644 --- a/lib/appium_lib_core/common/device/device.rb +++ b/lib/appium_lib_core/common/device/device.rb @@ -22,7 +22,7 @@ def shake end def device_time(format = nil) - arg = {} + arg = {} # steep:ignore arg[:format] = format unless format.nil? execute_script 'mobile:getDeviceTime', arg diff --git a/lib/appium_lib_core/common/device/device_lock.rb b/lib/appium_lib_core/common/device/device_lock.rb index 9fb61b9c..778402f5 100644 --- a/lib/appium_lib_core/common/device/device_lock.rb +++ b/lib/appium_lib_core/common/device/device_lock.rb @@ -18,7 +18,7 @@ class Base module Device module DeviceLock def lock(duration = nil) - opts = duration ? { seconds: duration } : {} + opts = duration ? { seconds: duration } : {} # steep:ignore execute_script 'mobile:lock', opts end diff --git a/lib/appium_lib_core/common/device/image_comparison.rb b/lib/appium_lib_core/common/device/image_comparison.rb index b8641f85..a0daa4c0 100644 --- a/lib/appium_lib_core/common/device/image_comparison.rb +++ b/lib/appium_lib_core/common/device/image_comparison.rb @@ -68,7 +68,7 @@ def match_images_features(first_image:, raise ::Appium::Core::Error::ArgumentError, "match_func should be #{MATCH_FEATURES[:match_func]}" unless MATCH_FEATURES[:match_func].member?(match_func.to_s) raise ::Appium::Core::Error::ArgumentError, "visualize should be #{MATCH_FEATURES[:visualize]}" unless MATCH_FEATURES[:visualize].member?(visualize) - options = {} + options = {} # steep:ignore options[:detectorName] = detector_name.to_s.upcase options[:matchFunc] = match_func.to_s options[:goodMatchesFactor] = good_matches_factor.to_i unless good_matches_factor.nil? @@ -108,7 +108,7 @@ def find_image_occurrence(full_image:, partial_image:, visualize: false, thresho "visualize should be #{MATCH_TEMPLATE[:visualize]}" end - options = {} + options = {} # steep:ignore options[:visualize] = visualize options[:threshold] = threshold unless threshold.nil? options[:multiple] = multiple unless multiple.nil? @@ -138,7 +138,7 @@ def get_images_similarity(first_image:, second_image:, visualize: false) "visualize should be #{GET_SIMILARITY[:visualize]}" end - options = {} + options = {} # steep:ignore options[:visualize] = visualize compare_images(mode: :getSimilarity, first_image: first_image, second_image: second_image, options: options) @@ -160,7 +160,7 @@ def get_images_similarity(first_image:, second_image:, visualize: false) def compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil) raise ::Appium::Core::Error::ArgumentError, "content_type should be #{MODE}" unless MODE.member?(mode) - params = {} + params = {} # steep:ignore params[:mode] = mode params[:firstImage] = Base64.strict_encode64 first_image params[:secondImage] = Base64.strict_encode64 second_image diff --git a/lib/appium_lib_core/common/device/keyboard.rb b/lib/appium_lib_core/common/device/keyboard.rb index 7a1c26b5..1400bafe 100644 --- a/lib/appium_lib_core/common/device/keyboard.rb +++ b/lib/appium_lib_core/common/device/keyboard.rb @@ -18,7 +18,7 @@ class Base module Device module Keyboard def hide_keyboard(close_key = nil) - option = {} + option = {} # steep:ignore option[:key] = close_key || 'Done' # default to Done key. diff --git a/lib/appium_lib_core/common/device/screen_record.rb b/lib/appium_lib_core/common/device/screen_record.rb index 74fbf3a0..6840d6d0 100644 --- a/lib/appium_lib_core/common/device/screen_record.rb +++ b/lib/appium_lib_core/common/device/screen_record.rb @@ -35,7 +35,7 @@ def initialize(remote_path: nil, user: nil, pass: nil, method: 'PUT', 'method should be POST or PUT' end - option = {} + option = {} # steep:ignore option[:remotePath] = remote_path option[:user] = user unless user.nil? option[:pass] = pass unless pass.nil? @@ -64,7 +64,7 @@ def stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: file_field_name, form_fields: form_fields, headers: headers ).upload_option - params = option.empty? ? {} : { options: option } + params = option.empty? ? {} : { options: option } # steep:ignore execute(:stop_recording_screen, {}, params) end diff --git a/lib/appium_lib_core/driver.rb b/lib/appium_lib_core/driver.rb index 165d687a..87f7ec1d 100644 --- a/lib/appium_lib_core/driver.rb +++ b/lib/appium_lib_core/driver.rb @@ -603,7 +603,7 @@ def get_caps(opts) o = opts || {} raw_caps = o[:caps] || o[:capabilities] - caps_hash = raw_caps.is_a?(Hash) ? raw_caps : {} + caps_hash = raw_caps.is_a?(Hash) ? raw_caps : {} # steep:ignore Core::Base::Capabilities.new(caps_hash) end @@ -631,7 +631,7 @@ def set_app_path app = get_app # for steep reason return unless app && app.empty? - uri_regex = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER + uri_regex = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::DEFAULT_PARSER # steep:ignore return if app =~ uri_regex.make_regexp # steep:ignore diff --git a/sig/gems/selenium/error.rbs b/sig/gems/selenium/error.rbs index 5fd5aa9a..6e5b0339 100644 --- a/sig/gems/selenium/error.rbs +++ b/sig/gems/selenium/error.rbs @@ -4,6 +4,9 @@ module Selenium module UnknownError def message: -> String end + + class WebDriverError < StandardError + end end end end diff --git a/sig/lib/appium_lib_core/common/base/capabilities.rbs b/sig/lib/appium_lib_core/common/base/capabilities.rbs index 1feb3a6f..efb93c33 100644 --- a/sig/lib/appium_lib_core/common/base/capabilities.rbs +++ b/sig/lib/appium_lib_core/common/base/capabilities.rbs @@ -2,6 +2,8 @@ module Appium module Core class Base class Capabilities < Selenium::WebDriver::Remote::Capabilities + KNOWN: Array[Symbol] + def convert_key: (untyped key) -> untyped # Inherit json_create from parent, but you can redeclare for clarity: diff --git a/sig/lib/appium_lib_core/common/base/driver.rbs b/sig/lib/appium_lib_core/common/base/driver.rbs index a80f04e1..00605e7f 100644 --- a/sig/lib/appium_lib_core/common/base/driver.rbs +++ b/sig/lib/appium_lib_core/common/base/driver.rbs @@ -157,6 +157,8 @@ module Appium def execute_driver: (?script: ::String, ?type: ::String, ?timeout_ms: untyped?) -> untyped def convert_to_element: (untyped response_id) -> untyped + + def bidi: () -> untyped end end end