atspi_app_driver 0.4.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +23 -1
- data/LICENSE.txt +21 -0
- data/README.md +2 -1
- data/lib/atspi_app_driver.rb +19 -20
- metadata +87 -29
- data/Gemfile +0 -5
- data/LICENSE +0 -21
- data/Rakefile +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d235fd796fc2323cf5472af0fb6fedea49fa23378e06a8f068087c14c4f03c6
|
4
|
+
data.tar.gz: 8d60254528f6cc5239c24566feec23c900bc6775a7d9135e992883db3a5ea76e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e76acba6cd278dd693f54ebc1bfc133b79d12290b167e9101bc6dbf24247ea1ef4a0bbc384e29666b6775bf2d89e3eb971608b0a2ab044ee705326a342f1d485
|
7
|
+
data.tar.gz: 58adb7bd1c7e158382de9316bcc2ade467940ebc948115f9ae686e7165ab31c8fc41f9fbe4e1f908b2968771bfc8929d6865f90a868dc18fe37bf2972f9a1fc3
|
data/Changelog.md
CHANGED
@@ -1,9 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.7.1 / 2022-01-23
|
4
|
+
|
5
|
+
* Drop support for Ruby version 2.5
|
6
|
+
* Support up to Ruby 3.1
|
7
|
+
|
8
|
+
## 0.7.0 / 2020-11-14
|
9
|
+
|
10
|
+
* Drop support for Ruby version 2.4
|
11
|
+
* Remove `AtspiAppDriver#press_ctrl_q` because it does not and likely will
|
12
|
+
never work on Wayland. Use a regular action to quit your application instead.
|
13
|
+
* Provide access to the main application Atspi object through
|
14
|
+
AtspiAppDriver#application
|
15
|
+
|
16
|
+
## 0.6.0 / 2019-10-19
|
17
|
+
|
18
|
+
* Depend on GirFFI 0.15.0 and GirFFI-Gtk 0.15.0
|
19
|
+
* Drop support for Ruby versions 2.2 and 2.3
|
20
|
+
|
21
|
+
## 0.5.0 / 2018-09-27
|
22
|
+
|
23
|
+
* Depend on GirFFI 0.14.0 and GirFFI-Gtk 0.14.0
|
24
|
+
|
3
25
|
## 0.4.0 / 2018-09-08
|
4
26
|
|
5
27
|
* Drop support for Ruby 2.1
|
6
|
-
* Depend on GirFFI 0.13.0
|
28
|
+
* Depend on GirFFI 0.13.0 and GirFFI-Gtk 0.13.0
|
7
29
|
|
8
30
|
## 0.3.1 / 2018-05-31
|
9
31
|
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015-2020 Matijs van Zuijlen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
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
|
-
|
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
|
data/lib/atspi_app_driver.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi"
|
4
4
|
|
5
5
|
GirFFI.setup :Atspi
|
6
6
|
Atspi.load_class :Accessible
|
@@ -16,6 +16,7 @@ module AtspiAccessiblePatches
|
|
16
16
|
|
17
17
|
def find_role(role, regex = //)
|
18
18
|
return self if role == self.role && name =~ regex
|
19
|
+
|
19
20
|
each_child do |child|
|
20
21
|
result = child.find_role role, regex
|
21
22
|
return result if result
|
@@ -24,7 +25,7 @@ module AtspiAccessiblePatches
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def inspect_recursive(level = 0, maxlevel = 5)
|
27
|
-
puts "#{
|
28
|
+
puts "#{" " * level} > name: #{name}; role: #{role}"
|
28
29
|
each_child do |child|
|
29
30
|
child.inspect_recursive(level + 1) unless level >= maxlevel
|
30
31
|
end
|
@@ -38,7 +39,7 @@ Atspi::Accessible.include AtspiAccessiblePatches
|
|
38
39
|
class AtspiAppDriver
|
39
40
|
def initialize(app_name, app_file: nil, verbose: false)
|
40
41
|
@app_file = app_file || "bin/#{app_name}"
|
41
|
-
@lib_dir =
|
42
|
+
@lib_dir = "lib"
|
42
43
|
@app_name = app_name
|
43
44
|
@pid = nil
|
44
45
|
@verbose = verbose
|
@@ -46,10 +47,10 @@ class AtspiAppDriver
|
|
46
47
|
@thread = nil
|
47
48
|
end
|
48
49
|
|
49
|
-
attr_reader :frame
|
50
|
+
attr_reader :frame, :application
|
50
51
|
|
51
52
|
def boot(test_timeout: 30, exit_timeout: 10, arguments: [])
|
52
|
-
raise
|
53
|
+
raise "Already booted" if @pid
|
53
54
|
|
54
55
|
spawn_process(arguments)
|
55
56
|
|
@@ -58,42 +59,36 @@ class AtspiAppDriver
|
|
58
59
|
@frame = find_and_focus_frame
|
59
60
|
|
60
61
|
@thread = Thread.new do
|
61
|
-
wait_for(
|
62
|
-
wait_for(
|
62
|
+
wait_for("test to be done", test_timeout) { @cleanup }
|
63
|
+
wait_for("pid to go away", exit_timeout) { !@pid }
|
63
64
|
kill_process if @pid
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
67
68
|
def spawn_process(arguments)
|
68
|
-
command = "ruby -I#{@lib_dir} #{@app_file} #{arguments.join(
|
69
|
+
command = "ruby -I#{@lib_dir} #{@app_file} #{arguments.join(" ")}"
|
69
70
|
log "About to spawn: `#{command}`"
|
70
71
|
@pid = Process.spawn command
|
71
72
|
end
|
72
73
|
|
73
|
-
def press_ctrl_q
|
74
|
-
Atspi.generate_keyboard_event(37, nil, :press)
|
75
|
-
Atspi.generate_keyboard_event(24, nil, :pressrelease)
|
76
|
-
Atspi.generate_keyboard_event(37, nil, :release)
|
77
|
-
end
|
78
|
-
|
79
74
|
def cleanup
|
80
75
|
status = exit_status
|
81
76
|
@pid = nil
|
82
|
-
@thread
|
77
|
+
@thread&.join
|
83
78
|
status
|
84
79
|
end
|
85
80
|
|
86
81
|
private
|
87
82
|
|
88
83
|
def find_and_focus_frame
|
89
|
-
|
90
|
-
raise
|
84
|
+
@application = wait_for("app to appear", 10) { find_app }
|
85
|
+
raise "App not found" unless @application
|
91
86
|
|
92
|
-
frame =
|
87
|
+
frame = @application.get_child_at_index 0
|
93
88
|
role = frame.role
|
94
89
|
raise "Frame has unexpected role #{role.inspect}" unless role == :frame
|
95
90
|
|
96
|
-
wait_for(
|
91
|
+
wait_for("frame to be focused", 10) do
|
97
92
|
frame.get_state_set.get_states.to_a.include? :active
|
98
93
|
end
|
99
94
|
|
@@ -102,7 +97,7 @@ class AtspiAppDriver
|
|
102
97
|
|
103
98
|
def kill_process
|
104
99
|
log "About to kill child process #{@pid}"
|
105
|
-
Process.kill
|
100
|
+
Process.kill "KILL", @pid
|
106
101
|
end
|
107
102
|
|
108
103
|
def log(message)
|
@@ -125,6 +120,7 @@ class AtspiAppDriver
|
|
125
120
|
50.times do |num|
|
126
121
|
result = yield
|
127
122
|
break if result
|
123
|
+
|
128
124
|
sleep 0.01 * (num + 1)
|
129
125
|
end
|
130
126
|
log "Waited #{Time.now - start} seconds for #{description}"
|
@@ -133,8 +129,11 @@ class AtspiAppDriver
|
|
133
129
|
|
134
130
|
def exit_status
|
135
131
|
return unless @pid
|
132
|
+
|
136
133
|
@cleanup = true
|
137
134
|
_, status = Process.wait2 @pid
|
138
135
|
status
|
139
136
|
end
|
140
137
|
end
|
138
|
+
|
139
|
+
require_relative "atspi_app_driver/version"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atspi_app_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.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:
|
11
|
+
date: 2022-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gir_ffi
|
@@ -16,71 +16,127 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.0
|
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: 0.
|
26
|
+
version: 0.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: gir_ffi-gtk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.15.0
|
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:
|
40
|
+
version: 0.15.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
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:
|
54
|
+
version: '5.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
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:
|
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: '
|
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.0
|
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.0
|
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
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
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.0
|
76
132
|
type: :development
|
77
133
|
prerelease: false
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
79
135
|
requirements:
|
80
136
|
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
description:
|
138
|
+
version: 1.13.0
|
139
|
+
description:
|
84
140
|
email:
|
85
141
|
- matijs@matijs.net
|
86
142
|
executables: []
|
@@ -88,15 +144,18 @@ extensions: []
|
|
88
144
|
extra_rdoc_files: []
|
89
145
|
files:
|
90
146
|
- Changelog.md
|
91
|
-
-
|
92
|
-
- LICENSE
|
147
|
+
- LICENSE.txt
|
93
148
|
- README.md
|
94
|
-
- Rakefile
|
95
149
|
- lib/atspi_app_driver.rb
|
96
150
|
homepage: http://www.github.com/mvz/atspi_app_driver
|
97
|
-
licenses:
|
98
|
-
|
99
|
-
|
151
|
+
licenses:
|
152
|
+
- MIT
|
153
|
+
metadata:
|
154
|
+
homepage_uri: http://www.github.com/mvz/atspi_app_driver
|
155
|
+
source_code_uri: https://github.com/mvz/atspi_app_driver
|
156
|
+
changelog_uri: https://github.com/mvz/atspi_app_driver/blob/master/Changelog.md
|
157
|
+
rubygems_mfa_required: 'true'
|
158
|
+
post_install_message:
|
100
159
|
rdoc_options: []
|
101
160
|
require_paths:
|
102
161
|
- lib
|
@@ -104,16 +163,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
163
|
requirements:
|
105
164
|
- - ">="
|
106
165
|
- !ruby/object:Gem::Version
|
107
|
-
version: 2.
|
166
|
+
version: 2.6.0
|
108
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
168
|
requirements:
|
110
169
|
- - ">="
|
111
170
|
- !ruby/object:Gem::Version
|
112
171
|
version: '0'
|
113
172
|
requirements: []
|
114
|
-
|
115
|
-
|
116
|
-
signing_key:
|
173
|
+
rubygems_version: 3.3.3
|
174
|
+
signing_key:
|
117
175
|
specification_version: 4
|
118
176
|
summary: Test GirFFI-based applications using Atspi
|
119
177
|
test_files: []
|
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Matijs van Zuijlen
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
'Software'), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
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'
|