1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-08-04 07:55:44 +00:00

Pass _boot_to_anaconda and _do_install on KDE webUI

This handles differences in webUI's appearance on the KDE live,
compared to the GNOME live which suppresses keyboard layout
selection, user creation and root password creation. By Lukas,
modified by Adam.
This commit is contained in:
Lukáš Růžička 2025-06-25 16:39:40 +02:00 committed by Adam Williamson
parent 27b2859339
commit f58778ef7f
9 changed files with 220 additions and 128 deletions

View File

@ -9,7 +9,7 @@ use testapi;
use utils; use utils;
use bugzilla; use bugzilla;
our @EXPORT = qw/select_disks custom_scheme_select custom_blivet_add_partition custom_blivet_format_partition custom_blivet_resize_partition custom_change_type custom_change_fs custom_change_device custom_delete_part webui_custom_start webui_custom_create_disklabel webui_custom_add_partition webui_custom_boot_partitions get_full_repo get_mirrorlist_url crash_anaconda_text report_bug_text/; our @EXPORT = qw/select_disks custom_scheme_select custom_blivet_add_partition custom_blivet_format_partition custom_blivet_resize_partition custom_change_type custom_change_fs custom_change_device custom_delete_part webui_custom_start webui_custom_create_disklabel webui_custom_add_partition webui_custom_boot_partitions webui_create_user anaconda_create_user get_full_repo get_mirrorlist_url crash_anaconda_text report_bug_text/;
sub select_disks { sub select_disks {
# Handles disk selection. Has one optional argument - number of # Handles disk selection. Has one optional argument - number of
@ -384,6 +384,115 @@ sub webui_custom_boot_partitions {
webui_custom_add_partition(size => 512, mountpoint => '/boot'); webui_custom_add_partition(size => 512, mountpoint => '/boot');
} }
sub _type_user_password {
# convenience function used by anaconda_create_user, not meant
# for direct use
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
if (get_var("SWITCHED_LAYOUT")) {
# we double the password, the second time using the native
# layout, so the password has both ASCII and native characters
desktop_switch_layout "ascii", "anaconda";
type_very_safely $user_password;
desktop_switch_layout "native", "anaconda";
type_very_safely $user_password;
}
else {
type_very_safely $user_password;
}
}
sub webui_create_user {
# Create a user in the WebUI interface where such screen appears,
# such as in the KDE installation. Currently, we only support
# English installations.
my %args = (
timeout => 90,
@_
);
my $user_login = get_var("USER_LOGIN", "test");
my $user_password = get_var("USER_PASSWORD", "weakpassword");
my $geofield = get_var("USER_GECOS", $user_login);
# We click into the first field, because it seems that
# sometimes it is not focused. Then we will navigate
# between fields using the Tab key.
assert_and_click("anaconda_webui_createuser_name", timeout => $args{timeout});
type_very_safely($geofield);
sleep(2);
send_key("tab");
sleep(1);
type_very_safely($user_login);
sleep(2);
send_key("tab");
sleep(1);
_type_user_password($user_password);
sleep(2);
for (1 .. 2) {
send_key("tab");
sleep(1);
}
_type_user_password($user_password);
}
sub anaconda_create_user {
# Create a user, in the anaconda interface. This is here because
# the same code works both during install and for initial-setup,
# which runs post-install, so we can share it.
my %args = (
timeout => 90,
@_
);
# For some languages, i.e. Turkish, we want to use a complicated
# geo field to test that turkish letters will be displayed correctly
# and that the installer will be able to handle them and change them
# into the correct user name without special characters.
my $geofield = get_var("USER_GECOS");
my $user_login = get_var("USER_LOGIN") || "test";
unless ($geofield) {
# If geofield is not defined, let it be the same as login.
$geofield = $user_login;
}
assert_and_click("anaconda_install_user_creation", timeout => $args{timeout});
assert_screen "anaconda_install_user_creation_screen";
# wait out animation
wait_still_screen 2;
# We will type the $geofield as the user name.
type_very_safely $geofield;
# For Turkish, we especially want to check that correct characters
# are typed, so we will check it here.
if (get_var("LANGUAGE") eq "turkish") {
assert_screen("username_typed_correctly_turkish");
}
send_key("tab");
# Now set the login name.
type_very_safely($user_login);
# And fill the password stuff.
type_very_safely "\t\t\t";
_type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
_type_user_password();
# even with all our slow typing this still *sometimes* seems to
# miss a character, so let's try again if we have a warning bar.
# But not if we're installing with a switched layout, as those
# will *always* result in a warning bar at this point (see below)
if (!get_var("SWITCHED_LAYOUT") && check_screen "anaconda_warning_bar", 3) {
wait_screen_change { send_key "shift-tab"; };
wait_still_screen 2;
_type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
_type_user_password();
}
assert_and_click "anaconda_spoke_done";
# since 20170105, we will get a warning here when the password
# contains non-ASCII characters. Assume only switched layouts
# produce non-ASCII characters, though this isn't strictly true
if (get_var('SWITCHED_LAYOUT') && check_screen "anaconda_warning_bar", 3) {
wait_still_screen 1;
assert_and_click "anaconda_spoke_done";
}
}
sub get_full_repo { sub get_full_repo {
my ($repourl) = @_; my ($repourl) = @_;
# trivial thing we kept repeating: fill out an HTTP or HTTPS # trivial thing we kept repeating: fill out an HTTP or HTTPS

View File

@ -6,7 +6,7 @@ use base 'Exporter';
use Exporter; use Exporter;
use lockapi; use lockapi;
use testapi qw(is_serial_terminal :DEFAULT); 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 check_software_start/; 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 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 # We introduce this global variable to hold the list of applications that have
@ -1015,83 +1015,6 @@ sub gnome_initial_setup {
set_var("_SETUP_DONE", 1); set_var("_SETUP_DONE", 1);
} }
sub _type_user_password {
# convenience function used by anaconda_create_user, not meant
# for direct use
my $user_password = get_var("USER_PASSWORD") || "weakpassword";
if (get_var("SWITCHED_LAYOUT")) {
# we double the password, the second time using the native
# layout, so the password has both ASCII and native characters
desktop_switch_layout "ascii", "anaconda";
type_very_safely $user_password;
desktop_switch_layout "native", "anaconda";
type_very_safely $user_password;
}
else {
type_very_safely $user_password;
}
}
sub anaconda_create_user {
# Create a user, in the anaconda interface. This is here because
# the same code works both during install and for initial-setup,
# which runs post-install, so we can share it.
my %args = (
timeout => 90,
@_
);
# For some languages, i.e. Turkish, we want to use a complicated
# geo field to test that turkish letters will be displayed correctly
# and that the installer will be able to handle them and change them
# into the correct user name without special characters.
my $geofield = get_var("USER_GECOS");
my $user_login = get_var("USER_LOGIN") || "test";
unless ($geofield) {
# If geofield is not defined, let it be the same as login.
$geofield = $user_login;
}
assert_and_click("anaconda_install_user_creation", timeout => $args{timeout});
assert_screen "anaconda_install_user_creation_screen";
# wait out animation
wait_still_screen 2;
# We will type the $geofield as the user name.
type_very_safely $geofield;
# For Turkish, we especially want to check that correct characters
# are typed, so we will check it here.
if (get_var("LANGUAGE") eq "turkish") {
assert_screen("username_typed_correctly_turkish");
}
send_key("tab");
# Now set the login name.
type_very_safely($user_login);
# And fill the password stuff.
type_very_safely "\t\t\t";
_type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
_type_user_password();
# even with all our slow typing this still *sometimes* seems to
# miss a character, so let's try again if we have a warning bar.
# But not if we're installing with a switched layout, as those
# will *always* result in a warning bar at this point (see below)
if (!get_var("SWITCHED_LAYOUT") && check_screen "anaconda_warning_bar", 3) {
wait_screen_change { send_key "shift-tab"; };
wait_still_screen 2;
_type_user_password();
wait_screen_change { send_key "tab"; };
wait_still_screen 2;
_type_user_password();
}
assert_and_click "anaconda_spoke_done";
# since 20170105, we will get a warning here when the password
# contains non-ASCII characters. Assume only switched layouts
# produce non-ASCII characters, though this isn't strictly true
if (get_var('SWITCHED_LAYOUT') && check_screen "anaconda_warning_bar", 3) {
wait_still_screen 1;
assert_and_click "anaconda_spoke_done";
}
}
sub check_desktop { sub check_desktop {
# Check we're at a desktop. We do this by looking for the "apps" # Check we're at a desktop. We do this by looking for the "apps"
# menu button ("Activities" button on GNOME, kicker button on # menu button ("Activities" button on GNOME, kicker button on

View File

@ -0,0 +1,19 @@
{
"area": [
{
"xpos": 267,
"ypos": 571,
"width": 161,
"height": 21,
"type": "match",
"click_point": {
"xpos": 14.5,
"ypos": 10.5
}
}
],
"properties": [],
"tags": [
"anaconda_webui_allow_root"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,19 @@
{
"area": [
{
"xpos": 269,
"ypos": 178,
"width": 241,
"height": 36,
"type": "match",
"click_point": {
"xpos": 193.5,
"ypos": 20
}
}
],
"properties": [],
"tags": [
"anaconda_webui_createuser_name"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -205,12 +205,9 @@ sub run {
} }
# we click to work around RHBZ #1566066 if it happens # we click to work around RHBZ #1566066 if it happens
click_lastmatch; click_lastmatch;
my $language = get_var('LANGUAGE') || 'english'; # for webui, with the small window, just typing 'english' may
# Workaround the new Anaconda WebUI with two menus, where the # not show the desired variant
# language stuff is not visible. my $language = get_var('LANGUAGE') || (get_var("_ANACONDA_WEBUI") ? 'united states' : 'english');
# We will send the upper arrow to move the screen to its original position.
send_key_until_needlematch("anaconda_select_install_lang", "up", 30);
assert_and_click("anaconda_select_install_lang", timeout => 300);
# Select install language # Select install language
wait_screen_change { assert_and_click "anaconda_select_install_lang_input"; }; wait_screen_change { assert_and_click "anaconda_select_install_lang_input"; };

View File

@ -1,61 +1,85 @@
use base "anacondatest"; use base "anacondatest";
use strict; use strict;
use testapi; use testapi;
use anaconda;
use utils; use utils;
sub _set_root_password { sub _set_root_password {
# Set root password, unless we don't want to or can't
# can also hit a transition animation # can also hit a transition animation
wait_still_screen 2; wait_still_screen 2;
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword"; my $root_password = get_var("ROOT_PASSWORD", "weakpassword");
unless (get_var("INSTALLER_NO_ROOT")) { assert_and_click "anaconda_install_root_password";
assert_and_click "anaconda_install_root_password"; # we have to click 'enable root account' before typing the
# we have to click 'enable root account' before typing the #password
#password assert_and_click "anaconda_install_root_password_screen";
assert_and_click "anaconda_install_root_password_screen"; # wait out animation
# wait out animation wait_still_screen 2;
wait_still_screen 2; desktop_switch_layout("ascii", "anaconda") if (get_var("SWITCHED_LAYOUT"));
desktop_switch_layout("ascii", "anaconda") if (get_var("SWITCHED_LAYOUT")); # these screens seems insanely subject to typing errors, so
# these screens seems insanely subject to typing errors, so # type super safely. This doesn't really slow the test down
# type super safely. This doesn't really slow the test down # as we still get done before the install process is complete.
# as we still get done before the install process is complete. type_very_safely $root_password;
type_very_safely $root_password; wait_screen_change { send_key "tab"; };
wait_screen_change { send_key "tab"; }; type_very_safely $root_password;
type_very_safely $root_password; # Another screen to test identification on
# Another screen to test identification on my $identification = get_var('IDENTIFICATION');
my $identification = get_var('IDENTIFICATION'); if ($identification eq 'true') {
if ($identification eq 'true') { check_top_bar();
check_top_bar(); # we don't check version or pre-release because here those
# we don't check version or pre-release because here those # texts appear on the banner which makes the needling
# texts appear on the banner which makes the needling # complex and fragile (banner is different between variants,
# complex and fragile (banner is different between variants, # and has a gradient so for RTL languages the background color
# and has a gradient so for RTL languages the background color # differs; pre-release text is also translated)
# differs; pre-release text is also translated)
}
assert_and_click "anaconda_spoke_done";
# exiting this screen can take a while, so check for the hub
assert_screen "anaconda_main_hub", 60;
} }
assert_and_click "anaconda_spoke_done";
# exiting this screen can take a while, so check for the hub
assert_screen "anaconda_main_hub", 60;
}
sub _set_root_password_webui {
my $root_password = get_var("ROOT_PASSWORD", "weakpassword");
# Click the radio button, then get focus and fill the fields.
assert_and_click("anaconda_webui_allow_root");
sleep(1);
type_very_safely($root_password);
for (1 .. 2) {
send_key("tab");
sleep(1);
}
type_very_safely($root_password);
} }
sub _do_root_and_user { sub _do_root_and_user {
_set_root_password(); my $nouser = (get_var("USER_LOGIN") eq 'false' || get_var("INSTALL_NO_USER"));
# Set user details, unless the test is configured not to create one my $noroot = get_var("INSTALLER_NO_ROOT");
unless (get_var("USER_LOGIN") eq 'false' || get_var("INSTALL_NO_USER")) { return if ($nouser && $noroot);
# Wait out animation if (get_var("_ANACONDA_WEBUI")) {
wait_still_screen 8; webui_create_user() unless ($nouser);
anaconda_create_user(); _set_root_password_webui() unless ($noroot);
assert_and_click("anaconda_webui_next");
}
else {
_set_root_password() unless ($noroot);
# Set user details, unless the test is configured not to create one
unless ($nouser) {
# Wait out animation
wait_still_screen 8;
anaconda_create_user();
}
} }
# Check username (and hence keyboard layout) if non-English # Check username (and hence keyboard layout) if non-English
if (get_var('LANGUAGE')) { if (get_var('LANGUAGE')) {
assert_screen "anaconda_install_user_created"; assert_screen "anaconda_install_user_created";
} }
} }
sub run { sub run {
my $self = shift; my $self = shift;
my $webui = 0; my $webui = get_var("_ANACONDA_WEBUI");
my $desktop = get_var("DESKTOP");
# From F31 onwards (after Fedora-Rawhide-20190722.n.1), user and # From F31 onwards (after Fedora-Rawhide-20190722.n.1), user and
# root password spokes are moved to main hub, so we must do those # root password spokes are moved to main hub, so we must do those
# before we run the install. # before we run the install.
@ -67,8 +91,7 @@ sub run {
assert_screen ["anaconda_main_hub_begin_installation", "anaconda_webui_begin_installation"], 90; assert_screen ["anaconda_main_hub_begin_installation", "anaconda_webui_begin_installation"], 90;
wait_still_screen 5; wait_still_screen 5;
assert_and_click ["anaconda_main_hub_begin_installation", "anaconda_webui_begin_installation"]; assert_and_click ["anaconda_main_hub_begin_installation", "anaconda_webui_begin_installation"];
if (match_has_tag "anaconda_webui_begin_installation") { if ($webui) {
$webui = 1;
click_lastmatch if (check_screen "anaconda_webui_confirm_installation", 10); click_lastmatch if (check_screen "anaconda_webui_confirm_installation", 10);
} }
@ -110,8 +133,10 @@ sub run {
wait_still_screen 3; wait_still_screen 3;
# if this is a live install, let's go ahead and quit the installer # if this is a live install, let's go ahead and quit the installer
# in all cases, just to make sure quitting doesn't crash etc. # in all cases, just to make sure quitting doesn't crash etc.
# not on web UI, as it immediately reboots if (get_var('LIVE')) {
assert_and_click "anaconda_install_done" if (get_var('LIVE') && !$webui); # not on Workstation with webUI, as it immediately reboots
assert_and_click "anaconda_install_done" unless ($webui && $desktop eq "gnome");
}
# there are various things we might have to do at a console here # there are various things we might have to do at a console here
# before we actually reboot. let's figure them all out first... # before we actually reboot. let's figure them all out first...
my @actions; my @actions;
@ -129,10 +154,9 @@ sub run {
push(@actions, 'checkefibootmgr') if (get_var("UEFI")); push(@actions, 'checkefibootmgr') if (get_var("UEFI"));
} }
# memcheck test doesn't need to reboot at all. Rebooting from GUI # memcheck test doesn't need to reboot at all. Rebooting from GUI
# for no-webUI lives is unreliable (webUI lives reboot on "Quit" # for lives is unreliable. And if we're already doing something
# just like non-lives). And if we're already doing something
# else at a console, we may as well reboot from there too # else at a console, we may as well reboot from there too
push(@actions, 'reboot') if (!get_var("MEMCHECK") && ((get_var("LIVE") && !$webui) || @actions)); push(@actions, 'reboot') if (!get_var("MEMCHECK") && (get_var("LIVE") || @actions));
# check whether install is affected by # check whether install is affected by
# https://bugzilla.redhat.com/show_bug.cgi?id=2268505 , # https://bugzilla.redhat.com/show_bug.cgi?id=2268505 ,
# soft fail and work around it if so # soft fail and work around it if so

View File

@ -1,6 +1,7 @@
use base "installedtest"; use base "installedtest";
use strict; use strict;
use testapi; use testapi;
use anaconda;
use utils; use utils;
sub _enter_password { sub _enter_password {