diff --git a/lib/utils.pm b/lib/utils.pm index 1045c25e..e2909abf 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -7,7 +7,7 @@ use Exporter; use lockapi; use testapi; -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 start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number _assert_and_click click_unwanted_notifications/; +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 start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications/; sub run_with_error_check { my ($func, $error_screen) = @_; @@ -684,12 +684,12 @@ sub start_with_launcher { # $launcher holds the launcher needle, but some of the apps are hidden in a submenu # so this must be handled first to find the launcher needle. - + my ($launcher,$submenu,$group) = @_; $submenu //= ''; $group //= ''; my $desktop = get_var('DESKTOP'); - + my $item_to_check = $submenu || $launcher; # The following varies for different desktops. if ($desktop eq 'gnome') { @@ -701,7 +701,7 @@ sub start_with_launcher { assert_and_click 'overview_app_grid'; wait_still_screen 5; - # Find the application launcher in the current menu page. + # Find the application launcher in the current menu page. # If it cannot be found there, hit PageDown to go to another page. send_key_until_needlematch($item_to_check, 'pgdn', 5, 3); @@ -719,17 +719,17 @@ sub start_with_launcher { # Click on the KDE launcher icon assert_and_click 'kde_menu_launcher'; wait_still_screen 2; - - # Select the appropriate submenu + + # Select the appropriate submenu assert_and_click $submenu; wait_still_screen 2; # Select the appropriate menu subgroup where real launchers # are placed, but only if requested if ($group) { - send_key_until_needlematch($group, 'down', 20, 3); - send_key 'ret'; - #assert_and_click $group; + send_key_until_needlematch($group, 'down', 20, 3); + send_key 'ret'; + #assert_and_click $group; wait_still_screen 2; } @@ -737,7 +737,7 @@ sub start_with_launcher { send_key_until_needlematch($launcher, 'down', 40, 3); send_key 'ret'; wait_still_screen 5; - } + } } @@ -749,7 +749,6 @@ sub quit_with_shortcut { } - sub lo_dismiss_tip { # identify and close a 'tip of the day' window that shows on start # of all LibreOffice apps. For the 'app startup' tests. @@ -903,6 +902,82 @@ sub get_release_number { my $rawrel = get_var("RAWREL", "Rawhide"); return $rawrel if ($version eq "Rawhide"); return $version + } + +sub tell_source { + # This helper function identifies the Subvariant of the tested system. + # For the purposes of identification testing, we are only interested + # if the system is Workstation, Server, or something else, because, + # except Workstation and Server, there are no graphical differences + # between various spins and isos. + my $iso = get_var('SUBVARIANT'); + if ($iso eq 'Workstation' or $iso eq 'Server') { + $iso = lc($iso); + } + elsif ($iso eq 'AtomicHost') { + $iso = 'atomic'; + } + else { + $iso = 'generic'; + } + return $iso; +} + +sub check_left_bar { + # This method is used by identification tests to check whether the Anaconda + # bar on the left side of the screen corresponds with the correct version. + # It looks different for Server, Workstation and others. + my $source = tell_source; + assert_screen "leftbar_${source}"; +} + +sub check_top_bar { + # This method is used by identification tests to check whether the + # top bar in Anaconda corresponds with the correct version of the spin. + my $source = tell_source; + assert_screen "topbar_${source}"; +} + +sub check_prerelease { + # This method is used by identification tests to check if + # Anaconda shows the PRERELEASE info for Rawhide versions. + # As it seems, the rules for showing the PRERELEASE are not + # as simple as it may look like. It seems to me, that the PRERELEASE + # is shown on Rawhide intallations, which is pretty easy to test because + # the "VERSION" variable is Rawhide. On Final RC, the PRERELEASE should + # be turned off, while it should be present between before that. + # When Fedora is branched, the "VERSION" changes to the version number + # and this is not changed even with Final, so we cannot test that. + # Investigating the history, I noticed that all nightly builds have + # that prerelease turned on. And also, it is there on a Beta candidate. + # We can test for that. + + my $beta = get_var('ISO'); + my $nightly = get_var('BUILD'); + my $version = get_var('VERSION'); + # Let us see if the installed system is one that needs to have the prerelease + # note shown, default is NO. + my $prerelease = 0; + if ($beta =~ /Beta/ or $version eq "Rawhide") { + $prerelease = 1; + } + # If the image is a nightly build or test build, it is not clear whether + # the prerelease should be there or not, but according to what we decided + # this is not a big issue. This piece of code can be used later, when + # we decide differently. + elsif ($nightly =~ /\.[nt]\.\d+/) { + my $prerelease = 10; + } + # For all prerelease requiring ISOs, assert that prerelease is there. + if ($prerelease == 1) { + assert_screen "prerelease_note"; + } + elsif ($prerelease == 0) { + # If the prerelease note is shown, where it should not be, die! + if (check_screen "prerelease_note") { + die "The PRERELEASE tag is shown, but it should NOT be."; + } + } } sub _assert_and_click { @@ -925,6 +1000,69 @@ sub _assert_and_click { } } +sub check_version { + # This function checks if the correct version is display during installation + # in Anaconda, i.e. nonlive media showing Rawhide when Rawhide and version numbers + # when not Rawhide, while live media always showing version numbers. + + my $version = lc(get_var('VERSION')); + if ($version eq 'rawhide' && get_var('LIVE')) { + $version = get_var('RAWREL'); + } + assert_screen "version_${version}_ident"; +} + +sub spell_version_number { + my $version = shift; + my %ones = ( + "0" => "Zero", + "1" => "One", + "2" => "Two", + "3" => "Three", + "4" => "Four", + "5" => "Five", + "6" => "Six", + "7" => "Seven", + "8" => "Eight", + "9" => "Nine", + ); + my %tens = ( + "2" => "Twenty", + "3" => "Thirty", + "4" => "Fourty", + "5" => "Fifty", + "6" => "Sixty", + "7" => "Seventy", + "8" => "Eighty", + "9" => "Ninety", + ); + + my $ten = substr($version, 0, 1); + my $one = substr($version, 1, 1); + my $speltnum = ""; + if ($one eq "0") { + $speltnum = "$tens{$ten}"; + } + else { + $speltnum = "$tens{$ten} $ones{$one}"; + } + return $speltnum; +} + +sub rec_log { + my ($line, $condition, $failref) = @_; + if ($condition) { + $line = "${line} - SUCCEEDED\n"; + } + else { + push @$failref, $line; + $line = "${line} - FAILED\n"; + } + my $file = "/tmp/os-release.log"; + script_run "echo \"$line\" >> $file"; + +} + sub click_unwanted_notifications { # there are a few KDE tests where at some point we want to click # on all visible 'update available' notifications (there can be diff --git a/needles/anaconda/identification/30_wallpaper-20190527.json b/needles/anaconda/identification/30_wallpaper-20190527.json new file mode 100644 index 00000000..08ed074c --- /dev/null +++ b/needles/anaconda/identification/30_wallpaper-20190527.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 838, + "ypos": 663, + "width": 163, + "height": 51, + "type": "match" + } + ], + "properties": [], + "tags": [ + "30_wallpaper" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/30_wallpaper-20190527.png b/needles/anaconda/identification/30_wallpaper-20190527.png new file mode 100644 index 00000000..7af7b88d Binary files /dev/null and b/needles/anaconda/identification/30_wallpaper-20190527.png differ diff --git a/needles/anaconda/identification/30_wallpaper.json b/needles/anaconda/identification/30_wallpaper.json new file mode 100644 index 00000000..376c5fd0 --- /dev/null +++ b/needles/anaconda/identification/30_wallpaper.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 847, + "ypos": 722, + "width": 163, + "height": 38, + "type": "match" + } + ], + "properties": [], + "tags": [ + "30_wallpaper" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/30_wallpaper.png b/needles/anaconda/identification/30_wallpaper.png new file mode 100644 index 00000000..48916879 Binary files /dev/null and b/needles/anaconda/identification/30_wallpaper.png differ diff --git a/needles/anaconda/identification/31_wallpaper-20190527.json b/needles/anaconda/identification/31_wallpaper-20190527.json new file mode 100644 index 00000000..1d0a89bd --- /dev/null +++ b/needles/anaconda/identification/31_wallpaper-20190527.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 838, + "ypos": 663, + "width": 163, + "height": 51, + "type": "match" + } + ], + "properties": [], + "tags": [ + "31_wallpaper" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/31_wallpaper-20190527.png b/needles/anaconda/identification/31_wallpaper-20190527.png new file mode 100644 index 00000000..7af7b88d Binary files /dev/null and b/needles/anaconda/identification/31_wallpaper-20190527.png differ diff --git a/needles/anaconda/identification/31_wallpaper.json b/needles/anaconda/identification/31_wallpaper.json new file mode 100644 index 00000000..600028bf --- /dev/null +++ b/needles/anaconda/identification/31_wallpaper.json @@ -0,0 +1,16 @@ +{ + "area": [ + { + "xpos": 847, + "ypos": 722, + "width": 163, + "height": 38, + "type": "match" + } + ], + "properties": [], + "tags": [ + "31_wallpaper", + "Rawhide_wallpaper" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/31_wallpaper.png b/needles/anaconda/identification/31_wallpaper.png new file mode 100644 index 00000000..48916879 Binary files /dev/null and b/needles/anaconda/identification/31_wallpaper.png differ diff --git a/needles/anaconda/identification/leftbar_atomic.json b/needles/anaconda/identification/leftbar_atomic.json new file mode 100644 index 00000000..b8d8d728 --- /dev/null +++ b/needles/anaconda/identification/leftbar_atomic.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "type": "match", + "height": 743, + "ypos": 15, + "width": 123, + "xpos": 16 + } + ], + "properties": [], + "tags": [ + "leftbar_atomic" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/leftbar_atomic.png b/needles/anaconda/identification/leftbar_atomic.png new file mode 100644 index 00000000..aa0e3eab Binary files /dev/null and b/needles/anaconda/identification/leftbar_atomic.png differ diff --git a/needles/anaconda/identification/leftbar_generic-20190527.json b/needles/anaconda/identification/leftbar_generic-20190527.json new file mode 100644 index 00000000..b888f960 --- /dev/null +++ b/needles/anaconda/identification/leftbar_generic-20190527.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "height": 723, + "width": 123, + "ypos": 4, + "xpos": 15, + "type": "match" + } + ], + "properties": [], + "tags": [ + "leftbar_generic" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/leftbar_generic-20190527.png b/needles/anaconda/identification/leftbar_generic-20190527.png new file mode 100644 index 00000000..877f0243 Binary files /dev/null and b/needles/anaconda/identification/leftbar_generic-20190527.png differ diff --git a/needles/anaconda/identification/leftbar_generic.json b/needles/anaconda/identification/leftbar_generic.json new file mode 100644 index 00000000..9d826584 --- /dev/null +++ b/needles/anaconda/identification/leftbar_generic.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "leftbar_generic" + ], + "area": [ + { + "xpos": 14, + "ypos": 15, + "width": 123, + "height": 728, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/leftbar_generic.png b/needles/anaconda/identification/leftbar_generic.png new file mode 100644 index 00000000..ac6e9bf7 Binary files /dev/null and b/needles/anaconda/identification/leftbar_generic.png differ diff --git a/needles/anaconda/identification/leftbar_server.json b/needles/anaconda/identification/leftbar_server.json new file mode 100644 index 00000000..292a2145 --- /dev/null +++ b/needles/anaconda/identification/leftbar_server.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "leftbar_server" + ], + "area": [ + { + "xpos": 9, + "ypos": 10, + "width": 134, + "height": 747, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/leftbar_server.png b/needles/anaconda/identification/leftbar_server.png new file mode 100644 index 00000000..e968e790 Binary files /dev/null and b/needles/anaconda/identification/leftbar_server.png differ diff --git a/needles/anaconda/identification/leftbar_workstation.json b/needles/anaconda/identification/leftbar_workstation.json new file mode 100644 index 00000000..80234c6f --- /dev/null +++ b/needles/anaconda/identification/leftbar_workstation.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "leftbar_workstation" + ], + "area": [ + { + "xpos": 9, + "ypos": 44, + "width": 139, + "height": 701, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/leftbar_workstation.png b/needles/anaconda/identification/leftbar_workstation.png new file mode 100644 index 00000000..870b159b Binary files /dev/null and b/needles/anaconda/identification/leftbar_workstation.png differ diff --git a/needles/anaconda/identification/prerelease_note.json b/needles/anaconda/identification/prerelease_note.json new file mode 100644 index 00000000..65f9ef5a --- /dev/null +++ b/needles/anaconda/identification/prerelease_note.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "prerelease_note" + ], + "area": [ + { + "xpos": 740, + "ypos": 34, + "width": 159, + "height": 27, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/prerelease_note.png b/needles/anaconda/identification/prerelease_note.png new file mode 100644 index 00000000..bae99adb Binary files /dev/null and b/needles/anaconda/identification/prerelease_note.png differ diff --git a/needles/anaconda/identification/prerelease_note_generic_blue.json b/needles/anaconda/identification/prerelease_note_generic_blue.json new file mode 100644 index 00000000..93d91d2b --- /dev/null +++ b/needles/anaconda/identification/prerelease_note_generic_blue.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 780, + "ypos": 33, + "width": 159, + "height": 26, + "type": "match" + } + ], + "properties": [], + "tags": [ + "prerelease_note" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/prerelease_note_generic_blue.png b/needles/anaconda/identification/prerelease_note_generic_blue.png new file mode 100644 index 00000000..70a85734 Binary files /dev/null and b/needles/anaconda/identification/prerelease_note_generic_blue.png differ diff --git a/needles/anaconda/identification/prerelease_note_server_blue.json b/needles/anaconda/identification/prerelease_note_server_blue.json new file mode 100644 index 00000000..138dcf73 --- /dev/null +++ b/needles/anaconda/identification/prerelease_note_server_blue.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 738, + "ypos": 33, + "width": 159, + "height": 26, + "type": "match" + } + ], + "properties": [], + "tags": [ + "prerelease_note" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/prerelease_note_server_blue.png b/needles/anaconda/identification/prerelease_note_server_blue.png new file mode 100644 index 00000000..8202bef1 Binary files /dev/null and b/needles/anaconda/identification/prerelease_note_server_blue.png differ diff --git a/needles/anaconda/identification/topbar_atomic-20190611.json b/needles/anaconda/identification/topbar_atomic-20190611.json new file mode 100644 index 00000000..0cdbc857 --- /dev/null +++ b/needles/anaconda/identification/topbar_atomic-20190611.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "width": 683, + "height": 32, + "ypos": 39, + "xpos": 104, + "type": "match" + } + ], + "properties": [], + "tags": [ + "topbar_generic" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_atomic-20190611.png b/needles/anaconda/identification/topbar_atomic-20190611.png new file mode 100644 index 00000000..ce675e11 Binary files /dev/null and b/needles/anaconda/identification/topbar_atomic-20190611.png differ diff --git a/needles/anaconda/identification/topbar_atomic.json b/needles/anaconda/identification/topbar_atomic.json new file mode 100644 index 00000000..31958be9 --- /dev/null +++ b/needles/anaconda/identification/topbar_atomic.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 104, + "ypos": 39, + "width": 683, + "height": 32, + "type": "match" + } + ], + "properties": [], + "tags": [ + "topbar_atomic" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_atomic.png b/needles/anaconda/identification/topbar_atomic.png new file mode 100644 index 00000000..ce675e11 Binary files /dev/null and b/needles/anaconda/identification/topbar_atomic.png differ diff --git a/needles/anaconda/identification/topbar_generic-20190628.json b/needles/anaconda/identification/topbar_generic-20190628.json new file mode 100644 index 00000000..87b3e6e9 --- /dev/null +++ b/needles/anaconda/identification/topbar_generic-20190628.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "topbar_generic" + ], + "area": [ + { + "xpos": 93, + "ypos": 49, + "width": 643, + "height": 34, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_generic-20190628.png b/needles/anaconda/identification/topbar_generic-20190628.png new file mode 100644 index 00000000..2eb3bc85 Binary files /dev/null and b/needles/anaconda/identification/topbar_generic-20190628.png differ diff --git a/needles/anaconda/identification/topbar_generic.json b/needles/anaconda/identification/topbar_generic.json new file mode 100644 index 00000000..a15386ed --- /dev/null +++ b/needles/anaconda/identification/topbar_generic.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "topbar_generic" + ], + "area": [ + { + "xpos": 105, + "ypos": 38, + "width": 683, + "height": 32, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_generic.png b/needles/anaconda/identification/topbar_generic.png new file mode 100644 index 00000000..b5d46f75 Binary files /dev/null and b/needles/anaconda/identification/topbar_generic.png differ diff --git a/needles/anaconda/identification/topbar_server.json b/needles/anaconda/identification/topbar_server.json new file mode 100644 index 00000000..b19c3da2 --- /dev/null +++ b/needles/anaconda/identification/topbar_server.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "topbar_server" + ], + "area": [ + { + "xpos": 106, + "ypos": 43, + "width": 625, + "height": 36, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_server.png b/needles/anaconda/identification/topbar_server.png new file mode 100644 index 00000000..4ee9a479 Binary files /dev/null and b/needles/anaconda/identification/topbar_server.png differ diff --git a/needles/anaconda/identification/topbar_workstation-20190516.json b/needles/anaconda/identification/topbar_workstation-20190516.json new file mode 100644 index 00000000..2eb0326e --- /dev/null +++ b/needles/anaconda/identification/topbar_workstation-20190516.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "width": 638, + "xpos": 92, + "type": "match", + "ypos": 37, + "height": 38 + } + ], + "properties": [], + "tags": [ + "topbar_workstation" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_workstation-20190516.png b/needles/anaconda/identification/topbar_workstation-20190516.png new file mode 100644 index 00000000..32afa19b Binary files /dev/null and b/needles/anaconda/identification/topbar_workstation-20190516.png differ diff --git a/needles/anaconda/identification/topbar_workstation.json b/needles/anaconda/identification/topbar_workstation.json new file mode 100644 index 00000000..2f68d19f --- /dev/null +++ b/needles/anaconda/identification/topbar_workstation.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "topbar_workstation" + ], + "area": [ + { + "xpos": 95, + "ypos": 69, + "width": 675, + "height": 38, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/topbar_workstation.png b/needles/anaconda/identification/topbar_workstation.png new file mode 100644 index 00000000..4df74b40 Binary files /dev/null and b/needles/anaconda/identification/topbar_workstation.png differ diff --git a/needles/anaconda/identification/version_29.json b/needles/anaconda/identification/version_29.json new file mode 100644 index 00000000..b89470c6 --- /dev/null +++ b/needles/anaconda/identification/version_29.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 796, + "height": 31, + "width": 93, + "ypos": 39, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_29_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_29.png b/needles/anaconda/identification/version_29.png new file mode 100644 index 00000000..dd5585da Binary files /dev/null and b/needles/anaconda/identification/version_29.png differ diff --git a/needles/anaconda/identification/version_29_blue.json b/needles/anaconda/identification/version_29_blue.json new file mode 100644 index 00000000..3ade592b --- /dev/null +++ b/needles/anaconda/identification/version_29_blue.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 797, + "ypos": 12, + "width": 93, + "height": 31, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_29_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_29_blue.png b/needles/anaconda/identification/version_29_blue.png new file mode 100644 index 00000000..ce675e11 Binary files /dev/null and b/needles/anaconda/identification/version_29_blue.png differ diff --git a/needles/anaconda/identification/version_30.json b/needles/anaconda/identification/version_30.json new file mode 100644 index 00000000..cc4aceba --- /dev/null +++ b/needles/anaconda/identification/version_30.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 796, + "ypos": 40, + "width": 93, + "height": 32, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_30_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_30.png b/needles/anaconda/identification/version_30.png new file mode 100644 index 00000000..d0ff4772 Binary files /dev/null and b/needles/anaconda/identification/version_30.png differ diff --git a/needles/anaconda/identification/version_30_blue.json b/needles/anaconda/identification/version_30_blue.json new file mode 100644 index 00000000..de6eeff2 --- /dev/null +++ b/needles/anaconda/identification/version_30_blue.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 797, + "ypos": 39, + "width": 93, + "height": 32, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_30_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_30_blue.png b/needles/anaconda/identification/version_30_blue.png new file mode 100644 index 00000000..993f1ec3 Binary files /dev/null and b/needles/anaconda/identification/version_30_blue.png differ diff --git a/needles/anaconda/identification/version_31.json b/needles/anaconda/identification/version_31.json new file mode 100644 index 00000000..96600023 --- /dev/null +++ b/needles/anaconda/identification/version_31.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 783, + "ypos": 40, + "width": 90, + "height": 20, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_31_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_31.png b/needles/anaconda/identification/version_31.png new file mode 100644 index 00000000..8cd5c919 Binary files /dev/null and b/needles/anaconda/identification/version_31.png differ diff --git a/needles/anaconda/identification/version_31_blue.json b/needles/anaconda/identification/version_31_blue.json new file mode 100644 index 00000000..f688f1ef --- /dev/null +++ b/needles/anaconda/identification/version_31_blue.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 783, + "ypos": 41, + "width": 90, + "height": 18, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_31_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_31_blue.png b/needles/anaconda/identification/version_31_blue.png new file mode 100644 index 00000000..beeb3df4 Binary files /dev/null and b/needles/anaconda/identification/version_31_blue.png differ diff --git a/needles/anaconda/identification/version_rawhide.json b/needles/anaconda/identification/version_rawhide.json new file mode 100644 index 00000000..ecff7ee5 --- /dev/null +++ b/needles/anaconda/identification/version_rawhide.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 740, + "ypos": 14, + "width": 147, + "height": 16, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_rawhide_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_rawhide.png b/needles/anaconda/identification/version_rawhide.png new file mode 100644 index 00000000..07483b03 Binary files /dev/null and b/needles/anaconda/identification/version_rawhide.png differ diff --git a/needles/anaconda/identification/version_rawhide_blue.json b/needles/anaconda/identification/version_rawhide_blue.json new file mode 100644 index 00000000..9c8e71de --- /dev/null +++ b/needles/anaconda/identification/version_rawhide_blue.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 740, + "ypos": 12, + "width": 148, + "height": 19, + "type": "match" + } + ], + "properties": [], + "tags": [ + "version_rawhide_ident" + ] +} \ No newline at end of file diff --git a/needles/anaconda/identification/version_rawhide_blue.png b/needles/anaconda/identification/version_rawhide_blue.png new file mode 100644 index 00000000..7e6cb64d Binary files /dev/null and b/needles/anaconda/identification/version_rawhide_blue.png differ diff --git a/templates b/templates index 3702293e..85939d37 100755 --- a/templates +++ b/templates @@ -1,5 +1,6 @@ #!/usr/share/openqa/script/load_templates # +# # Fedora Machines, Products, TestSuites and JobTemplates # # use load_templates to load the file into the database @@ -17,6 +18,17 @@ }, test_suite => { name => "install_default_upload" }, }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Workstation-live-iso", + version => "*", + }, + test_suite => { name => "release_identification" }, + }, { machine => { name => "uefi" }, prio => 11, @@ -72,6 +84,17 @@ }, test_suite => { name => "install_default_upload" }, }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, + test_suite => { name => "release_identification" }, + }, { machine => { name => "uefi" }, prio => 11, @@ -160,6 +183,17 @@ }, test_suite => { name => "install_default_upload" }, }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "KDE-live-iso", + version => "*", + }, + test_suite => { name => "release_identification" }, + }, { machine => { name => "uefi" }, prio => 16, @@ -204,6 +238,17 @@ }, test_suite => { name => "install_default_upload" }, }, + { + machine => { name => "64bit" }, + prio => 50, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Silverblue-dvd_ostree-iso", + version => "*", + }, + test_suite => { name => "release_identification" }, + }, { machine => { name => "uefi" }, prio => 51, @@ -4120,6 +4165,7 @@ settings => [ { key => "PACKAGE_SET", value => "default" }, { key => "POSTINSTALL", value => "_collect_data" }, + { key => "IDENTIFICATION", value => "true" }, ], }, { @@ -5073,6 +5119,16 @@ { key => "STARTSTOP", value => "true" }, ], }, + { + name => "release_identification", + settings => [ + { key => "START_AFTER_TEST", value => "install_default_upload" }, + { key => "BOOTFROM", value => "c" }, + { key => "HDD_1", value => "disk_%FLAVOR%_%MACHINE%.qcow2" }, + { key => "ENTRYPOINT", value => "text_login_gui fedora_release os_release" }, + { key => "USER_LOGIN", value => "false" }, + ], + }, { name => "desktop_notifications_live", settings => [ diff --git a/tests/_boot_to_anaconda.pm b/tests/_boot_to_anaconda.pm index d2c6c582..a4b04a32 100644 --- a/tests/_boot_to_anaconda.pm +++ b/tests/_boot_to_anaconda.pm @@ -39,6 +39,8 @@ sub run { # call do_bootloader with postinstall=0, the params, and the mutex do_bootloader(postinstall=>0, params=>$params, mutex=>$mutex); + # Read variables for identification tests (see further). + my $identification = get_var('IDENTIFICATION'); # proceed to installer if (get_var("KICKSTART")) { # wait for the bootloader *here* - in a test that inherits from @@ -53,7 +55,8 @@ sub run { type_string "2\n"; # wait for text version of Anaconda main hub assert_screen "anaconda_main_hub_text", 300; - } else { + } + else { # on lives, we have to explicitly launch anaconda if (get_var('LIVE')) { _assert_and_click("live_start_anaconda_icon", timeout=>300); @@ -85,6 +88,16 @@ sub run { return; } } + + # If we want to test self identification, in the test suite + # we set "identification" to "true". + # Here, we will watch for the graphical elements in Anaconda main hub. + my $branched = get_var('VERSION'); + if ($identification eq 'true' or $branched ne "Rawhide") { + check_left_bar(); # See utils.pm + check_prerelease(); + check_version(); + } # This is where we get to if we accepted fate above, *or* # didn't match anything: if the Rawhide warning didn't # show by now it never will, so we'll just wait for the @@ -94,7 +107,6 @@ sub run { } } - sub test_flags { return { fatal => 1 }; } diff --git a/tests/_do_install_and_reboot.pm b/tests/_do_install_and_reboot.pm index 9d80232a..05bc193f 100644 --- a/tests/_do_install_and_reboot.pm +++ b/tests/_do_install_and_reboot.pm @@ -40,6 +40,12 @@ sub _set_root_password { wait_screen_change { send_key "tab"; }; type_very_safely $root_password; } + # Another screen to test identification on + my $identification = get_var('IDENTIFICATION'); + if ($identification eq 'true') { + check_top_bar(); + check_prerelease(); + } assert_and_click "anaconda_spoke_done"; } } @@ -73,6 +79,19 @@ sub run { # more. So wait for screen to stop moving before we click. wait_still_screen 2; assert_and_click "anaconda_main_hub_begin_installation"; + + # If we want to test identification we will do it + # on several places in this procedure, such as + # on this screen and also on password creation screens + # etc. + my $identification = get_var('IDENTIFICATION'); + my $branched = get_var('VERSION'); + if ($identification eq 'true' or $branched ne "Rawhide") { + check_left_bar(); + check_prerelease(); + check_version(); + } + unless ($rootuserdone) { _do_root_and_user(); # With the slow typing - especially with SWITCHED_LAYOUT - we diff --git a/tests/_graphical_wait_login.pm b/tests/_graphical_wait_login.pm index 1eb23b27..84344dc0 100644 --- a/tests/_graphical_wait_login.pm +++ b/tests/_graphical_wait_login.pm @@ -84,6 +84,12 @@ sub run { mouse_set(300, 800); # KDE can take ages to start up check_desktop_clean(tries=>40); + # If we want to check that there is a correct wallpaper used, as a part + # of self identification test, we will do it here. + if (get_var('IDENTIFICATION') eq 'true') { + my $version = get_var('VERSION'); + assert_screen "${version}_wallpaper"; + } } sub test_flags { diff --git a/tests/disk_guided_empty.pm b/tests/disk_guided_empty.pm index 4c215aba..a6aec0f0 100644 --- a/tests/disk_guided_empty.pm +++ b/tests/disk_guided_empty.pm @@ -2,9 +2,13 @@ use base "anacondatest"; use strict; use testapi; use anaconda; +use utils; sub run { my $self = shift; + # If we want to test graphics during installation, we need to + # call the test suite with an "IDENTIFICATION=true" variable. + my $identification = get_var('IDENTIFICATION'); # Anaconda hub # Go to INSTALLATION DESTINATION and ensure one disk is selected. select_disks(); @@ -14,6 +18,13 @@ sub run { if (get_var('TEST_UPDATES')){ assert_screen "anaconda_install_destination_updates", 30; } + # Here the self identification test code is placed. + my $branched = get_var('VERSION'); + if ($identification eq 'true' or $branched ne "Rawhide") { + check_top_bar(); # See utils.pm + check_prerelease(); + check_version(); + } assert_and_click "anaconda_spoke_done"; diff --git a/tests/fedora_release.pm b/tests/fedora_release.pm new file mode 100644 index 00000000..eff6cd96 --- /dev/null +++ b/tests/fedora_release.pm @@ -0,0 +1,59 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This test checks that Fedora release is correctly described in /etc/fedora-release file. +# The content of the file should be: "Fedora release ()" +# where "version" is a number of the current Fedora version and "version_words" is the number +# quoted in words, such as 31 = Thirty One. +# Before branching, the parenthesis contain the word "Rawhide". + +sub run { + # First, let us define some variables needed to run the program. + my $self = shift; + # The file to be checked + my $filename = '/etc/fedora-release'; + # Version as defined in the RAWREL and VERSION variables. We need both values, because the release + # string can be a combination of those two. + my $version = get_var('VERSION'); + my $raw_version = get_var('RAWREL'); + + # Read the content of the file to compare. + my $line = script_output('cat /etc/fedora-release'); + chomp $line; + + # Create a spelt form of the version number. + my $speltnum = "undefined"; + if ($version eq "Rawhide") { + $speltnum = "Rawhide"; + $version = $raw_version; + } + else { + $speltnum = spell_version_number($version); + } + + # Create the ideal content of the release file + # and compare it with its real counterpart. + # Everything is ok, when that matches, otherwise + # the script fails. + my $releasenote = "Fedora release $version ($speltnum)"; + my $log = "fedora-release.log"; + if ($releasenote eq $line) { + rec_log $log, "The content in /etc/fedora-release should be $releasenote and is $line: PASSED"; + upload_logs "/tmp/fedora-release.log", failok=> 1; + } + else { + rec_log $log, "The content in /etc/fedora-release should be $releasenote but is $line: FAILED"; + upload_logs "/tmp/fedora-release.log", failok=> 1; + die "The content in /etc/fedora-release should be $releasenote but is $line."; + } +} + +sub test_flags { + return {always_rollback => 1}; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/os_release.pm b/tests/os_release.pm new file mode 100644 index 00000000..3da1f344 --- /dev/null +++ b/tests/os_release.pm @@ -0,0 +1,141 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This test checks that the descriptions in /etc/os-release file are correct and that they +# match the current version. +sub strip_marks { + # Remove the quotation marks from the string: + my $string = shift; + $string=~ tr/"//d; + return $string; +} + +sub run { + # First, let us define some variables needed to run the program. + my $self = shift; + # The file to be checked + my $filename = '/etc/os-release'; + + # Read the content of the file to compare. Let us parse the file + # and create a hash with those values, so that we can easily access + # them and assert them. + my $infile = script_output "cat /etc/os-release"; + my @infile = split /\n/, $infile; + my %content = (); + foreach (@infile) { + chomp $_; + my ($key, $value) = split /=/, $_; + $content{$key} = $value; + } + + # Now, we have all the data ready and we can start testing, first let us get + # correct variables to compare the system data with. + # First, we know the basic stuff + my $id = get_var("DISTRI"); # Should be "fedora" + my $name = ucfirst($id); + my $version_id = get_var("VERSION"); # Should be the version number or Rawhide. + my $target = lc($version_id); + if ($version_id eq "Rawhide") { + $version_id = get_var("RAWREL"); + } + + # the 'generic' os-release in fedora-release has no VARIANT or + # VARIANT_ID and the string used in values like VERSION, that in other + # cases is the VARIANT, is 'Rawhide' for Rawhide and the spelt version + # number for other releases. These are the values we'll see for an + # Everything image. + my $variant_id = ""; + my $variant = "generic"; + my $varstr = "Rawhide"; + $varstr = spell_version_number($version_id) unless ($target eq 'rawhide'); + + # now replace the values with the correct ones if we are testing a + # subvariant that maps to a known variant + my $subvariant = get_var('SUBVARIANT'); + my %variants = ( + Server => ["server", "Server Edition"], + Workstation => ["workstation", "Workstation Edition"], + AtomicHost => ["atomic.host", "Atomic Host"], + CoreOS => ["coreos", "CoreOS"], + KDE => ["kde", "KDE Plasma"], + Silverblue => ["workstation", "Workstation Edition"], + ); + if (exists($variants{$subvariant})) { + ($variant_id, $variant) = @{$variants{$subvariant}}; + $varstr = $variant; + } + + my $version = "$version_id ($varstr)"; + my $platform_id = "platform:f$version_id"; + my $pretty = "$name $version_id ($varstr)"; + + #Now. we can start testing the real values from the installed system. + my @fails = (); + my $failref =\@fails; + + # Test for name + rec_log "NAME should be $name and is $content{'NAME'}", $content{'NAME'} eq $name, $failref; + + # Test for version. + my $strip = strip_marks($content{'VERSION'}); + rec_log "VERSION should be $version and is $strip", $strip eq $version, $failref; + + # Test for version_id + rec_log "VERSION_ID should be $version_id and is $content{'VERSION_ID'}", $content{'VERSION_ID'} eq $version_id, $failref; + + # Test for platform_id + $strip = strip_marks($content{'PLATFORM_ID'}); + rec_log "PLATFORM_ID should be $platform_id and is $strip", $strip eq $platform_id, $failref; + + # Test for pretty name + $strip = strip_marks($content{'PRETTY_NAME'}); + rec_log "PRETTY_NAME should be $pretty and is $strip", $strip eq $pretty, $failref; + + # Test for RH Bugzilla Product + $strip = strip_marks($content{'REDHAT_BUGZILLA_PRODUCT'}); + rec_log "REDHAT_BUGZILLA_PRODUCT should be $name and is $strip", $strip eq $name, $failref; + + # Test for RH Bugzilla Product Version + rec_log "REDHAT_BUGZILLA_PRODUCT_VERSION should be $target and is $content{'REDHAT_BUGZILLA_PRODUCT_VERSION'}", $content{'REDHAT_BUGZILLA_PRODUCT_VERSION'} eq $target, $failref; + + # Test for RH Support Product + $strip = strip_marks($content{'REDHAT_SUPPORT_PRODUCT'}); + rec_log "REDHAT_SUPPORT_PRODUCT should be $name and is $strip", $strip eq $name, $failref; + + # Test for RH Support Product Version + rec_log "REDHAT_SUPPORT_PRODUCT_VERSION should be $target and is $content{'REDHAT_SUPPORT_PRODUCT_VERSION'}", $content{'REDHAT_SUPPORT_PRODUCT_VERSION'} eq $target, $failref; + + # Test for Variant but only in case of Server or Workstation + if ($variant ne "generic") { + $strip = strip_marks($content{'VARIANT'}); + rec_log "VARIANT should be $variant and is $strip", $strip eq $variant, $failref; + + # Test for VARIANT_ID + rec_log "VARIANT_ID should be $variant_id and is $content{'VARIANT_ID'}", $content{'VARIANT_ID'} eq $variant_id, $failref; + } + else { + print "VARIANT was not tested because the compose is not Workstation or Server Edition.\n"; + print "VARIANT_ID was not tested because the compose is not Workstation or Server Edition.\n"; + } + + # Check for fails, count them, collect their messages and die if something was found. + my $failcount = scalar @fails; + script_run "echo \"There were $failcount failures in total.\" >> /tmp/os-release.log"; + upload_logs "/tmp/os-release.log", failok=>1; + + my $failmessages = ""; + foreach my $fail (@fails) { + $failmessages .= "\n".$fail; + } + die $failmessages if ($failcount > 0); +} + +sub test_flags { + return {always_rollback => 1}; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/text_login_gui.pm b/tests/text_login_gui.pm new file mode 100644 index 00000000..41028578 --- /dev/null +++ b/tests/text_login_gui.pm @@ -0,0 +1,17 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +sub run { + my $self = shift; + + boot_to_login_screen(timeout => 300); + $self->root_console(tty=>3); +} + +sub test_flags { + return { fatal => 1, milestone => 1 }; +} +1; +# vim: set sw=4 et: