From 7e352e429c6e132981cfdbfabae175c0e710f282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Wed, 5 Mar 2025 10:36:32 +0100 Subject: [PATCH] Use special start checking on Software. The enhanced method of menu_launch_type does not cover for special corner cases, where the application starts in a specific mode (settings dialogues etc.) This handles exceptions for Software. --- lib/utils.pm | 17 ++++++++++++++++- tests/apps_startstop/gnome/software.pm | 8 ++------ tests/graphical_upgrade_prerequisites.pm | 6 +++++- tests/graphical_upgrade_run.pm | 13 ++++++++++--- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index ea27c144..906b33be 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -6,7 +6,7 @@ use base 'Exporter'; 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 quit_firefox advisory_get_installed_packages acnp_handle_output 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 desktop_launch_terminal solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp kde_doublek_workaround dm_perform_login/; +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 quit_firefox advisory_get_installed_packages acnp_handle_output 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 desktop_launch_terminal solidify_wallpaper check_and_install_git download_testdata make_serial_writable set_update_notification_timestamp kde_doublek_workaround dm_perform_login check_software_start/; # We introduce this global variable to hold the list of applications that have @@ -1862,4 +1862,19 @@ sub dm_perform_login { send_key "ret"; } +# With Gnome Software it is a bit more complicated to check +# that the application has started correctly, because on first +# runs (most of the tests), it keeps asking about third party +# repositories. +# This subroutine handles it, so we can use it on multiple +# places around the test cases. +sub check_software_start { + if (check_screen("gnome_software_ignore", 10)) { + wait_still_screen(3); + # match again as the dialog might have moved a bit + assert_and_click("gnome_software_ignore"); + } + assert_screen("desktop_package_tool_update"); +} + 1; diff --git a/tests/apps_startstop/gnome/software.pm b/tests/apps_startstop/gnome/software.pm index 58d43c00..f47579aa 100644 --- a/tests/apps_startstop/gnome/software.pm +++ b/tests/apps_startstop/gnome/software.pm @@ -13,12 +13,8 @@ sub run { # check if third party dialog appears, if so, click it away - if (check_screen 'gnome_software_ignore', 10) { - wait_still_screen 3; - # match again as the dialog may have moved a bit - assert_and_click 'gnome_software_ignore'; - } - assert_screen 'desktop_package_tool_update'; + check_software_start(); + # Register application register_application("gnome-software"); # Close the application diff --git a/tests/graphical_upgrade_prerequisites.pm b/tests/graphical_upgrade_prerequisites.pm index 4d3bc1d9..731970f2 100644 --- a/tests/graphical_upgrade_prerequisites.pm +++ b/tests/graphical_upgrade_prerequisites.pm @@ -45,7 +45,11 @@ sub run { # According to the ticket, the 'fedora.json' file # which lists the available versions will be created # after the Software starts. Let's start it then on Gnome. - menu_launch_type("software", checkstart => 1); + # Do not use the default start checks, because they could + # fail, check manually instead. + menu_launch_type("software"); + check_software_start(); + # When Software is started for the first time, it asks whether # a user wants to use Third Party software. We want to Ignore # this and proceed, so if we see that we click on Ignore. diff --git a/tests/graphical_upgrade_run.pm b/tests/graphical_upgrade_run.pm index e038414b..0cd68d81 100644 --- a/tests/graphical_upgrade_run.pm +++ b/tests/graphical_upgrade_run.pm @@ -48,9 +48,16 @@ sub run { # Start the package manager application depending # on which DE we are on. - my $pkgmgr = "software"; - $pkgmgr = "discover" if ($desktop eq "kde"); - menu_launch_type($pkgmgr, checkstart => 1); + if ($desktop eq "gnome") { + # Do not do start checking through menu_launch_type as this + # could fail on Gnome because of the third party dialogue. + # Use the Software specific check instead. + menu_launch_type("software"); + check_software_start(); + } + else { + menu_launch_type("discover", checkstart => 1); + } # On Gnome, the upgrade is safely visible when # we visit the Update page by clicking on the