diff --git a/lib/utils.pm b/lib/utils.pm index 53cf6249..73cddda3 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -1355,6 +1355,7 @@ sub menu_launch_type { # Wait for KDE to place focus correctly. sleep 2; send_key 'ret'; + wait_still_screen(3); } sub tell_source { diff --git a/main.pm b/main.pm index 796a7239..bfe7fb97 100644 --- a/main.pm +++ b/main.pm @@ -122,7 +122,16 @@ sub load_upgrade_tests() { autotest::loadtest "tests/${pu}.pm"; } } - autotest::loadtest "tests/upgrade_run.pm"; + # If we want the upgrade run with GUI tools, we need + # to load a GUI set of tests + if (get_var("GUI_UPGRADE")) { + autotest::loadtest("tests/graphical_upgrade_prerequisites.pm"); + autotest::loadtest("tests/graphical_upgrade_run.pm"); + } + # otherwise go with the CLI variant + else { + autotest::loadtest "tests/upgrade_run.pm"; + } # handle additional postinstall tests if (get_var("POSTINSTALL")) { set_var('POSTINSTALL', "upgrade_postinstall " . get_var("POSTINSTALL")); diff --git a/needles/gnome/desktop_package_tool_restart_upgrade.json b/needles/gnome/desktop_package_tool_restart_upgrade.json new file mode 100644 index 00000000..ed13649c --- /dev/null +++ b/needles/gnome/desktop_package_tool_restart_upgrade.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 438, + "ypos": 277, + "width": 143, + "height": 20, + "type": "match" + } + ], + "properties": [], + "tags": [ + "desktop_package_tool_restart_upgrade" + ] +} \ No newline at end of file diff --git a/needles/gnome/desktop_package_tool_restart_upgrade.png b/needles/gnome/desktop_package_tool_restart_upgrade.png new file mode 100644 index 00000000..9af085de Binary files /dev/null and b/needles/gnome/desktop_package_tool_restart_upgrade.png differ diff --git a/needles/gnome/desktop_package_tool_updates_available.json b/needles/gnome/desktop_package_tool_updates_available.json new file mode 100644 index 00000000..3086e71c --- /dev/null +++ b/needles/gnome/desktop_package_tool_updates_available.json @@ -0,0 +1,22 @@ +{ + "properties": [], + "tags": [ + "desktop_package_tool_updates_available" + ], + "area": [ + { + "xpos": 331, + "ypos": 163, + "width": 184, + "height": 32, + "type": "match" + }, + { + "xpos": 561, + "ypos": 162, + "width": 136, + "height": 33, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/gnome/desktop_package_tool_updates_available.png b/needles/gnome/desktop_package_tool_updates_available.png new file mode 100644 index 00000000..7c85dc46 Binary files /dev/null and b/needles/gnome/desktop_package_tool_updates_available.png differ diff --git a/needles/kde/apps/auth_required-20240214.json b/needles/kde/apps/auth_required-20240214.json new file mode 100644 index 00000000..b6b82292 --- /dev/null +++ b/needles/kde/apps/auth_required-20240214.json @@ -0,0 +1,16 @@ +{ + "area": [ + { + "xpos": 334, + "ypos": 271, + "width": 212, + "height": 20, + "type": "match" + } + ], + "properties": [], + "tags": [ + "auth_required", + "auth_required_password" + ] +} \ No newline at end of file diff --git a/needles/kde/apps/auth_required-20240214.png b/needles/kde/apps/auth_required-20240214.png new file mode 100644 index 00000000..6c2e4be6 Binary files /dev/null and b/needles/kde/apps/auth_required-20240214.png differ diff --git a/needles/kde/desktop_package_tool_restart_automatically-kde-active.json b/needles/kde/desktop_package_tool_restart_automatically-kde-active.json new file mode 100644 index 00000000..5a913b86 --- /dev/null +++ b/needles/kde/desktop_package_tool_restart_automatically-kde-active.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 325, + "ypos": 690, + "width": 133, + "height": 22, + "type": "match" + } + ], + "properties": [], + "tags": [ + "desktop_package_tool_restart_automatically" + ] +} \ No newline at end of file diff --git a/needles/kde/desktop_package_tool_restart_automatically-kde-active.png b/needles/kde/desktop_package_tool_restart_automatically-kde-active.png new file mode 100644 index 00000000..da5bd362 Binary files /dev/null and b/needles/kde/desktop_package_tool_restart_automatically-kde-active.png differ diff --git a/needles/kde/desktop_package_tool_restart_automatically-kde.json b/needles/kde/desktop_package_tool_restart_automatically-kde.json new file mode 100644 index 00000000..36fad5f6 --- /dev/null +++ b/needles/kde/desktop_package_tool_restart_automatically-kde.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 322, + "ypos": 684, + "width": 136, + "height": 25, + "type": "match" + } + ], + "properties": [], + "tags": [ + "desktop_package_tool_restart_automatically" + ] +} \ No newline at end of file diff --git a/needles/kde/desktop_package_tool_restart_automatically-kde.png b/needles/kde/desktop_package_tool_restart_automatically-kde.png new file mode 100644 index 00000000..67987826 Binary files /dev/null and b/needles/kde/desktop_package_tool_restart_automatically-kde.png differ diff --git a/needles/kde/desktop_package_tool_update_all-kde.json b/needles/kde/desktop_package_tool_update_all-kde.json new file mode 100644 index 00000000..da53840e --- /dev/null +++ b/needles/kde/desktop_package_tool_update_all-kde.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 878, + "ypos": 43, + "width": 89, + "height": 22, + "type": "match" + } + ], + "properties": [], + "tags": [ + "desktop_package_tool_update_all" + ] +} \ No newline at end of file diff --git a/needles/kde/desktop_package_tool_update_all-kde.png b/needles/kde/desktop_package_tool_update_all-kde.png new file mode 100644 index 00000000..0d86636a Binary files /dev/null and b/needles/kde/desktop_package_tool_update_all-kde.png differ diff --git a/needles/kde/desktop_package_tool_updates_available-kde.json b/needles/kde/desktop_package_tool_updates_available-kde.json new file mode 100644 index 00000000..ce9f4831 --- /dev/null +++ b/needles/kde/desktop_package_tool_updates_available-kde.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 305, + "ypos": 86, + "width": 268, + "height": 25, + "type": "match" + } + ], + "properties": [], + "tags": [ + "desktop_package_tool_updates_available" + ] +} \ No newline at end of file diff --git a/needles/kde/desktop_package_tool_updates_available-kde.png b/needles/kde/desktop_package_tool_updates_available-kde.png new file mode 100644 index 00000000..9729b5c1 Binary files /dev/null and b/needles/kde/desktop_package_tool_updates_available-kde.png differ diff --git a/needles/kde/desktop_package_tool_upgrade_system-kde.json b/needles/kde/desktop_package_tool_upgrade_system-kde.json new file mode 100644 index 00000000..4e5d0865 --- /dev/null +++ b/needles/kde/desktop_package_tool_upgrade_system-kde.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 785, + "ypos": 90, + "width": 157, + "height": 20, + "type": "match" + } + ], + "properties": [], + "tags": [ + "desktop_package_tool_upgrade_system" + ] +} \ No newline at end of file diff --git a/needles/kde/desktop_package_tool_upgrade_system-kde.png b/needles/kde/desktop_package_tool_upgrade_system-kde.png new file mode 100644 index 00000000..9729b5c1 Binary files /dev/null and b/needles/kde/desktop_package_tool_upgrade_system-kde.png differ diff --git a/templates.fif.json b/templates.fif.json index b2d1bf52..84208ea7 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -3030,7 +3030,6 @@ "ROOT_PASSWORD": "weakpassword", "TEST_TARGET": "COMPOSE", "UPGRADE": "1", - "GUI_UPGRADE": "1", "USER_LOGIN": "test", "USER_PASSWORD": "weakpassword" } @@ -3052,6 +3051,40 @@ "USER_PASSWORD": "weakpassword" } }, + "upgrade_desktop_graphical_64bit": { + "profiles": { + "fedora-universal-x86_64-*-64bit": 30, + "fedora-universal-aarch64-*-aarch64": 40 + }, + "settings": { + "BOOTFROM": "c", + "DESKTOP": "gnome", + "HDD_1": "disk_f%UP1REL%_desktop_4_%ARCH%.qcow2", + "ROOT_PASSWORD": "weakpassword", + "TEST_TARGET": "COMPOSE", + "UPGRADE": "1", + "GUI_UPGRADE": "1", + "USER_LOGIN": "test", + "USER_PASSWORD": "weakpassword" + } + }, + "upgrade_2_desktop_graphical_64bit": { + "profiles": { + "fedora-universal-x86_64-*-64bit": 30, + "fedora-universal-aarch64-*-aarch64": 40 + }, + "settings": { + "BOOTFROM": "c", + "DESKTOP": "gnome", + "HDD_1": "disk_f%UP2REL%_desktop_4_%ARCH%.qcow2", + "ROOT_PASSWORD": "weakpassword", + "TEST_TARGET": "COMPOSE", + "UPGRADE": "1", + "GUI_UPGRADE": "1", + "USER_LOGIN": "test", + "USER_PASSWORD": "weakpassword" + } + }, "upgrade_kde_64bit": { "profiles": { "fedora-universal-x86_64-*-64bit": 30 @@ -3067,6 +3100,22 @@ "USER_PASSWORD": "weakpassword" } }, + "upgrade_kde_graphical_64bit": { + "profiles": { + "fedora-universal-x86_64-*-64bit": 30 + }, + "settings": { + "+HDD_1": "disk_f%UP1REL%_kde_4_x86_64.qcow2", + "BOOTFROM": "c", + "DESKTOP": "kde", + "ROOT_PASSWORD": "weakpassword", + "TEST_TARGET": "COMPOSE", + "UPGRADE": "1", + "GUI_UPGRADE": "1", + "USER_LOGIN": "test", + "USER_PASSWORD": "weakpassword" + } + }, "upgrade_minimal_64bit": { "profiles": { "fedora-universal-aarch64-*-aarch64": 30, diff --git a/tests/graphical_upgrade_prerequisites.pm b/tests/graphical_upgrade_prerequisites.pm new file mode 100644 index 00000000..e78bd4ae --- /dev/null +++ b/tests/graphical_upgrade_prerequisites.pm @@ -0,0 +1,110 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self = shift; + my $version = get_var("VERSION"); + my $rawrel = get_var("RAWREL"); + my $desktop = get_var("DESKTOP"); + my $user = get_var("USER_LOGIN", "test"); + my $pword = get_var("USER_PASSWORD", "weakpassword"); + + # As this is designed, the 'upgrade_preinstall' test script + # runs before this one and ends on the root console. Therefore, + # we can assume that we are still on that root console, so + # we can safely use script assertions. + + # Make serial console writable for everyone, so that we + # can use script assertions for further commands as well. + assert_script_run("chmod 666 /dev/${serialdev}"); + + if ($desktop eq "gnome") { + # Install Gnome specific packages + assert_script_run("dnf install -y jq dbus-x11"); + # Leave the CLI and come back to the login screen. + desktop_vt(); + # Log onto the graphical session + send_key("ret"); + wait_still_screen(1); + type_very_safely("$pword\n"); + handle_welcome_screen(); + check_desktop(); + # After the login, let us wait that everything settles + # and that we are not too quick on the system. + wait_still_screen(5); + # 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"); + # 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. + if (check_screen("gnome_software_ignore", timeout => 60)) { + click_lastmatch(); + } + # Wait a couple of second, just in case the file needs a little + # longer to be created. + sleep(10); + # Close Software + send_key("alt-f4"); + } + + # Switch back to the CLI for further settings. + $self->root_console(tty => 3); + + # For Gnome desktop only. + if ($desktop eq "gnome") { + # Switch to a user account + enter_cmd("su -l $user"); + # Navigate to the version file directory + assert_script_run("cd ~/.cache/gnome-software/fedora-pkgdb-collections"); + + # Modify the content of the version file if we are on Rawhide and we need + # to update the previous release to it: + if ($version eq "Rawhide") { + # Replace the word 'devel' with the upcoming version number. + assert_script_run("jq '(.collections |= map(if .version == \"devel\" then .koji_name = \"f$rawrel\" | .status = \"Active\" | .version = \"$rawrel\" else . end))' fedora.json > fedora-updated.json"); + # Replace the version file + assert_script_run("mv fedora-updated.json fedora.json"); + } + + # Allow Software to also show pre-release upgrades. + assert_script_run("dbus-launch --exit-with-session gsettings set org.gnome.software show-upgrade-prerelease true"); + + # Disable blanking the screen on inactivity, because if the screen gets switched off + # we will have no way to make it active again. + assert_script_run("dbus-launch --exit-with-session gsettings set org.gnome.desktop.screensaver idle-activation-enabled false"); + assert_script_run("dbus-launch --exit-with-session gsettings set org.gnome.desktop.screensaver lock-enabled false"); + assert_script_run("dbus-launch --exit-with-session gsettings set org.gnome.desktop.lockdown disable-lock-screen true"); + # Logout the regular user + enter_cmd("exit"); + } + # For KDE desktop only. + elsif ($desktop eq "kde") { + # Modify the content of the version file if we are on Rawhide and we need + # to update the previous release to it. + assert_script_run("sed -i '/ 1}; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/graphical_upgrade_run.pm b/tests/graphical_upgrade_run.pm new file mode 100644 index 00000000..ce095e2f --- /dev/null +++ b/tests/graphical_upgrade_run.pm @@ -0,0 +1,103 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This method does the basic login to a DE, +# it can distinguish between Gnome and KDE. +# We are using it to make the code a little +# lighter. +sub session_login { + my $desktop = shift; + my $pword = get_var("USER_PASSWORD") // "weakpassword"; + if ($desktop eq "gnome") { + # For Gnome, we need to press Enter first + # to show the password field, then we type + # in the password. + send_key("ret"); + wait_still_screen(1); + } + # For both DEs + type_very_safely("$pword\n"); +} + +sub run { + my $self = shift; + my $rawrel = get_var("RAWREL"); + my $user = get_var("USER_LOGIN") // "test"; + my $pword = get_var("USER_PASSWORD") // "weakpassword"; + my $desktop = get_var("DESKTOP"); + + # The previous test, 'graphical_upgrade_prerequsites' reset + # the machine, so we will deal with booting it and + # login to the $desktop. + boot_to_login_screen(); + session_login($desktop); + # If we are on Gnome, we have seen the welcome screen already + # in the previous step, so we do not want to repeat this. + # However, for KDE we will deal with it. + if ($desktop eq "kde") { + handle_welcome_screen(); + } + # Let's check, that the desktop is shown. + check_desktop(); + + # 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); + + # On Gnome, the upgrade is safely visible when + # we visit the Update page by clicking on the + # Update icon. Let's click on that icon on + # both DEs, just to make sure. + assert_and_click("desktop_package_tool_update"); + + # Check that the new upgrade version is available. + assert_screen("desktop_package_tool_updates_available", timeout => 180); + + if ($desktop eq "gnome") { + # When a new release is available, there will be a download button, + # click on that button to download the upgrade packages. + assert_and_click("desktop_package_tool_update_download"); + + # Restart the computer to apply upgrades, when the download is complete. + # Downloading the upgrade packages may take a long time + # so let's check until we find it. + assert_and_click("desktop_package_tool_restart_upgrade", timeout => 1200); + + # Type the password to confirm. + type_very_safely("$pword\n"); + + # Click on the 'restart and install' button + # to restart into the upgrade session. + assert_and_click("gnome_reboot_confirm"); + } + elsif ($desktop eq "kde") { + # There is a button to upgrade to a new major version, + # click it. + assert_and_click("desktop_package_tool_upgrade_system"); + # Click on Update all + assert_and_click("desktop_package_tool_update_all", timeout => 1200); + # Once we click that button, we can check the checkbutton + # for restarting the computer automatically. + assert_and_click("desktop_package_tool_restart_automatically"); + # When we still see the 'restart_automatically' tag, we + # are still downloading. When it disappears, it means that + # the machine gets restarted and we can stop this module. + while (!check_screen("auth_required")) { + sleep 15; + } + type_very_safely("$pword\n"); + } +} + + +sub test_flags { + return {fatal => 1}; +} + +1; + +# vim: set sw=4 et: