mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2025-05-06 17:41:34 +00:00
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
This commit is contained in:
parent
891868e77a
commit
653fb2938f
@ -240,6 +240,10 @@ testtags.extend(f"anaconda_main_hub_{fsys}" for fsys in ('language_support', 'se
|
|||||||
'time_date', 'create_user','keyboard_layout'))
|
'time_date', 'create_user','keyboard_layout'))
|
||||||
for selection in ("hide", "maximize", "restore"):
|
for selection in ("hide", "maximize", "restore"):
|
||||||
testtags.append(f"calculator_context_{selection}")
|
testtags.append(f"calculator_context_{selection}")
|
||||||
|
# After the change to menu_launch_type, applications should be whitelisted here
|
||||||
|
# to prevent the unused needles warning in case of apps_run_<application>.
|
||||||
|
for app in ("focuswriter", "gvim"):
|
||||||
|
testtags.append(f"apps_run_{app}")
|
||||||
|
|
||||||
# retcode tracker
|
# retcode tracker
|
||||||
ret = 0
|
ret = 0
|
||||||
|
40
lib/utils.pm
40
lib/utils.pm
@ -1370,27 +1370,43 @@ sub menu_launch_type {
|
|||||||
# Launch an application in a graphical environment, by opening a
|
# Launch an application in a graphical environment, by opening a
|
||||||
# launcher, typing the specified string and hitting enter. Pass
|
# launcher, typing the specified string and hitting enter. Pass
|
||||||
# the string to be typed to launch whatever it is you want.
|
# the string to be typed to launch whatever it is you want.
|
||||||
my ($app, $maximize) = @_;
|
# Use maximize => 1 to maximize the application after it
|
||||||
|
# is started.
|
||||||
|
# Use checkstart => 1 to check that the application has started
|
||||||
|
my ($application, %args) = @_;
|
||||||
my $desktop = get_var("DESKTOP");
|
my $desktop = get_var("DESKTOP");
|
||||||
|
|
||||||
|
# The standard combo key is the "super" key, just in I3
|
||||||
|
# it is different.
|
||||||
my $key = 'super';
|
my $key = 'super';
|
||||||
$key = 'alt-d' if ($desktop eq "i3");
|
$key = 'alt-d' if ($desktop eq "i3");
|
||||||
if ($desktop eq "kde") {
|
|
||||||
# To overcome BZ2097208, let's move the mouse out of the way
|
# In KDE, we have been experiencing BZ2097208.
|
||||||
|
# To overcome this let's move the mouse out of the way
|
||||||
# and give the launcher some time to take the correct focus.
|
# and give the launcher some time to take the correct focus.
|
||||||
|
if ($desktop eq "kde") {
|
||||||
diag("Moving the mouse away from the launcher.");
|
diag("Moving the mouse away from the launcher.");
|
||||||
mouse_set(1, 1);
|
mouse_set(1, 1);
|
||||||
}
|
}
|
||||||
|
# Open the launching mode
|
||||||
wait_screen_change { send_key $key; };
|
wait_screen_change { send_key $key; };
|
||||||
# srsly KDE y u so slo
|
# Give enough wait time for the everything to settle,
|
||||||
|
# especially KDE is quite slow in responses.
|
||||||
wait_still_screen 3;
|
wait_still_screen 3;
|
||||||
type_very_safely $app;
|
type_very_safely($application);
|
||||||
# Wait for KDE to place focus correctly.
|
# Wait to place focus correctly.
|
||||||
wait_still_screen 2;
|
wait_still_screen 2;
|
||||||
send_key 'ret';
|
send_key 'ret';
|
||||||
wait_still_screen 3;
|
wait_still_screen 3;
|
||||||
diag("Launcher: The application $app should have been launched.");
|
|
||||||
# If we should maximize the application
|
# If check that app is running was requested
|
||||||
if ($maximize) {
|
# with checkstart => 1
|
||||||
|
if ($args{checkstart}) {
|
||||||
|
assert_screen("apps_run_$application");
|
||||||
|
}
|
||||||
|
# If maximizing the application was requested
|
||||||
|
# with maximize => 1
|
||||||
|
if ($args{maximize}) {
|
||||||
if ($desktop eq "kde") {
|
if ($desktop eq "kde") {
|
||||||
send_key('super-pgup');
|
send_key('super-pgup');
|
||||||
}
|
}
|
||||||
@ -1398,10 +1414,9 @@ sub menu_launch_type {
|
|||||||
send_key('super-up');
|
send_key('super-up');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diag('Maximizing in this desktop is not supported at the moment!');
|
record_soft_failure('Maximizing in this desktop is not supported at the moment!');
|
||||||
}
|
}
|
||||||
wait_still_screen 3;
|
wait_still_screen 3;
|
||||||
diag("Maximizer: The application should have been maximized.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1618,6 +1633,7 @@ sub register_application {
|
|||||||
# launch a terminal from a desktop, using the most efficient/reliable
|
# launch a terminal from a desktop, using the most efficient/reliable
|
||||||
# approach (not appropriate if we really need to test launching it a
|
# approach (not appropriate if we really need to test launching it a
|
||||||
# specific way)
|
# specific way)
|
||||||
|
# Check, that the application has started.
|
||||||
sub desktop_launch_terminal {
|
sub desktop_launch_terminal {
|
||||||
my $desktop = get_var("DESKTOP");
|
my $desktop = get_var("DESKTOP");
|
||||||
if ($desktop eq "i3") {
|
if ($desktop eq "i3") {
|
||||||
@ -1627,7 +1643,7 @@ sub desktop_launch_terminal {
|
|||||||
send_key "ctrl-alt-t";
|
send_key "ctrl-alt-t";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
menu_launch_type "terminal";
|
menu_launch_type("terminal", checkstart => 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,12 +22,7 @@ sub run {
|
|||||||
set_update_notification_timestamp();
|
set_update_notification_timestamp();
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
menu_launch_type("nautilus");
|
menu_launch_type("nautilus", checkstart => 1, maximize => 1);
|
||||||
# Check it has started
|
|
||||||
assert_screen 'apps_run_files';
|
|
||||||
# Fullsize the window.
|
|
||||||
wait_screen_change { send_key("super-up"); };
|
|
||||||
wait_still_screen 3;
|
|
||||||
|
|
||||||
# Open the Documents directory
|
# Open the Documents directory
|
||||||
assert_and_click("gnome_open_location_documents");
|
assert_and_click("gnome_open_location_documents");
|
||||||
|
@ -12,7 +12,7 @@ sub run {
|
|||||||
sleep(5);
|
sleep(5);
|
||||||
# The full screen is not supported by any application, but it
|
# The full screen is not supported by any application, but it
|
||||||
# is supported by several, such as Terminal.
|
# is supported by several, such as Terminal.
|
||||||
menu_launch_type("terminal", "maximize");
|
menu_launch_type("terminal", maximize => 1);
|
||||||
# If we see prompt, everything is ok.
|
# If we see prompt, everything is ok.
|
||||||
assert_screen("terminal_prompt");
|
assert_screen("terminal_prompt");
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ sub run {
|
|||||||
# Let us wait here for a couple of seconds to give the VM time to settle.
|
# Let us wait here for a couple of seconds to give the VM time to settle.
|
||||||
# Starting right over might result in erroneous behavior.
|
# Starting right over might result in erroneous behavior.
|
||||||
sleep(5);
|
sleep(5);
|
||||||
menu_launch_type("text editor", "maximize");
|
menu_launch_type("text editor", maximize => 1);
|
||||||
assert_screen("apps_run_texteditor");
|
assert_screen("apps_run_texteditor");
|
||||||
menu_launch_type("files", "maximize");
|
menu_launch_type("files", maximize => 1);
|
||||||
assert_screen("apps_run_files");
|
assert_screen("apps_run_files");
|
||||||
|
|
||||||
# If we are at Nautilus switch to editor
|
# If we are at Nautilus switch to editor
|
||||||
|
@ -72,16 +72,16 @@ sub run {
|
|||||||
### Switch between more applications
|
### Switch between more applications
|
||||||
|
|
||||||
# Start more applications.
|
# Start more applications.
|
||||||
menu_launch_type("clocks", "maximize");
|
menu_launch_type("clocks", maximize => 1);
|
||||||
# Sometime, Clocks start with an access request,
|
# Sometime, Clocks start with an access request,
|
||||||
# deny it.
|
# deny it.
|
||||||
if (check_screen('grant_access', 5)) {
|
if (check_screen('grant_access', 5)) {
|
||||||
send_key('ret');
|
send_key('ret');
|
||||||
}
|
}
|
||||||
assert_screen('apps_run_clocks');
|
assert_screen('apps_run_clocks');
|
||||||
menu_launch_type("calculator", "maximize");
|
menu_launch_type("calculator", maximize => 1);
|
||||||
assert_screen('apps_run_calculator');
|
assert_screen('apps_run_calculator');
|
||||||
menu_launch_type("terminal", "maximize");
|
menu_launch_type("terminal", maximize => 1);
|
||||||
assert_screen('apps_run_terminal');
|
assert_screen('apps_run_terminal');
|
||||||
|
|
||||||
## Going forwards
|
## Going forwards
|
||||||
|
@ -27,9 +27,9 @@ sub run {
|
|||||||
# Let us wait here for a couple of seconds to give the VM time to settle.
|
# Let us wait here for a couple of seconds to give the VM time to settle.
|
||||||
# Starting right over might result in erroneous behavior.
|
# Starting right over might result in erroneous behavior.
|
||||||
sleep(5);
|
sleep(5);
|
||||||
menu_launch_type("files", "maximize");
|
menu_launch_type("files", maximize => 1);
|
||||||
assert_screen('apps_run_files');
|
assert_screen('apps_run_files');
|
||||||
menu_launch_type("text editor", "maximize");
|
menu_launch_type("text editor", maximize => 1);
|
||||||
assert_screen('apps_run_texteditor');
|
assert_screen('apps_run_texteditor');
|
||||||
|
|
||||||
# The focused application should be the Editor, so let's check it is
|
# The focused application should be the Editor, so let's check it is
|
||||||
|
@ -31,8 +31,7 @@ sub run {
|
|||||||
# Now, we will switch into the Desktop and we will try to run the application
|
# Now, we will switch into the Desktop and we will try to run the application
|
||||||
desktop_vt();
|
desktop_vt();
|
||||||
wait_still_screen(3);
|
wait_still_screen(3);
|
||||||
menu_launch_type("gvim");
|
menu_launch_type("gvim", checkstart => 1);
|
||||||
assert_screen("apps_run_gvim");
|
|
||||||
# Switch off the application
|
# Switch off the application
|
||||||
type_very_safely(":qa\n");
|
type_very_safely(":qa\n");
|
||||||
|
|
||||||
|
@ -37,9 +37,7 @@ sub run {
|
|||||||
# Switch to desktop and try to run the application.
|
# Switch to desktop and try to run the application.
|
||||||
desktop_vt();
|
desktop_vt();
|
||||||
wait_still_screen(3);
|
wait_still_screen(3);
|
||||||
menu_launch_type("focuswriter");
|
menu_launch_type("focuswriter", checkstart => 1);
|
||||||
# Check that it started
|
|
||||||
assert_screen("apps_run_focuswriter");
|
|
||||||
# Stop the application
|
# Stop the application
|
||||||
send_key("alt-f4");
|
send_key("alt-f4");
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ sub run {
|
|||||||
# According to the ticket, the 'fedora.json' file
|
# According to the ticket, the 'fedora.json' file
|
||||||
# which lists the available versions will be created
|
# which lists the available versions will be created
|
||||||
# after the Software starts. Let's start it then on Gnome.
|
# after the Software starts. Let's start it then on Gnome.
|
||||||
menu_launch_type("software");
|
menu_launch_type("software", checkstart => 1);
|
||||||
# When Software is started for the first time, it asks whether
|
# When Software is started for the first time, it asks whether
|
||||||
# a user wants to use Third Party software. We want to Ignore
|
# a user wants to use Third Party software. We want to Ignore
|
||||||
# this and proceed, so if we see that we click on Ignore.
|
# this and proceed, so if we see that we click on Ignore.
|
||||||
|
@ -50,7 +50,7 @@ sub run {
|
|||||||
# on which DE we are on.
|
# on which DE we are on.
|
||||||
my $pkgmgr = "software";
|
my $pkgmgr = "software";
|
||||||
$pkgmgr = "discover" if ($desktop eq "kde");
|
$pkgmgr = "discover" if ($desktop eq "kde");
|
||||||
menu_launch_type($pkgmgr);
|
menu_launch_type($pkgmgr, checkstart => 1);
|
||||||
|
|
||||||
# On Gnome, the upgrade is safely visible when
|
# On Gnome, the upgrade is safely visible when
|
||||||
# we visit the Update page by clicking on the
|
# we visit the Update page by clicking on the
|
||||||
|
Loading…
Reference in New Issue
Block a user