gnome_app_driver 0.1.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c6b65ca2e0606b079cdbb7573c3dd4bf91d09eb2
4
- data.tar.gz: 3b2d715bdeba926e5dac22874142f6e8a33d8e98
2
+ SHA256:
3
+ metadata.gz: a7b95a34fc56c8ccd362498d4af26379b8df067db00afedc5ac25598139e4bca
4
+ data.tar.gz: 7eea27a9fc2dffdd2bac6579fb91f7bb45b99c581ad42043402f0e15d8e8b71b
5
5
  SHA512:
6
- metadata.gz: e537ba3fa17179e47560c8c867f16648de1e3e950c5477e24f53bd7e081b670931281e22358ec6e751ad4966c2850d73560a4cf970c36c72fc459bdb76217157
7
- data.tar.gz: d1378bc91adb7ab28a6d9bbe73555cf3671cd1cfae2821b0b37c3c40f122a0e81ede89ccb6e41ed44374fe343868c96c3ab5ed5cb9a22d21eeedb6819c395757
6
+ metadata.gz: dd4c110014b268c8efaf7e3bbfbeebca7ecab3e39a177144626a77fe94f2a7c39904f8453d40c5b11b077fc090c06aac0ba0a6856298e8fc5565455f9b44a203
7
+ data.tar.gz: 9bc1f5be27e18184d729be763de4fcba80dbac7dc0a84fb6505fe55771546be89eff585e89b2145498f97d0d6e041679b3d080c3ab2df76952ffc3af79d8fe7e
data/Changelog.md CHANGED
@@ -1,12 +1,33 @@
1
1
  # Change log
2
2
 
3
+ ## 0.3.1 / 2022-01-26
4
+
5
+ * Drop support for Ruby version 2.5
6
+ * Support up to Ruby 3.1
7
+
8
+ ## 0.3.0 / 2020-11-14
9
+
10
+ * Drop support for Ruby version 2.3 and 2.4
11
+ * Remove `GnomeAppDriver#press_ctrl_q` because it does not and likely will never
12
+ work on Wayland. Use a regular action to quit your application instead.
13
+ * Provide access to the main application Atspi object through `GnomeAppDriver#application`
14
+
15
+ ## 0.2.1 / 2018-11-03
16
+
17
+ * Loosen dependencies
18
+
19
+ ## 0.2.0 / 2018-09-23
20
+
21
+ * Target Ruby 2.3+
22
+ * Fix `#find_role` to handle symbolic role names
23
+
3
24
  ## 0.1.2 / 2017-11-11
4
25
 
5
26
  * Update dependencies
6
27
 
7
28
  ## 0.1.1 / 2017-11-05
8
29
 
9
- * Release Ruby-GNOME2 version under a new name: gnome_app_driver
30
+ * Release Ruby-GNOME2 version under a new name: `gnome_app_driver`
10
31
 
11
32
  ## 0.1.0 / 2017-04-25
12
33
 
data/README.md CHANGED
@@ -40,7 +40,8 @@ Say, your application is called `foo`. Then, in your tests, do something like th
40
40
  textbox.get_text(0, 100).must_equal 'Foo bar baz'
41
41
 
42
42
  # Quit application
43
- @driver.press_ctrl_q
43
+ menu_item = frame.find_role :menu_item, /Quit/
44
+ menu_item.do_action 0
44
45
 
45
46
  # Check exit status
46
47
  status = @driver.cleanup
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class GnomeAppDriver
4
+ VERSION = "0.3.1"
5
+ end
@@ -1,11 +1,14 @@
1
- require 'gobject-introspection'
1
+ # frozen_string_literal: true
2
+
3
+ require "gobject-introspection"
4
+ require "gnome_app_driver/version"
2
5
 
3
6
  # Namespace for Atspi classes.
4
7
  module Atspi
5
8
  end
6
9
 
7
10
  # Load Atspi namespace with GObjectIntrospection.
8
- GObjectIntrospection::Loader.new(Atspi).load('Atspi')
11
+ GObjectIntrospection::Loader.new(Atspi).load("Atspi")
9
12
 
10
13
  # Utility monkey-patches for the Atspi::Accessible class
11
14
  module AtspiAccessiblePatches
