Skip to content

Commit

Permalink
Merge pull request #8 from os-autoinst/icewm
Browse files Browse the repository at this point in the history
Add support for icewm
  • Loading branch information
okurz authored Nov 26, 2023
2 parents 8dbda6b + b43cd3b commit 07a823b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions lib/OpenQA/Wheel/Launcher.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package OpenQA::Wheel::Launcher;
use Mojo::Base 'Exporter', -signatures;

use testapi qw(send_key assert_screen check_screen save_screenshot type_string mouse_hide wait_screen_change);
use testapi qw(send_key assert_screen check_var check_screen save_screenshot type_string mouse_hide wait_screen_change);

our @EXPORT_OK = qw(start_gui_program);

Expand All @@ -15,12 +15,14 @@ It is meant to be added to your distribution's wheels.yaml.
=cut

sub desktop_runner_hotkey () { check_var('DESKTOP', 'minimalx') ? 'ctrl-alt-spc' : 'alt-f2' }

=head1 test API
=head2 start_gui_program
The given program will be launched via the command prompt
of the desktop environment, assuming it's accessible via F2.
The given program will be launched via the command prompt of the desktop
environment with an environment-specific hotkey.
The needle 'desktop-runner' must be matched.
Expand All @@ -32,7 +34,7 @@ needle 'desktop-runner-border' will be required.
=cut

sub start_gui_program ($program, $timeout = undef, %args) {
send_key 'alt-f2';
send_key(desktop_runner_hotkey());
mouse_hide(1);
assert_screen('desktop-runner', $timeout);
type_string $program;
Expand Down
6 changes: 4 additions & 2 deletions t/01-launcher.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ subtest 'run wheel as a whole' => sub {

tests::wheels::launcher->new->run;
is_deeply testapi::invoked_functions, [
[send_key => ('alt-f2')],
[check_var => ('DESKTOP', 'minimalx')],
[send_key => ('ctrl-alt-spc')],
[mouse_hide => (1)],
[assert_screen => ('desktop-runner', undef)],
[type_string => ('firefox')],
Expand All @@ -32,7 +33,8 @@ subtest 'helper for starting GUI program with custom timeout, terminal and valid

start_gui_program('foo', 42, valid => 1, terminal => 1);
is_deeply testapi::invoked_functions, [
[send_key => ('alt-f2')],
[check_var => ('DESKTOP', 'minimalx')],
[send_key => ('ctrl-alt-spc')],
[mouse_hide => (1)],
[assert_screen => ('desktop-runner', 42)], # timeout passed to assert_screen
[type_string => ('foo')], # program name typed
Expand Down
2 changes: 1 addition & 1 deletion t/lib/testapi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Exporter;
use Mojo::Base 'Exporter', -signatures;

# list names of test API functions our wheel is expected to call
our @EXPORT = qw(send_key assert_screen check_screen save_screenshot type_string mouse_hide wait_screen_change);
our @EXPORT = qw(send_key assert_screen check_var check_screen save_screenshot type_string mouse_hide wait_screen_change);

# define helpers for tracking invoked test API functions
my @INVOKED;
Expand Down

0 comments on commit 07a823b

Please sign in to comment.