From bfb0a0e164c5fa5262dc11df10b679f48638a311 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, 1 Dec 2021 14:25:31 +0100 Subject: [PATCH] Create a login function. --- lib/utils.pm | 33 ++++++++++++++++++++++++++++++++- tests/upgrade_boot.pm | 27 ++++++++++++++------------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 23ce9f64..3656b8c4 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -1452,7 +1452,7 @@ sub download_testdata { my ($repodir, $location) = @_; # Navigate to the test's home directory assert_script_run("cd /home/test/"); - # Clone the test repository; + # Clone the test; assert_script_run("git clone https://pagure.io/fedora-qa/openqa_testdata.git"); # Copy the test data into $repodir to $location. assert_script_run("cp openqa_testdata/$repodir/* $location"); @@ -1460,4 +1460,35 @@ sub download_testdata { assert_script_run("chown -R test:test $location"); } +# This routine is used to handle desktop login. Usually, this is handled by +# a standalone script but we should be able to invoke this from anywhere if needed. +# Currently, this only works for Gnome desktop +sub desktop_login { + my ($login,$password) = @_; + # For Gnome desktop + if (get_var("DESKTOP") eq 'gnome') { + send_key_until_needlematch("graphical_login_input", "ret", 3, 5); + } + assert_screen "graphical_login_input"; + # seems like we often double-type on aarch64 if we start right + # away + wait_still_screen 5; + type_very_safely $password; + send_key "ret"; + # Wait until we log in and handle GIS or Tour + wait_still_screen 5; + if ($relnum < 34) { + # before GNOME 40 (F34), we get a per-user version of + # gnome-initial-setup here... + gnome_initial_setup() unless (get_var("_setup_done")); + } + else { + # ...from GNOME 40 on, we just get a "Welcome" tour + handle_welcome_screen unless (get_var("_welcome_done")); + } +} + + + + 1; diff --git a/tests/upgrade_boot.pm b/tests/upgrade_boot.pm index 3fb556aa..6e47ab5d 100644 --- a/tests/upgrade_boot.pm +++ b/tests/upgrade_boot.pm @@ -16,6 +16,20 @@ sub run { } boot_to_login_screen; + + if (get_var("GUI_UPGRADE")) { + # Log onto the graphical session + $login = get_var("USER_LOGIN") // "test"; + $password = get_var("USER_PASSWORD") // "weakpassword"; + desktop_login($login, $password); + # Start the terminal + menu_launch_type("gnome-terminal"); + wait_still_screen 2; + # Use gsettings to set the upgrade-prerelease to true + type_safely("gsettings set org.gnome.software show-upgrade-prerelease true\n"); + # Exit the application + type_safely("exit"); + } # switch to TTY3 for both, graphical and console tests $self->root_console(tty=>3); # disable screen blanking (update can take a long time) @@ -23,19 +37,6 @@ sub run { # adjust repo files to use mirrorlist not metalink (to avoid # metalink checksum timing issue causing infra repo to be rejected) repos_mirrorlist; - # If this should be a GUI upgrade test, we need to set up Gnome to accept prerelease. - # Let's do it here and we will save one system restart later. - if (get_var("GUI_UPGRADE")) { - # Get the login, or select test. - my $login = get_var("USER_LOGIN") // "test"; - # Switch to the test user - type_string("su $login\n"); - # Use gsettings to enable showing the prerelease - script_run("gsettings set org.gnome.software show-upgrade-prerelease true"); - # Return to the root console. - type_string("exit\n"); - - } }