diff --git a/lib/utils.pm b/lib/utils.pm index 849a0fc4..76a1f9b9 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 get_milestone boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user/; +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 get_milestone boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean/; sub run_with_error_check { my ($func, $error_screen) = @_; @@ -482,3 +482,41 @@ sub anaconda_create_user { assert_and_click "anaconda_spoke_done"; } } + +sub check_desktop_clean { + # Check we're at a 'clean' desktop. This used to be a simple + # needle check, but Rawhide's default desktop is now one which + # changes over time, and the GNOME top bar is now translucent + # by default; together these changes mean it's impossible to + # make a reliable needle, so we need something more tricksy to + # cover that case. 'tries' is the amount of check cycles to run + # before giving up and failing; each cycle should take ~3 secs. + my %args = ( + tries => 10, + @_ + ); + foreach my $i (1..$args{tries}) { + # we still *do* the needle check, for all cases it covers + return if (check_screen "graphical_desktop_clean", 1); + # now do the special GNOME case + if (get_var("DESKTOP") eq "gnome") { + send_key "alt-f1"; + if (check_screen "overview_app_grid", 2) { + send_key "alt-f1"; + wait_still_screen 3; + # go back to the desktop, if we're still at the app + # grid (can be a bit fuzzy depending on response lag) + while (check_screen "overview_app_grid", 1) { + send_key "alt-f1"; + wait_still_screen 3; + } + return; + } + } + else { + # to keep the timing equal + sleep 2; + } + } + die "Clean desktop not reached!"; +} diff --git a/needles/gnome/desktop_clean-20170616-rawhide_ocr.json b/needles/gnome/desktop_clean-20170616-rawhide_ocr.json deleted file mode 100644 index 45587d14..00000000 --- a/needles/gnome/desktop_clean-20170616-rawhide_ocr.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "area": [ - { - "height": 15, - "type": "ocr", - "width": 67, - "xpos": 9, - "ypos": 6 - }, - { - "height": 1, - "type": "match", - "width": 1, - "xpos": 946, - "ypos": 12 - } - ], - "properties": [], - "tags": [ - "DESKTOP-gnome", - "ENV-DISTRI-fedora", - "LANGUAGE-english", - "graphical_desktop_clean" - ] -} \ No newline at end of file diff --git a/needles/gnome/desktop_clean-20170616-rawhide_ocr.png b/needles/gnome/desktop_clean-20170616-rawhide_ocr.png deleted file mode 100644 index 407d72ab..00000000 Binary files a/needles/gnome/desktop_clean-20170616-rawhide_ocr.png and /dev/null differ diff --git a/needles/gnome/overview_app_grid.json b/needles/gnome/overview_app_grid.json new file mode 100644 index 00000000..f81ea569 --- /dev/null +++ b/needles/gnome/overview_app_grid.json @@ -0,0 +1,16 @@ +{ + "area": [ + { + "height": 45, + "type": "match", + "width": 45, + "xpos": 24, + "ypos": 657 + } + ], + "properties": [], + "tags": [ + "DESKTOP-gnome", + "overview_app_grid" + ] +} \ No newline at end of file diff --git a/needles/gnome/overview_app_grid.png b/needles/gnome/overview_app_grid.png new file mode 100644 index 00000000..00e7015b Binary files /dev/null and b/needles/gnome/overview_app_grid.png differ diff --git a/tests/_graphical_input.pm b/tests/_graphical_input.pm index 31f9b9be..ec69b86d 100644 --- a/tests/_graphical_input.pm +++ b/tests/_graphical_input.pm @@ -26,7 +26,7 @@ sub run { send_key "esc"; send_key "esc"; send_key "esc"; - assert_screen "graphical_desktop_clean"; + check_desktop_clean; } } diff --git a/tests/_graphical_wait_login.pm b/tests/_graphical_wait_login.pm index a5c39852..e9994122 100644 --- a/tests/_graphical_wait_login.pm +++ b/tests/_graphical_wait_login.pm @@ -89,7 +89,7 @@ sub run { # Move the mouse somewhere it won't highlight the match areas mouse_set(300, 200); # KDE can take ages to start up - assert_screen "graphical_desktop_clean", 120; + check_desktop_clean(tries=>40); } } diff --git a/tests/desktop_browser.pm b/tests/desktop_browser.pm index 6bad0945..372d89b3 100644 --- a/tests/desktop_browser.pm +++ b/tests/desktop_browser.pm @@ -14,7 +14,7 @@ use utils; sub run { my $self = shift; - assert_screen 'graphical_desktop_clean'; + check_desktop_clean; send_key 'alt-f1'; # wait out animations wait_still_screen 2; diff --git a/tests/desktop_notifications.pm b/tests/desktop_notifications.pm index 4b6eaa05..c0e82f2d 100644 --- a/tests/desktop_notifications.pm +++ b/tests/desktop_notifications.pm @@ -65,7 +65,7 @@ sub run { type_very_safely get_var("USER_PASSWORD", "weakpassword"); send_key 'ret'; } - assert_screen 'graphical_desktop_clean', 90; + check_desktop_clean(tries=>30); # now, WE WAIT. this is just an unconditional wait - rather than # breaking if we see an update notification appear - so we catch # things that crash a few minutes after startup, etc. diff --git a/tests/desktop_terminal.pm b/tests/desktop_terminal.pm index 262a934c..64486d3d 100644 --- a/tests/desktop_terminal.pm +++ b/tests/desktop_terminal.pm @@ -5,7 +5,7 @@ use utils; sub run { my $self=shift; - assert_screen 'graphical_desktop_clean'; + check_desktop_clean; menu_launch_type('terminal'); wait_still_screen 5; # need to be root