1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-06-21 22:11:33 +00:00
os-autoinst-distri-fedora/tests/applications/navigation/switch_workplaces.pm
Lukáš Růžička 653fb2938f Enhance the menu_launch_type subroutine.
The previous version of menu_launch_type took the name of the
application as an argument and it started the application.
To maximize the application or to check that it has started indeed
we had to do it manually.

Now, the application also takes "maximize => 1" or "checkstart => 1"
to maximize the application or check that it has started as optional
arguments to avoid doing it manually, while it still accepts just
the name of the application and behaves like it did before.

Note that if you decide to use the checkstart argument, you
also need to update the check-needles.py script to whitelist
the application needle tag, see the example test scripts
attached to this PR.

Fixes: https://pagure.io/fedora-qa/os-autoinst-distri-fedora/issue/329
2025-03-05 19:59:40 +00:00

70 lines
2.4 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
# This will test that user can switch between two workspaces,
# that we can move an application to another workspace.
sub move_to_workspace {
# This will use Shift-Ctrl-Alt to move the focused app to
# the $direction (left or right).
my $direction = shift;
wait_screen_change { send_key("shift-ctrl-alt-$direction"); };
wait_still_screen 5;
}
sub switch_to_workspace {
# This will use Ctrl-Alt to switch to another workspace
# using the $direction (left, right)
my $direction = shift;
wait_screen_change { send_key("ctrl-alt-$direction"); };
wait_still_screen 5;
}
sub run {
my $self = shift;
# Let us wait here for a couple of seconds to give the VM time to settle.
# Starting right over might result in erroneous behavior.
sleep(5);
menu_launch_type("files", maximize => 1);
assert_screen('apps_run_files');
menu_launch_type("text editor", maximize => 1);
assert_screen('apps_run_texteditor');
# The focused application should be the Editor, so let's check it is
# visible on the beginning screen. Then switch to another workplace.
# This one should be empty, therefore checking for the Editor should fail.
# The opposite will be true, when we switch back
assert_screen("apps_run_texteditor");
switch_to_workspace("right");
die("The workspaces were not switched!") if (check_screen("apps_run_texteditor"));
switch_to_workspace("left");
die("The workspaces were not switched") unless (check_screen("apps_run_texteditor"));
# Now, we will move the focused application (Editor) to the second workspace.
# The application will be still visible there. When we switch back, the application
# will no longer be visible on the first workspace and will uncover Nautilus and
# we check that it is there. We will also enter the Activitities mode and will check
# that currently three workspaces can be used (top bar of the screen).
move_to_workspace("right");
die("The application was not moved!") unless (check_screen("apps_run_texteditor"));
switch_to_workspace("left");
die("The workspaces were not switched") unless (check_screen("apps_run_files"));
send_key("super");
wait_still_screen(2);
assert_screen("navigation_three_workspaces");
}
sub test_flags {
return {always_rollback => 1};
}
1;
# vim: set sw=4 et: