lib/appium_lib/driver.rb in appium_lib-9.16.1 vs lib/appium_lib/driver.rb in appium_lib-9.17.0

- old
+ new

@@ -23,12 +23,10 @@ require 'appium_lib_core' require 'uri' module Appium - REQUIRED_VERSION_XCUITEST = '1.6.0'.freeze - class Driver # attr readers are promoted to global scope. To avoid clobbering, they're # made available via the driver_attributes method # # attr_accessor is repeated for each one so YARD documents them properly. @@ -323,21 +321,28 @@ # def dialect @driver.dialect end - # Return true if the target Appium server is over REQUIRED_VERSION_XCUITEST. - # If the Appium server is under REQUIRED_VERSION_XCUITEST, then error is raised. - # @return [Boolean] - def check_server_version_xcuitest - if automation_name_is_xcuitest? && - !@appium_server_status.empty? && - (Gem::Version.new(@appium_server_status['build']['version']) < Gem::Version.new(REQUIRED_VERSION_XCUITEST)) - - Appium::Logger.warn("XCUITest requires Appium version >= #{REQUIRED_VERSION_XCUITEST}") + # An entry point to chain W3C actions. Returns `TouchAction.new` if it works as MJSONWP instead of W3C action. + # Read https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Base/Bridge/W3C#action-instance_method + # + # @param [bool] async Run actions async + # @return [TouchAction|Selenium::WebDriver::PointerActions] + # + # @example + # + # element = find_element(:id, "some id") + # action.click(element).perform # The `click` is a part of `PointerActions` + # + def action(async = false) + if @driver.dialect != :w3c + ::Appium::Logger.info('Calls TouchAction instead of W3C actions for MJSONWP module') + TouchAction.new($driver || @driver) + else + @driver.action async end - true end # Returns the server's version info # # @example @@ -513,10 +518,9 @@ # if automation_name was nil before start_driver, then re-extend driver specific methods # to be able to extend correctly. extend_for(device: @core.device, automation_name: @core.automation_name) if automation_name.nil? @appium_server_status = appium_server_version - check_server_version_xcuitest @driver end # To ignore error for Espresso Driver