Review: implement requests from a review
All checks were successful
CI via Tox and perl / tox (pull_request) Successful in 4m42s
CI via Tox and perl / perl (pull_request) Successful in 4m3s
CI via Tox and perl / checkwiki (pull_request) Successful in 1m6s
AI Code Review / ai-review (pull_request_target) Successful in 28s

This commit is contained in:
Lukáš Růžička 2026-04-28 21:34:34 +02:00
commit 28ed6961f5
6 changed files with 43 additions and 57 deletions

View file

@ -374,14 +374,17 @@ sub console_loadkeys_us {
if (get_var('LANGUAGE') eq 'french') {
script_run "loqdkeys us", 0;
# might take a few secs
wait_still_screen(3);
}
elsif (get_var('LANGUAGE') eq 'japanese' || get_var('LANGUAGE') eq 'turkish') {
script_run "loadkeys us", 0;
wait_still_screen(3);
}
elsif (get_var('LANGUAGE') eq 'czech' || get_var('LAYOUT') eq 'czech') {
# Czech uses qwertz by default, so we need to swap y with z
script_run('loadkezs us', 0);
wait_still_screen(3);
}
wait_still_screen(3);
}
sub do_bootloader {

View file

@ -1,19 +0,0 @@
{
"area": [
{
"xpos": 460,
"ypos": 667,
"width": 106,
"height": 27,
"type": "match",
"click_point": {
"xpos": 53,
"ypos": 13.5
}
}
],
"properties": [],
"tags": [
"gis_button_start_setup"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View file

@ -8,7 +8,7 @@ use utils;
sub run {
my $self = shift;
my $username = get_var("USER_LOGIN") // "test";
my $username = get_var("USER_LOGIN", "test");
# Switch to root console
$self->root_console(tty => 3);
@ -23,7 +23,7 @@ sub run {
assert_script_run("userdel -r $username");
# Reboot the system to trigger GNOME initial setup
type_string("reboot\n");
enter_cmd("reboot");
}
sub test_flags {

View file

@ -8,24 +8,28 @@ use utils;
# in follow-up tests. It also checks expected default privacy
# settings during the setup flow.
my %tags = (
'gis_screen_welcome' => 'welcome',
'gis_screen_keyboard' => 'keyboard',
'gis_screen_privacy' => 'privacy',
'gis_screen_timezone' => 'timezone',
'gis_screen_software' => 'software',
'gis_screen_credentials' => 'credentials',
'gis_screen_password' => 'password',
'gis_screen_final' => 'final',
);
sub get_screen {
# Returns the name of the current screen based on its content.
my %tags = (
'gis_screen_welcome' => 'welcome',
'gis_screen_keyboard' => 'keyboard',
'gis_screen_privacy' => 'privacy',
'gis_screen_timezone' => 'timezone',
'gis_screen_software' => 'software',
'gis_screen_credentials' => 'credentials',
'gis_screen_password' => 'password',
'gis_screen_final' => 'final',
);
my $matched = check_screen([keys %tags], 10);
for my $tag (@{$matched->{needle}->{tags}}) {
return $tags{$tag} if exists $tags{$tag};
}
die("Unable to determine GNOME Initial Setup screen") unless $matched;
# Look if we match one of the screens in %tags.
my $matched = check_screen([keys %tags], 10) or die("Unable to determine GNOME Initial Setup screen");
my @matched_tags = @{$matched->{needle}->{tags}};
# Filter only tags we care about
my @known = grep { exists $tags{$_} } @matched_tags;
# Die if we have doubts
die("No known GIS tag in matched needle: @matched_tags") unless @known;
die("Ambiguous GIS screen (multiple matches): @known") if scalar(@known) > 1;
return ($tags{$known[0]});
}
sub handle_welcome {
@ -39,7 +43,7 @@ sub handle_welcome {
set_var('LANGSELECT', '1');
}
else {
assert_and_click('gis_button_start_setup');
assert_and_click('start_setup');
}
}
@ -87,8 +91,7 @@ sub handle_software {
sub handle_credentials {
my ($realname, $username) = @_;
type_very_safely($realname);
send_key("tab");
wait_still_screen(1);
wait_screen_change { send_key("tab"); } 2;
send_key("ctrl-a");
type_very_safely($username);
assert_and_click("next_button");
@ -135,7 +138,7 @@ sub run {
# Check if we see the "Start Setup" button and in
# that case, click on it, otherwise do the language
# selection.
if (check_screen('gis_button_start_setup', timeout => 10)) {
if (check_screen('start_setup', timeout => 10)) {
handle_welcome('welcome');
}
else {
@ -164,10 +167,17 @@ sub run {
wait_still_screen(2);
}
# Report missing screens
my @missing;
for my $screen (@required_screens) {
die("GNOME Initial Setup skipped this required screen: $screen") unless $visited_screens{$screen};
unless ($visited_screens{$screen}) {
push(@missing, $screen);
record_info("Screen Check", "GNOME Initial Setup skipped this required screen: $screen");
}
}
die("GNOME Initial Setup skipped required screens: " . join(", ", @missing)) if @missing;
# When we have reached the final screen
assert_and_click("gis_button_start_fedora");
# When we have reached the system, dismiss the tour

View file

@ -4,16 +4,9 @@ use warnings;
use testapi;
use utils;
sub assert_cmd_output_eq {
my ($cmd, $expected) = @_;
my $out = script_output($cmd, timeout => 60);
chomp($out);
die("Unexpected output for [$cmd]: got [$out], expected [$expected]") unless $out eq $expected;
}
sub run_as_user {
my ($user, $cmd) = @_;
return script_output(qq{su -l $user -c 'dbus-run-session bash -lc "$cmd"'}, timeout => 60);
return script_output("su - $user -c '$cmd'", timeout => 60);
}
sub assert_as_user_eq {
@ -34,7 +27,7 @@ sub assert_password {
my ($user, $password) = @_;
enter_cmd("su - $user"); # Switch to user account to lose admin rights.
# The following command will not show the username without the correct password
my $result = script_run("su - $user -c 'whoami' <<< $password | grep -x $user");
my $result = script_run("echo $password | sudo -S -u $user whoami | grep -x $user");
enter_cmd("exit");
return $result;
}
@ -50,10 +43,7 @@ sub run {
# However, if we did, we want to know.
$locale_check = 1 if (get_var('LANGSELECT'));
# Switch to the serial console. To run commands successfully,
# we need to load english keyboard layout. Otherwise, we cannot
# run commands correctly. Note, that the loadkeys command must
# be presented in the foreign layout.
# Switch to the serial console.
$self->root_console(tty => 3);
assert_script_run("chmod 666 /dev/${serialdev}");
@ -62,6 +52,8 @@ sub run {
record_info("Lang settings", "Language and keyboard layout checks are switched off!");
}
else {
# We have set up a non-US keyboard layout but to run commands successfully,
# we need to load US keyboard layout.
console_loadkeys_us();
# Check that system locale are set to Czech (cs_CZ.UTF-8)
assert_script_run("grep -x 'LANG=cs_CZ.UTF-8' /etc/locale.conf");
@ -70,7 +62,7 @@ sub run {
}
# Check that the time zone has been set to Bratislave, Europe
assert_cmd_output_eq(q{timedatectl show -p Timezone --value}, 'Europe/Bratislava');
validate_script_output("timedatectl show -p Timezone --value", sub { /Europe\/Bratislava/ }, timeout => 60);
assert_script_run(q{readlink -f /etc/localtime | grep -x '/usr/share/zoneinfo/Europe/Bratislava'});
# Check that user exists and that a correct password is set.