Review gnome-initial-setup.pm
Some checks failed
CI via Tox and perl / tox (pull_request) Failing after 2m53s
CI via Tox and perl / perl (pull_request) Failing after 3m28s
CI via Tox and perl / checkwiki (pull_request) Successful in 39s

This commit is contained in:
Lukáš Růžička 2026-04-28 22:33:30 +02:00
commit 6ec6da5479

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