diff --git a/lib/utils.pm b/lib/utils.pm index 75242829..695a82e0 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -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 { diff --git a/needles/gnome/apps/gnome-initial-setup/gis_button_start_setup-20260427.json b/needles/gnome/apps/gnome-initial-setup/gis_button_start_setup-20260427.json deleted file mode 100644 index 63d95bfe..00000000 --- a/needles/gnome/apps/gnome-initial-setup/gis_button_start_setup-20260427.json +++ /dev/null @@ -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" - ] -} \ No newline at end of file diff --git a/needles/gnome/apps/gnome-initial-setup/gis_button_start_setup-20260427.png b/needles/gnome/apps/gnome-initial-setup/gis_button_start_setup-20260427.png deleted file mode 100644 index 475c9413..00000000 Binary files a/needles/gnome/apps/gnome-initial-setup/gis_button_start_setup-20260427.png and /dev/null differ diff --git a/tests/applications/gnome-initial-setup/aaa_setup.pm b/tests/applications/gnome-initial-setup/aaa_setup.pm index dc33b466..8e96e14e 100644 --- a/tests/applications/gnome-initial-setup/aaa_setup.pm +++ b/tests/applications/gnome-initial-setup/aaa_setup.pm @@ -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 { diff --git a/tests/applications/gnome-initial-setup/gnome_initial_setup.pm b/tests/applications/gnome-initial-setup/gnome_initial_setup.pm index 85310561..b1217745 100644 --- a/tests/applications/gnome-initial-setup/gnome_initial_setup.pm +++ b/tests/applications/gnome-initial-setup/gnome_initial_setup.pm @@ -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'); } } @@ -52,13 +56,13 @@ sub handle_keyboard { sub handle_privacy { # Both options should be on by default. # If they are not, record a soft-fail and enable them. - unless (check_screen("gis_geoservice_enabled", 2)) { + unless (check_screen("gis_geoservice_enabled", 5)) { record_soft_failure("Geoservices are not enabled by default which was expected."); assert_and_click("gis_radio_geoservice_enable"); } # Skip this test on Silverblue unless (get_var("CANNED")) { - unless (check_screen("gis_reporting_enabled", 2)) { + unless (check_screen("gis_reporting_enabled", 5)) { record_soft_failure("Autoreporting is not enabled by default which was expected."); assert_and_click("gis_radio_reporting_enable"); } @@ -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 diff --git a/tests/applications/gnome-initial-setup/gnome_initial_setup_post.pm b/tests/applications/gnome-initial-setup/gnome_initial_setup_post.pm index dc43c1ff..1bd1d96e 100644 --- a/tests/applications/gnome-initial-setup/gnome_initial_setup_post.pm +++ b/tests/applications/gnome-initial-setup/gnome_initial_setup_post.pm @@ -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.