From 7bb40c4d446756443d4c311b92d19d33ec2a3a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Thu, 2 Dec 2021 15:10:11 +0100 Subject: [PATCH] Add GUI variant of the upgrade test. --- tests/upgrade_run.pm | 98 +++++++++++++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 23 deletions(-) diff --git a/tests/upgrade_run.pm b/tests/upgrade_run.pm index d46b5a34..8a87f8a9 100644 --- a/tests/upgrade_run.pm +++ b/tests/upgrade_run.pm @@ -2,7 +2,6 @@ use base "installedtest"; use strict; use testapi; use utils; - sub run { my $self = shift; my $release = lc(get_var("VERSION")); @@ -10,32 +9,85 @@ sub run { if ($release eq "rawhide") { $relnum = get_var("RAWREL", "rawhide"); } - # disable screen blanking (download can take a long time) - script_run "setterm -blank 0"; - # use compose repo (compose tests) or set up update repo (update tests) - cleanup_workaround_repo; - repo_setup(); - my $params = "-y --releasever=${relnum}"; - if ($release eq "rawhide") { - $params .= " --nogpgcheck"; + if (get_var("GUI_UPGRADE")) { + + # Get back to the desktop + desktop_vt(); + + # If the desktop is Gnome + if (get_var("DESKTOP") eq "gnome") { + desktop_login(get_var("USER_LOGIN"), get_var("USER_PASSWORD")); + + # Start Gnome software + menu_launch_type("gnome-software"); + + # If it is run for the first time, hit the Browse button to + # speed things up. + if (check_screen("gnome_software_browse_button")) { + assert_and_click("gnome_software_browse_button"); + } + + # Click on the updates button. There should be no updates available, + # as updates were already handled by the upgrade_preinstall test, + # so we should only see the new version banner. + assert_and_click("gnome_software_updates_button", 60); + + # Check that the banner is there. + assert_screen("gnome_software_new_version"); + + # Click on the Download button to download the new version. + assert_and_click("gnome_software_new_download"); + + # Wait until it gets downloaded. It can take a long time, so + # we will do regular checks. + wait_until_needlematch("gnome_software_new_install", 10, 120); + + # Click to Install the updates + assert_and_click("gnome_software_new_install"); + + if (check_screen("gnome_software_authenticate")) { + # If authentication dialogue, then authenticate + type_safely(get_var("USER_PASSWORD")); + send_key("ret"); + } + else { + die("There was no authentication dialogue requested for an activity where it should have been."); + } + + if (check_screen("gnome_software_restart")) { + assert_and_click("gnome_software_restart"); + } + } + } + else { + # disable screen blanking (download can take a long time) + script_run "setterm -blank 0"; - if (script_run "dnf ${params} system-upgrade download", 6000) { - record_soft_failure "dnf failed so retry with --allowerasing"; - $params .= " --allowerasing"; - assert_script_run "dnf ${params} system-upgrade download", 6000; + # use compose repo (compose tests) or set up update repo (update tests) + cleanup_workaround_repo; + repo_setup(); + my $params = "-y --releasever=${relnum}"; + if ($release eq "rawhide") { + $params .= " --nogpgcheck"; + } + + if (script_run "dnf ${params} system-upgrade download", 6000) { + record_soft_failure "dnf failed so retry with --allowerasing"; + $params .= " --allowerasing"; + assert_script_run "dnf ${params} system-upgrade download", 6000; + } + + upload_logs "/var/log/dnf.log"; + upload_logs "/var/log/dnf.rpm.log"; + + script_run "dnf system-upgrade reboot", 0; + # fail immediately if we see a DNF error message, but keep an eye + # out for the bootloader so we can handle it if requested + check_screen ["upgrade_fail", "bootloader"], 15; + die "DNF reported failure" if (match_has_tag "upgrade_fail"); } - - upload_logs "/var/log/dnf.log"; - upload_logs "/var/log/dnf.rpm.log"; - - script_run "dnf system-upgrade reboot", 0; - # fail immediately if we see a DNF error message, but keep an eye - # out for the bootloader so we can handle it if requested - check_screen ["upgrade_fail", "bootloader"], 15; - die "DNF reported failure" if (match_has_tag "upgrade_fail"); - # handle bootloader, if requested; set longer timeout as sometimes # reboot here seems to take a long time if (get_var("GRUB_POSTINSTALL")) {