Skip to content

Commit

Permalink
Merge branch 'master' into selenium-12141
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa authored Feb 3, 2024
2 parents 0938833 + 3d5a6de commit d69922a
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 963 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ Read `release_notes.md` for commit level details.
### Deprecations


## [7.4.0] - 2024-01-23

### Enhancement
- Bump `selenium-webdriver` max

### Deprecatioons
- Removed deprecated `core#platform_version` and `core#write_session_id`
- Please refer to the capabilities' value and `driver.session_id`

## [7.3.2] - 2023-11-08

### Bug fixes
- Fix default value fo set context

## [7.3.1] - 2023-11-04
### Enhancements
- Bump `selenium-webdriver` max

## [7.3.0] - 2023-10-17

### Deprecations
Expand Down
23 changes: 1 addition & 22 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,7 @@ end

desc('Execute RuboCop static code analysis')
RuboCop::RakeTask.new(:rubocop) do |t|
t.patterns = %w(lib test script)
t.patterns = %w(lib test)
t.options = %w(-D)
t.fail_on_error = true
end

desc('print commands which Ruby client has not implemented them yet')
namespace :commands do
require './script/commands'

desc('Mobile JSON protocol')
task :mjsonwp do |_t, _args|
c = Script::CommandsChecker.new
c.get_mjsonwp_routes
c.get_all_command_path './mjsonwp_routes.js'
c.all_diff_commands_mjsonwp.each { |key, value| puts("command: #{key}, method: #{value}") }
end

desc('W3C protocol')
task :w3c do |_t, _args|
c = Script::CommandsChecker.new
c.get_mjsonwp_routes
c.get_all_command_path './mjsonwp_routes.js'
c.all_diff_commands_w3c.each { |key, value| puts("command: #{key}, method: #{value}") }
end
end
4 changes: 2 additions & 2 deletions appium_lib_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_runtime_dependency 'selenium-webdriver'
spec.add_runtime_dependency 'selenium-webdriver', '~> 4.2', '< 4.18'
spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'

spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'yard', '~> 0.9.11'
spec.add_development_dependency 'minitest', '~> 5.0'
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
spec.add_development_dependency 'webmock', '~> 3.19.0'
spec.add_development_dependency 'rubocop', '1.57.2'
spec.add_development_dependency 'rubocop', '1.60.2'
spec.add_development_dependency 'appium_thor', '~> 1.0'
spec.add_development_dependency 'parallel_tests'
spec.add_development_dependency 'simplecov'
Expand Down
6 changes: 3 additions & 3 deletions ci-jobs/functional/run_appium.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: 16.x
displayName: Install Node 16.x to get NPM v8
versionSpec: 18.x
displayName: Install Node 18.x to get NPM v8
- script: npm install -g appium@${APPIUM_VERSION}
displayName: Install appium beta
displayName: Install appium
- script: npm install -g mjpeg-consumer
displayName: Install MJPEG Consumer
- script: npm list --depth 2 -g || echo 'ok'
Expand Down
7 changes: 4 additions & 3 deletions lib/appium_lib_core/common/base/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ def status

# Perform 'touch' actions for W3C module.
# Generate +touch+ pointer action here and users can use this via +driver.action+
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
# - https://www.selenium.dev/documentation/webdriver/actions_api/
# - https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/ActionBuilder.html
# - https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
# - https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
#
# The pointer type is 'touch' by default in the Appium Ruby client.
#
Expand Down
8 changes: 5 additions & 3 deletions lib/appium_lib_core/common/base/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def add_command(method:, url:, name:, &block)

# Perform 'key' actions for W3C module.
# Generate +key+ pointer action here and users can use this via +driver.key_action+
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
# - https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/ActionBuilder.html
# - https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
#
# The pointer type is 'key' by default in the Appium Ruby client.
# +driver.action+ in Appium Ruby client has 'pointer' action by default.
Expand Down Expand Up @@ -434,13 +434,15 @@ def within_context(context, &block)
block_given? ? @bridge.within_context(context, &block) : @bridge.within_context(context)
end

# @deprecated Use set context with proper context name instead.
# Change to the default context. This is equivalent to +set_context nil+.
#
# @example
#
# @driver.switch_to_default_context
#
def switch_to_default_context
::Appium::Logger.warn '[DEPRECATION] Please set proper context instead of calling this method.'
@bridge.switch_to_default_context
end

Expand Down Expand Up @@ -472,7 +474,7 @@ def available_contexts
# @driver.set_context "NATIVE_APP"
# @driver.context = "NATIVE_APP"
#
def context=(context = null)
def context=(context = nil)
@bridge.set_context(context)
end
alias set_context context=
Expand Down
2 changes: 1 addition & 1 deletion lib/appium_lib_core/common/device/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def available_contexts
execute(:available_contexts, {}) || []
end

