appium_console 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d35c8ccbcf449176ebd22cb03bf4debd2c1b3538db04d09ed5a8af308bdb53d8
4
- data.tar.gz: 6315d3dca7927d2137760d71f75bd04b9c47d63ceaf2576000620736bad18ffc
3
+ metadata.gz: fc37fbc880b7dcbed662e916d4674a981c4630240bef1a0ed1339fde7886078c
4
+ data.tar.gz: '0148595cf014a6419ada0b95ffa58d290d652a54376efd59ce4e75bf9fd0bcb6'
5
5
  SHA512:
6
- metadata.gz: 1de4c84924901e5303ed218540d22926f98ed9ccd9ad337030f2a89bd462508c89bdeec7d80aa12edf0cf1461de2cfc035cc34cd00058ae900f72e146659be06
7
- data.tar.gz: 1df9030b98171cf15667ccf98044c7290c914061a046f6023ef849b74f822947fb535bef611f6d381c737f0b6bc305a768ff8c59854c23ab1a027bf7b31fa6bc
6
+ metadata.gz: 04dca7e6ebbefb4d049b66d68b29fdf61cf6d5c058ad3339621d675279b18051f0b1d62e47996d41e85eb15964aa91e755c31e95ed9b5b7e4887ca3e53f6a380
7
+ data.tar.gz: '09b27e4fe7d39af8c59850a7e06ae2332d8e24e10ee2420f723b3f32ba40e5dd12cf0b8ab753678c0e830767226c2a9f900b25738d7f2287c8b18a0961c89e12'
data/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  Historical commit-level notes through 4.2.0 are in [release_notes.md](release_notes.md).
4
4
  New entries are maintained by Release Please.
5
5
 
6
+ ## [4.3.1](https://github.com/appium/ruby_console/compare/v4.3.0...v4.3.1) (2026-10-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * guard after_session hook and avoid duplicate newCommandTimeout capability ([#270](https://github.com/appium/ruby_console/issues/270)) ([6b45836](https://github.com/appium/ruby_console/commit/6b45836fd4fd9b2ddc7498744009c6a53f5904be))
12
+
6
13
  ## [4.3.0](https://github.com/appium/ruby_console/compare/v4.2.0...v4.3.0) (2026-09-20)
7
14
 
8
15
 
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ gemspec
3
3
 
4
4
  gem 'minitest', '~> 5.0'
5
5
  gem 'rake', '~> 13.0'
6
- gem 'rubocop', '1.91.0'
6
+ gem 'rubocop', '1.92.1'
@@ -4,7 +4,7 @@
4
4
  module Appium; end unless defined? Appium
5
5
  module Appium
6
6
  module Console
7
- VERSION = '4.3.0' unless defined? ::Appium::Console::VERSION
8
- DATE = '2026-09-20' unless defined? ::Appium::Console::DATE # x-release-please-date
7
+ VERSION = '4.3.1' unless defined? ::Appium::Console::VERSION
8
+ DATE = '2026-10-28' unless defined? ::Appium::Console::DATE # x-release-please-date
9
9
  end
10
10
  end
@@ -13,17 +13,17 @@ module Appium
13
13
  module Console
14
14
  class << self
15
15
  def setup(appium_txt_path)
16
- Pry.send(:define_singleton_method, :pry_load_appium_txt) do |opts = {}|
16
+ define_pry_method(:pry_load_appium_txt) do |opts = {}|
17
17
  verbose = opts.fetch :verbose, false
18
18
  path = appium_txt_path
19
19
  Appium.load_appium_txt file: path, verbose: verbose
20
20
  end
21
21
 
22
- Pry.send(:define_singleton_method, :reload) do
22
+ define_pry_method(:reload) do
23
23
  parsed = Pry.pry_load_appium_txt
24
- return unless parsed && parsed[:appium_lib] && parsed[:appium_lib][:require]
24
+ requires = parsed&.dig(:appium_lib, :require)
25
+ return unless requires
25
26
 
26
- requires = parsed[:appium_lib][:require]
27
27
  requires.each do |file|
28
28
  # If a page obj is deleted then load will error.
29
29
  load file
@@ -38,10 +38,8 @@ module Appium
38
38
  cmd = ['-r', start]
39
39
 
40
40
  parsed = Pry.pry_load_appium_txt verbose: true
41
- has_requires = parsed && parsed[:appium_lib] && parsed[:appium_lib][:require]
42
- if has_requires
43
- requires = parsed[:appium_lib][:require]
44
-
41
+ requires = parsed&.dig(:appium_lib, :require)
42
+ if requires
45
43
  unless requires.empty?
46
44
  load_files = requires.map { |f| "require #{f.dump};" }.join "\n"
47
45
  cmd += ['-e', load_files]
@@ -50,14 +48,28 @@ module Appium
50
48
  $stdout.puts "pry #{cmd.join(' ')}"
51
49
  end
52
50
 
53
- Pry.hooks.add_hook(:after_session, 'Release session hook') do |output, _binding, _pry|
54
- output.puts 'Closing appium session...'
55
- x
56
- end
51
+ register_release_session_hook
57
52
 
58
53
  opts = Pry::CLI.parse_options cmd
59
54
  Pry::CLI.start(opts)
60
55
  end
56
+
57
+ private
58
+
59
+ def define_pry_method(name, &)
60
+ Pry.singleton_class.send(:remove_method, name) if Pry.respond_to?(name)
61
+ Pry.send(:define_singleton_method, name, &)
62
+ end
63
+
64
+ def register_release_session_hook
65
+ if Pry.hooks.hook_exists?(:after_session, 'Release session hook')
66
+ Pry.hooks.delete_hook(:after_session, 'Release session hook')
67
+ end
68
+ Pry.hooks.add_hook(:after_session, 'Release session hook') do |output, _binding, _pry|
69
+ output.puts 'Closing appium session...'
70
+ x if respond_to?(:x, true)
71
+ end
72
+ end
61
73
  end
62
74
  end
63
75
  end
data/lib/start.rb CHANGED
@@ -11,7 +11,9 @@ Pry.respond_to?(:config) ? Pry.config.command_prefix = '%' : ''
11
11
 
12
12
  opts = Pry.pry_load_appium_txt
13
13
  # override command timeout so the server doesn't shut down after 60 seconds
14
- new_command_timeout = { caps: { newCommandTimeout: 999_999 }.merge(opts[:caps] || {}) }
14
+ caps = opts[:caps] || {}
15
+ has_command_timeout = caps.key?(:newCommandTimeout) || caps.key?(:'appium:newCommandTimeout')
16
+ new_command_timeout = { caps: (has_command_timeout ? {} : { newCommandTimeout: 999_999 }).merge(caps) }
15
17
  opts = opts.merge(new_command_timeout)
16
18
  core = Appium::Driver.new opts, false
17
19
  core.start_driver
data/test/console_test.rb CHANGED
@@ -43,4 +43,23 @@ class ConsoleTest < Minitest::Test
43
43
  end
44
44
  end
45
45
  end
46
+
47
+ def test_after_session_hook_handles_missing_driver_and_repeated_start
48
+ Appium::Console.setup('appium.txt')
49
+ Appium.stub(:load_appium_txt, {}) do
50
+ Pry::CLI.stub(:parse_options, ->(args) { args }) do
51
+ Pry::CLI.stub(:start, ->(_args) {}) do
52
+ Appium::Console.start
53
+ Appium::Console.start
54
+ end
55
+ end
56
+ end
57
+ output = StringIO.new
58
+ Pry.hooks.errors.clear
59
+ Pry.hooks.get_hook(:after_session, 'Release session hook').call(output, binding, Pry.new)
60
+ assert_empty Pry.hooks.errors
61
+ assert_includes output.string, 'Closing appium session...'
62
+ ensure
63
+ Pry.hooks.delete_hook(:after_session, 'Release session hook')
64
+ end
46
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com