Factor out the KDE launcher double-typing workaround, use it more

There's a couple of places where we do menu_launch_type in KDE
without doing this workaround first, and they do run into the
bug sometimes. Let's factor it out from the few places it's
already repeated, and add it to the places it is missing.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2024-06-11 16:21:00 -07:00
parent 992e51f5c5
commit 943c4193d3
7 changed files with 28 additions and 23 deletions

View File

@ -7,7 +7,7 @@ use Exporter;
use lockapi;
use testapi qw(is_serial_terminal :DEFAULT);
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type setup_repos repo_setup get_workarounds disable_updates_repos cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log repos_mirrorlist register_application get_registered_applications solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp/;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type setup_repos repo_setup get_workarounds disable_updates_repos cleanup_workaround_repo console_initial_setup handle_welcome_screen gnome_initial_setup anaconda_create_user check_desktop download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log repos_mirrorlist register_application get_registered_applications solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp kde_doublek_workaround/;
# We introduce this global variable to hold the list of applications that have
@ -1764,4 +1764,18 @@ sub start_applications {
enter_cmd("exit");
}
# this is a workaround for an annoying KDE bug where the first character
# typed into the launcher is often repeated. I think it's due to KDE
# working hard to cache all the launchers, or something, so we try to
# work around it by doing a 'throwaway' open, type a 'k', wait a bit,
# close operation before we do anything 'real'. this is repeated in
# several tests so we share it here
sub kde_doublek_workaround {
wait_screen_change { send_key 'super'; };
wait_still_screen 3;
send_key "k";
wait_still_screen 5;
send_key "esc";
}
1;

View File

@ -63,6 +63,8 @@ sub connect_localhost {
# Therefore, we will use a different approach - we will enable
# CLI keyring integration and perform an SFTP connection
# in Konsole.
# try and avoid double-typing issues
kde_doublek_workaround;
menu_launch_type("konsole");
assert_screen("konsole_runs");
# Export the environmental variables, this is needed for the process

View File

@ -34,6 +34,8 @@ sub connect_localhost {
assert_screen("apps_run_terminal");
}
else {
# try and avoid double-typing issues
kde_doublek_workaround;
menu_launch_type("konsole");
assert_screen("konsole_runs");
export_kde_vars();

View File

@ -9,14 +9,7 @@ use utils;
sub run {
my $self = shift;
solidify_wallpaper;
# to try and avoid problems with kde grinding a lot on first
# attempt to do a menu_launch_type, let's do a throwaway one
# here before we snapshot
wait_screen_change { send_key 'super'; };
wait_still_screen 3;
send_key "k";
wait_still_screen 5;
send_key "esc";
kde_doublek_workaround;
}
sub test_flags {

View File

@ -52,6 +52,10 @@ sub run {
# give the desktop a few seconds to settle, we seem to be getting
# a lot of mis-types in KDE if we do not, as of 2024-02
wait_still_screen(3);
# On KDE, try and avoid double-typing issues
if ($desktop eq "kde") {
kde_doublek_workaround;
}
# Let's open the terminal. We will use it to start the applications
# as well as to check for the name of the printed file.
menu_launch_type($term);

View File

@ -23,13 +23,8 @@ sub run {
# run the updater
if ($desktop eq 'kde') {
# try and avoid double-typing issues, same way we do
# for apps_startstop test
wait_screen_change { send_key 'super'; };
wait_still_screen 3;
send_key "k";
wait_still_screen 5;
send_key "esc";
# try and avoid double-typing issues
kde_doublek_workaround;
menu_launch_type('discover');
# Wait for it to run and maximize it to make sure we see the
# Updates entry

View File

@ -41,14 +41,9 @@ sub run {
}
# Let's check, that the desktop is shown.
check_desktop();
# On KDE, try and avoid double-typing issues, same way we do
# for apps_startstop test
# On KDE, try and avoid double-typing issues
if ($desktop eq "kde") {
wait_screen_change { send_key 'super'; };
wait_still_screen 3;
send_key "k";
wait_still_screen 5;
send_key "esc";
kde_doublek_workaround;
}
# Start the package manager application depending