@@ -16,17 +19,20 @@ module AtspiAccessiblePatches
16
19
  end
17
20
  end
18
21
 
19
- def find_role(role, regex = //)
22
+ # Find an element with the given role and label regex
23
+ def find_role(role_name, regex = //)
24
+ role = Atspi::Role.new role_name
20
25
  return self if role == self.role && name =~ regex
26
+
21
27
  each_child do |child|
22
- result = child.find_role role, regex
28
+ result = child.find_role role_name, regex
23
29
  return result if result
24
30
  end
25
31
  nil
26
32
  end
27
33
 
28
34
  def inspect_recursive(level = 0, maxlevel = 5)
29
- puts "#{' ' * level} > name: #{name}; role: #{role}"
35
+ puts "#{" " * level} > name: #{name}; role: #{role}"
30
36
  each_child do |child|
31
37
  child.inspect_recursive(level + 1) unless level >= maxlevel
32
38
  end
@@ -40,7 +46,7 @@ Atspi::Accessible.include AtspiAccessiblePatches
40
46
  class GnomeAppDriver
41
47
  def initialize(app_name, app_file: nil, verbose: false)
42
48
  @app_file = app_file || "bin/#{app_name}"
43
- @lib_dir = 'lib'
49
+ @lib_dir = "lib"
44
50
  @app_name = app_name
45
51
  @pid = nil
46
52
  @verbose = verbose
@@ -48,10 +54,10 @@ class GnomeAppDriver
48
54
  @thread = nil
49
55
  end
50
56
 
51
- attr_reader :frame
57
+ attr_reader :frame, :application
52
58
 
53
59
  def boot(test_timeout: 30, exit_timeout: 10, arguments: [])
54
- raise 'Already booted' if @pid
60
+ raise "Already booted" if @pid
55
61
 
56
62
  spawn_process(arguments)
57
63
 
@@ -60,42 +66,36 @@ class GnomeAppDriver
60
66
  @frame = find_and_focus_frame
61
67
 
62
68
  @thread = Thread.new do
63
- wait_for('test to be done', test_timeout) { @cleanup }
64
- wait_for('pid to go away', exit_timeout) { !@pid }
69
+ wait_for("test to be done", test_timeout) { @cleanup }
70
+ wait_for("pid to go away", exit_timeout) { !@pid }
65
71
  kill_process if @pid
66
72
  end
67
73
  end
68
74
 
69
75
  def spawn_process(arguments)
70
- command = "ruby -I#{@lib_dir} #{@app_file} #{arguments.join(' ')}"
76
+ command = "ruby -I#{@lib_dir} #{@app_file} #{arguments.join(" ")}"
71
77
  log "About to spawn: `#{command}`"
72
78
  @pid = Process.spawn command
73
79
  end
74
80
 
75
- def press_ctrl_q
76
- Atspi.generate_keyboard_event(37, nil, :press)
77
- Atspi.generate_keyboard_event(24, nil, :pressrelease)
78
- Atspi.generate_keyboard_event(37, nil, :release)
79
- end
80
-
81
81
  def cleanup
82
82
  status = exit_status
83
83
  @pid = nil
84
- @thread.join if @thread
84
+ @thread&.join
85
85
  status
86
86
  end
87
87
 
88
88
  private
89
89
 
90
90
  def find_and_focus_frame
91
- acc = wait_for('app to appear', 10) { find_app }
92
- raise 'App not found' unless acc
91
+ @application = wait_for("app to appear", 10) { find_app }
92
+ raise "App not found" unless @application
93
93
 
94
- frame = acc.get_child_at_index 0
94
+ frame = @application.get_child_at_index 0
95
95
  role = frame.role
96
96
  raise "Frame has unexpected role #{role.inspect}" unless role == :frame
97
97
 
98
- wait_for('frame to be focused', 10) do
98
+ wait_for("frame to be focused", 10) do
99
99
  frame.state_set.contains(Atspi::StateType::ACTIVE)
100
100
  end
101
101
 
@@ -104,7 +104,7 @@ class GnomeAppDriver
104
104
 
105
105
  def kill_process
106
106
  log "About to kill child process #{@pid}"
107
- Process.kill 'KILL', @pid
107
+ Process.kill "KILL", @pid
108
108
  end
109
109
 
110
110
  def log(message)
@@ -127,6 +127,7 @@ class GnomeAppDriver
127
127
  50.times do |num|
128
128
  result = yield
129
129
  break if result
130
+
130
131
  sleep 0.01 * (num + 1)
131
132
  end
132
133
  log "Waited #{Time.now - start} seconds for #{description}"
@@ -135,6 +136,7 @@ class GnomeAppDriver
135
136
 
136
137
  def exit_status
137
138
  return unless @pid
139
+
138
140
  @cleanup = true
139
141
  _, status = Process.wait2 @pid
140
142
  status
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnome_app_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-11 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gobject-introspection
@@ -16,104 +16,170 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.0
26
+ version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: gtk3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '3.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: gtk3
42
+ name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.2.0
47
+ version: '5.12'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.2.0
54
+ version: '5.12'
55
55
  - !ruby/object:Gem::Dependency
56
- name: minitest
56
+ name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.5'
61
+ version: 0.14.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.5'
68
+ version: 0.14.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '12.0'
75
+ version: '13.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.25'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.25'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.17.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.17.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-packaging
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.5.0
76
118
  type: :development
77
119
  prerelease: false
78
120
  version_requirements: !ruby/object:Gem::Requirement
79
121
  requirements:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
- version: '12.0'
83
- description:
124
+ version: 0.5.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-performance
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.13'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.13'
139
+ description: 'Driver to test the UI of applications using Ruby-GNOME2 by interacting
140
+ with them via Atspi.
141
+
142
+ '
84
143
  email:
85
144
  - matijs@matijs.net
86
145
  executables: []
87
146
  extensions: []
88
- extra_rdoc_files: []
147
+ extra_rdoc_files:
148
+ - README.md
149
+ - Changelog.md
89
150
  files:
90
151
  - Changelog.md
91
- - Gemfile
92
152
  - LICENSE
93
153
  - README.md
94
- - Rakefile
95
154
  - lib/gnome_app_driver.rb
155
+ - lib/gnome_app_driver/version.rb
96
156
  homepage: http://www.github.com/mvz/ruby-gnome2_app_driver
97
- licenses: []
98
- metadata: {}
99
- post_install_message:
100
- rdoc_options: []
157
+ licenses:
158
+ - LGPL-2.1+
159
+ metadata:
160
+ homepage_uri: http://www.github.com/mvz/ruby-gnome2_app_driver
161
+ source_code_uri: https://github.com/mvz/ruby-gnome2_app_driver
162
+ changelog_uri: https://github.com/mvzruby-gnome2_app_driver/blob/master/Changelog.md
163
+ rubygems_mfa_required: 'true'
164
+ post_install_message:
165
+ rdoc_options:
166
+ - "--main"
167
+ - README.md
101
168
  require_paths:
102
169
  - lib
103
170
  required_ruby_version: !ruby/object:Gem::Requirement
104
171
  requirements:
105
172
  - - ">="
106
173
  - !ruby/object:Gem::Version
107
- version: '0'
174
+ version: 2.6.0
108
175
  required_rubygems_version: !ruby/object:Gem::Requirement
109
176
  requirements:
110
177
  - - ">="
111
178
  - !ruby/object:Gem::Version
112
179
  version: '0'
113
180
  requirements: []
114
- rubyforge_project:
115
- rubygems_version: 2.6.13
116
- signing_key:
181
+ rubygems_version: 3.3.3
182
+ signing_key:
117
183
  specification_version: 4
118
184
  summary: Test Ruby-GNOME2 applications using Atspi
119
185
  test_files: []
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/Rakefile DELETED
@@ -1,17 +0,0 @@
1
- require 'rake/clean'
2
- require 'bundler/gem_tasks'
3
- require 'rake/testtask'
4
-
5
- namespace :test do
6
- Rake::TestTask.new(:end_to_end) do |t|
7
- t.libs = ['lib']
8
- t.test_files = FileList['test/end_to_end/*_test.rb']
9
- t.warning = true
10
- end
11
-
12
- task all: [:end_to_end]
13
- end
14
-
15
- task test: 'test:all'
16
-
17
- task default: 'test'