gnome_app_driver 0.2.1 → 0.3.2

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
2
  SHA256:
3
- metadata.gz: e7feb70f2fafca92f6f5e1d71f5fad7af913f69db2f4c554629c6a1f88fca9b7
4
- data.tar.gz: 61db339d567b17aef27903e6bd2b3599aabc52e2e66c56b539e83fa0395bebee
3
+ metadata.gz: 994d254c191d22a73bfac301b0099a02c066e1c8caab77548fb0675d8f1f77fd
4
+ data.tar.gz: 8e32401c6763b98db599c65d33a47f06903fb5f5d74134428f4629f2fdb1239a
5
5
  SHA512:
6
- metadata.gz: 35dba622b624ef71f94b1c2ad2af2a37cae28e12eb2f2b55b1b373d9c6419a13facf51dd0cacf374ee8db8d399aad0e31a3ac3b5563c09600875e47387424a3a
7
- data.tar.gz: d75652fd61a2627f1c5ffad31ffc6ca5a5c31b592d6dcce4f3573d959b1f2847b8c9c78f24399b96d4498fcc31cd574af4bf0e760b05a20854c63fb3ff56c68e
6
+ metadata.gz: ce775f2b03a59782e5bbb8c83120dd2e4333930acde9680f1a574a002d984f82666c01ee8f97f4b18f0b82b68cd240f68b0ab7e6860bd8b29e1a004e74cd6397
7
+ data.tar.gz: 794b23d81491b6902aa061a7c63c3ace597cace2a3ae735b43daca82cefe297090945c65e4c33eb786f7e9ca4c96fda30eca58e22641f23dd23f7226734c2728
data/Changelog.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Change log
2
2
 
3
+ ## 0.3.2 / 2022-09-02
4
+
5
+ * Loosen dependency on gobject-introspection to allow use with version 4.0
6
+
7
+ ## 0.3.1 / 2022-01-26
8
+
9
+ * Drop support for Ruby version 2.5
10
+ * Support up to Ruby 3.1
11
+
12
+ ## 0.3.0 / 2020-11-14
13
+
14
+ * Drop support for Ruby version 2.3 and 2.4
15
+ * Remove `GnomeAppDriver#press_ctrl_q` because it does not and likely will never
16
+ work on Wayland. Use a regular action to quit your application instead.
17
+ * Provide access to the main application Atspi object through `GnomeAppDriver#application`
18
+
3
19
  ## 0.2.1 / 2018-11-03
4
20
 
5
21
  * Loosen dependencies
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.2"
5
+ end
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gobject-introspection'
3
+ require "gobject-introspection"
4
+ require "gnome_app_driver/version"
4
5
 
5
6
  # Namespace for Atspi classes.
6
7
  module Atspi
7
8
  end
8
9
 
9
10
  # Load Atspi namespace with GObjectIntrospection.
10
- GObjectIntrospection::Loader.new(Atspi).load('Atspi')
11
+ GObjectIntrospection::Loader.new(Atspi).load("Atspi")
11
12
 
12
13
  # Utility monkey-patches for the Atspi::Accessible class
13
14
  module AtspiAccessiblePatches
@@ -18,19 +19,20 @@ module AtspiAccessiblePatches
18
19
  end
19
20
  end
20
21
 
