From abd1d1a6982c1b2034a794c1047386a782c3afe7 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 1 Mar 2022 10:24:48 -0800 Subject: [PATCH] check_desktop: handle GNOME showing inactive button briefly check_desktop tries to catch when the overview is open and close it. But with GNOME 42, it seems the inactive "Activities" button is shown briefly on login before GNOME opens the overview. If check_desktop catches that, it will think the overview isn't open and it doesn't need to do anything. So if we match on first cycle through the loop, let's wait_still_screen then match again. Signed-off-by: Adam Williamson --- lib/utils.pm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 9e5153a6..78284cb2 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -877,14 +877,12 @@ sub anaconda_create_user { sub check_desktop { # Check we're at a desktop. We do this by looking for the "apps" # menu button ("Activities" button on GNOME, kicker button on - # KDE). This is set up as a helper function because, for a while, - # GNOME made the top bar translucent by default *and* we had an - # animated background by default, which made doing this solely - # with needle matches hard, so we had a workaround of trying to - # open the overview with the super key and match on the app grid - # icon. But GNOME has gone back to the top bar being a solid color - # by default, so we don't have this problem any more and this is - # back to just being a simple needle match. + # KDE). This is set up as a helper function so we can handle + # GNOME's behaviour of opening the overview on first login; all + # our tests were written when GNOME *didn't* do that, so it + # would be awkward to find all the places in them where we need + # to close the overview. Instead, we just have this function + # close it if it's open. my %args = ( timeout => 30, @_ @@ -894,8 +892,14 @@ sub check_desktop { while ($count > 0) { $count -= 1; assert_screen "apps_menu_button", $args{timeout}; - # GNOME 40 starts on the overview by default; for consistency with - # older GNOME and KDE, let's just close it + if ($count == 4) { + # GNOME 42 shows the inactive menu button briefly before + # opening the overview. So we need to wait a bit on first + # cycle in case GNOME is about to open the overview. + wait_still_screen 5; + assert_screen "apps_menu_button"; + } + # Here's where we detect if the overview is open and close it if (match_has_tag "apps_menu_button_active") { $activematched = 1; wait_still_screen 5;