1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-08-29 18:45:46 +00:00

Create a login function.

This commit is contained in:
Lukáš Růžička 2021-12-01 14:25:31 +01:00
parent 4e1f71fdea
commit bfb0a0e164
2 changed files with 46 additions and 14 deletions

View File

@ -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;

View File

@ -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");
}
}