21
- def find_role(role, regex = //)
22
- role = Atspi::Role.new role
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
23
25
  return self if role == self.role && name =~ regex
24
26
 
25
27
  each_child do |child|
26
- result = child.find_role role, regex
28
+ result = child.find_role role_name, regex
27
29
  return result if result
28
30
  end
29
31
  nil
30
32
  end
31
33
 
32
34
  def inspect_recursive(level = 0, maxlevel = 5)
33
- puts "#{' ' * level} > name: #{name}; role: #{role}"
35
+ puts "#{" " * level} > name: #{name}; role: #{role}"
34
36
  each_child do |child|
35
37
  child.inspect_recursive(level + 1) unless level >= maxlevel
36
38
  end
@@ -44,7 +46,7 @@ Atspi::Accessible.include AtspiAccessiblePatches
44
46
  class GnomeAppDriver
45
47
  def initialize(app_name, app_file: nil, verbose: false)
46
48
  @app_file = app_file || "bin/#{app_name}"
47
- @lib_dir = 'lib'
49
+ @lib_dir = "lib"
48
50
  @app_name = app_name
49
51
  @pid = nil
50
52
  @verbose = verbose
@@ -52,10 +54,10 @@ class GnomeAppDriver
52
54
  @thread = nil
53
55
  end
54
56
 
55
- attr_reader :frame
57
+ attr_reader :frame, :application
56
58
 
57
59
  def boot(test_timeout: 30, exit_timeout: 10, arguments: [])
58
- raise 'Already booted' if @pid
60
+ raise "Already booted" if @pid
59
61
 
60
62
  spawn_process(arguments)
61
63
 
@@ -64,24 +66,18 @@ class GnomeAppDriver
64
66
  @frame = find_and_focus_frame
65
67
 
66
68
  @thread = Thread.new do
67
- wait_for('test to be done', test_timeout) { @cleanup }
68
- 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 }
69
71
  kill_process if @pid
70
72
  end
71
73
  end
72
74
 
73
75
  def spawn_process(arguments)
74
- command = "ruby -I#{@lib_dir} #{@app_file} #{arguments.join(' ')}"
76
+ command = "ruby -I#{@lib_dir} #{@app_file} #{arguments.join(" ")}"
75
77
  log "About to spawn: `#{command}`"
76
78
  @pid = Process.spawn command
77
79
  end
78
80
 
79
- def press_ctrl_q
80
- Atspi.generate_keyboard_event(37, nil, :press)
81
- Atspi.generate_keyboard_event(24, nil, :pressrelease)
82
- Atspi.generate_keyboard_event(37, nil, :release)
83
- end
84
-
85
81
  def cleanup
86
82
  status = exit_status
87
83
  @pid = nil
@@ -92,14 +88,14 @@ class GnomeAppDriver
92
88
  private
93
89
 
94
90
  def find_and_focus_frame
95
- acc = wait_for('app to appear', 10) { find_app }
96
- raise 'App not found' unless acc
91
+ @application = wait_for("app to appear", 10) { find_app }
92
+ raise "App not found" unless @application
97
93
 
98
- frame = acc.get_child_at_index 0
94
+ frame = @application.get_child_at_index 0
99
95
  role = frame.role
100
96
  raise "Frame has unexpected role #{role.inspect}" unless role == :frame
101
97
 
102
- wait_for('frame to be focused', 10) do
98
+ wait_for("frame to be focused", 10) do
103
99
  frame.state_set.contains(Atspi::StateType::ACTIVE)
104
100
  end
105
101
 
@@ -108,7 +104,7 @@ class GnomeAppDriver
108
104
 
109
105
  def kill_process
110
106
  log "About to kill child process #{@pid}"
111
- Process.kill 'KILL', @pid
107
+ Process.kill "KILL", @pid
112
108
  end
113
109
 
114
110
  def log(message)
metadata CHANGED
@@ -1,119 +1,197 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnome_app_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.2
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: 2018-11-03 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gobject-introspection
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '3.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
27
33
  - !ruby/object:Gem::Dependency
28
- name: bundler
34
+ name: gtk3
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: '3.2'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '5.0'
34
43
  type: :development
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '0'
49
+ version: '3.2'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '5.0'
41
53
  - !ruby/object:Gem::Dependency
42
- name: gtk3
54
+ name: minitest
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
57
  - - "~>"
46
58
  - !ruby/object:Gem::Version
47
- version: '3.2'
59
+ version: '5.12'
48
60
  type: :development
49
61
  prerelease: false
50
62
  version_requirements: !ruby/object:Gem::Requirement
51
63
  requirements:
52
64
  - - "~>"
53
65
  - !ruby/object:Gem::Version
54
- version: '3.2'
66
+ version: '5.12'
55
67
  - !ruby/object:Gem::Dependency
56
- name: minitest
68
+ name: pry
57
69
  requirement: !ruby/object:Gem::Requirement
58
70
  requirements:
59
71
  - - "~>"
60
72
  - !ruby/object:Gem::Version