def set_context(context = null)
def set_context(context = nil)
execute :set_context, {}, name: context
end
end # module ImeActions
Expand Down
54 changes: 1 addition & 53 deletions lib/appium_lib_core/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module Ios
# This options affects only client side as <code>:appium_lib</code> key.<br>
# Read {::Appium::Core::Driver} about each attribute
class Options
attr_reader :custom_url, :default_wait, :export_session, :export_session_path,
attr_reader :custom_url, :default_wait,
:port, :wait_timeout, :wait_interval, :listener,
:direct_connect, :enable_idempotency_header

Expand All @@ -45,10 +45,6 @@ def initialize(appium_lib_opts)
@default_wait = appium_lib_opts.fetch :wait, nil
@enable_idempotency_header = appium_lib_opts.fetch :enable_idempotency_header, true

# bump current session id into a particular file
@export_session = appium_lib_opts.fetch :export_session, false
@export_session_path = appium_lib_opts.fetch :export_session_path, default_tmp_appium_lib_session

@direct_connect = appium_lib_opts.fetch :direct_connect, true

@port = appium_lib_opts.fetch :port, Driver::DEFAULT_APPIUM_PORT
Expand Down Expand Up @@ -137,12 +133,6 @@ class Driver
# @return [String]
attr_reader :custom_url

# Export session id to textfile in /tmp for 3rd party tools. False by default.
# @return [Boolean]
attr_reader :export_session
# @return [String] By default, session id is exported in '/tmp/appium_lib_session'
attr_reader :export_session_path

# Default wait time for elements to appear in Appium server side.
# Provide <code>{ appium_lib: { wait: 30 } }</code> to {::Appium::Core.for}
# @return [Integer]
Expand Down Expand Up @@ -222,7 +212,6 @@ class Driver
# app: '/path/to/MyiOS.app'
# },
# appium_lib: {
# export_session: false,
# port: 8080,
# wait: 0,
# wait_timeout: 20,
Expand All @@ -245,7 +234,6 @@ class Driver
# },
# appium_lib: {
# server_url: 'http://custom-host:8080/wd/hub.com',
# export_session: false,
# wait: 0,
# wait_timeout: 20,
# wait_interval: 0.3,
Expand All @@ -266,7 +254,6 @@ class Driver
# app: '/path/to/MyiOS.app'
# },
# appium_lib: {
# export_session: false,
# wait: 0,
# wait_timeout: 20,
# wait_interval: 0.3,
Expand Down Expand Up @@ -439,9 +426,6 @@ def start_driver(server_url: nil,
d_c = DirectConnections.new(@driver.capabilities)
@driver.update_sending_request_to(protocol: d_c.protocol, host: d_c.host, port: d_c.port, path: d_c.path)
end

# export session
write_session_id(@driver.session_id, @export_session_path) if @export_session
rescue Errno::ECONNREFUSED
raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}?"
end
Expand Down Expand Up @@ -494,9 +478,6 @@ def attach_to(session_id, url: nil, automation_name: nil, platform_name: nil,
existing_session_id: session_id,
automation_name: automation_name,
platform_name: platform_name)

# export session
write_session_id(@driver.session_id, @export_session_path) if @export_session
rescue Errno::ECONNREFUSED
raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}?"
end
Expand Down Expand Up @@ -568,23 +549,6 @@ def appium_server_version
{}
end

# Return the platform version as an array of integers
# @return [Array<Integer>]
#
# @example
#
# @core.platform_version #=> [10,1,1]
#
def platform_version
::Appium::Logger.warn(
'[DEPRECATION] platform_version method will be. ' \
'Please check the platformVersion via @driver.capabilities["platformVersion"] instead.'
)

p_version = @driver.capabilities['platformVersion'] || @driver.session_capabilities['platformVersion']
p_version.split('.').map(&:to_i)
end

private

def convert_to_symbol(value)
Expand Down Expand Up @@ -699,9 +663,6 @@ def set_appium_lib_specific_values(appium_lib_opts)

@default_wait = opts.default_wait

@export_session = opts.export_session
@export_session_path = opts.export_session_path

@port = opts.port

@wait_timeout = opts.wait_timeout
Expand Down Expand Up @@ -743,19 +704,6 @@ def set_automation_name_if_nil
@driver.capabilities['automationName'].downcase.strip.intern
end
end

# @private
def write_session_id(session_id, export_path = '/tmp/appium_lib_session')
::Appium::Logger.warn(
'[DEPRECATION] export_session option will be removed. ' \
'Please save the session id by yourself with #session_id method like @driver.session_id.'
)
export_path = export_path.tr('/', '\\') if ::Appium::Core::Base.platform.windows?
File.write(export_path, session_id)
rescue IOError => e
::Appium::Logger.warn e
nil
end
end # class Driver
end # module Core
end # module Appium
4 changes: 2 additions & 2 deletions lib/appium_lib_core/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

module Appium
module Core
VERSION = '7.3.0' unless defined? ::Appium::Core::VERSION
DATE = '2023-10-17' unless defined? ::Appium::Core::DATE
VERSION = '7.4.0' unless defined? ::Appium::Core::VERSION
DATE = '2024-01-23' unless defined? ::Appium::Core::DATE
end
end
29 changes: 29 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
#### v7.4.0 2024-01-23

- [d6b0bf2](https://github.com/appium/ruby_lib_core/commit/d6b0bf206b338340ec1f6d6b223e11729646999e) Release 7.4.0
- [16e4f0d](https://github.com/appium/ruby_lib_core/commit/16e4f0d04eb96bcaeea59c439e9f1946f133f1fa) chore(deps): update selenium-webdriver requirement from ~> 4.2, < 4.17 to ~> 4.2, < 4.18 (#518)
- [b77460d](https://github.com/appium/ruby_lib_core/commit/b77460d7e81f74fcc831b8e0636ce014928ea3a8) feat: removed a few deprecated methods (#517)
- [896f12e](https://github.com/appium/ruby_lib_core/commit/896f12ecc66ddfb2aba2edec8fca6faac1c361b8) chore(deps-dev): update rubocop requirement from = 1.60.0 to = 1.60.1 (#515)
- [41c1b80](https://github.com/appium/ruby_lib_core/commit/41c1b8040fcd56b91c39234f6f9328dc2e05618c) chore(deps-dev): update rubocop requirement from = 1.59.0 to = 1.60.0 (#514)
- [35a0c78](https://github.com/appium/ruby_lib_core/commit/35a0c781847a7a53d8c528046c610ae503187b98) chore: add duration in test code
- [87aed5f](https://github.com/appium/ruby_lib_core/commit/87aed5fa0f84a5b4eaa1fc49b7913baa5a29e9f9) docs: update links (#512)
- [e7975c6](https://github.com/appium/ruby_lib_core/commit/e7975c6cc9ba84740fda5aa18c3ad803637b4a81) chore(deps-dev): update rubocop requirement from = 1.58.0 to = 1.59.0 (#511)
- [d4d6c95](https://github.com/appium/ruby_lib_core/commit/d4d6c95bcb3187e23ed8d331ae46fb98247c15d2) chore(deps): update selenium-webdriver requirement from ~> 4.2, < 4.16 to ~> 4.2, < 4.17 (#510)
- [c3dd34e](https://github.com/appium/ruby_lib_core/commit/c3dd34efee074ecaf53423ad933175ec497173d3) chore(deps-dev): update rubocop requirement from = 1.57.2 to = 1.58.0 (#509)


#### v7.3.2 2023-11-08

- [12d6054](https://github.com/appium/ruby_lib_core/commit/12d60545aad11b7259c440c5a3beb426dd978ae8) Release 7.3.2
- [1cbafc1](https://github.com/appium/ruby_lib_core/commit/1cbafc168725b906839cc4a6391893dbb50e4091) test: tweak tests (#508)
- [163b360](https://github.com/appium/ruby_lib_core/commit/163b360a7f6cbc5ef4c5ff0b4e1caa68372174f9) chore: remove outdated files/commands
- [9651c9d](https://github.com/appium/ruby_lib_core/commit/9651c9d98819c6fc4a4bffcb0a4e6ac770322dc9) chore: removea unused line


#### v7.3.1 2023-11-04

- [42205db](https://github.com/appium/ruby_lib_core/commit/42205db807ef33da7c29bb983bc365c98d948533) Release 7.3.1
- [524424b](https://github.com/appium/ruby_lib_core/commit/524424b306de55568fce154b2ba33615ac21302b) chore(deps-dev): update rubocop requirement from = 1.57.1 to = 1.57.2 (#506)
- [7777164](https://github.com/appium/ruby_lib_core/commit/777716440bb6383bef21e9423a98c51edc4c63bb) chore(deps): update selenium-webdriver requirement from ~> 4.2, < 4.15 to ~> 4.2, < 4.16 (#507)


#### v7.3.0 2023-10-17

- [855af15](https://github.com/appium/ruby_lib_core/commit/855af15200a81fb591e7f960a479a87ad0ef4a76) Release 7.3.0
Expand Down
Loading

0 comments on commit d69922a

Please sign in to comment.