61
- version: '5.5'
73
+ version: 0.14.0
62
74
  type: :development
63
75
  prerelease: false
64
76
  version_requirements: !ruby/object:Gem::Requirement
65
77
  requirements:
66
78
  - - "~>"
67
79
  - !ruby/object:Gem::Version
68
- version: '5.5'
80
+ version: 0.14.0
69
81
  - !ruby/object:Gem::Dependency
70
82
  name: rake
71
83
  requirement: !ruby/object:Gem::Requirement
72
84
  requirements:
73
85
  - - "~>"
74
86
  - !ruby/object:Gem::Version
75
- version: '12.0'
87
+ version: '13.0'
76
88
  type: :development
77
89
  prerelease: false
78
90
  version_requirements: !ruby/object:Gem::Requirement
79
91
  requirements:
80
92
  - - "~>"
81
93
  - !ruby/object:Gem::Version
82
- version: '12.0'
83
- description:
94
+ version: '13.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rubocop
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '1.34'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '1.34'
109
+ - !ruby/object:Gem::Dependency
110
+ name: rubocop-minitest
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: 0.21.0
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: 0.21.0
123
+ - !ruby/object:Gem::Dependency
124
+ name: rubocop-packaging
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: 0.5.1
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: 0.5.1
137
+ - !ruby/object:Gem::Dependency
138
+ name: rubocop-performance
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '1.13'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '1.13'
151
+ description: 'Driver to test the UI of applications using Ruby-GNOME2 by interacting
152
+ with them via Atspi.
153
+
154
+ '
84
155
  email:
85
156
  - matijs@matijs.net
86
157
  executables: []
87
158
  extensions: []
88
- extra_rdoc_files: []
159
+ extra_rdoc_files:
160
+ - README.md
161
+ - Changelog.md
89
162
  files:
90
163
  - Changelog.md
91
- - Gemfile
92
164
  - LICENSE
93
165
  - README.md
94
- - Rakefile
95
166
  - lib/gnome_app_driver.rb
167
+ - lib/gnome_app_driver/version.rb
96
168
  homepage: http://www.github.com/mvz/ruby-gnome2_app_driver
97
- licenses: []
98
- metadata: {}
99
- post_install_message:
100
- rdoc_options: []
169
+ licenses:
170
+ - LGPL-2.1+
171
+ metadata:
172
+ homepage_uri: http://www.github.com/mvz/ruby-gnome2_app_driver
173
+ source_code_uri: https://github.com/mvz/ruby-gnome2_app_driver
174
+ changelog_uri: https://github.com/mvzruby-gnome2_app_driver/blob/master/Changelog.md
175
+ rubygems_mfa_required: 'true'
176
+ post_install_message:
177
+ rdoc_options:
178
+ - "--main"
179
+ - README.md
101
180
  require_paths:
102
181
  - lib
103
182
  required_ruby_version: !ruby/object:Gem::Requirement
104
183
  requirements:
105
184
  - - ">="
106
185
  - !ruby/object:Gem::Version
107
- version: 2.3.0
186
+ version: 2.6.0
108
187
  required_rubygems_version: !ruby/object:Gem::Requirement
109
188
  requirements:
110
189
  - - ">="
111
190
  - !ruby/object:Gem::Version
112
191
  version: '0'
113
192
  requirements: []
114
- rubyforge_project:
115
- rubygems_version: 2.7.6
116
- signing_key:
193
+ rubygems_version: 3.3.7
194
+ signing_key:
117
195
  specification_version: 4
118
196
  summary: Test Ruby-GNOME2 applications using Atspi
119
197
  test_files: []
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
data/Rakefile DELETED
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rake/clean'
4
- require 'bundler/gem_tasks'
5
- require 'rake/testtask'
6
-
7
- namespace :test do
8
- Rake::TestTask.new(:end_to_end) do |t|
9
- t.libs = ['lib']
10
- t.test_files = FileList['test/end_to_end/*_test.rb']
11
- t.warning = true
12
- end
13
-
14
- task all: [:end_to_end]
15
- end
16
-
17
- task test: 'test:all'
18
-
19
- task default: 'test'