From bc611d69754be7ad8eac8ed7caf226686391a3c7 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 29 Jun 2021 10:53:37 -0700 Subject: [PATCH] Tweak the desktop update loop again to try and be more robust I've seen some failures caused by a sort of race where both 'apply' and 'refresh' needles match at the first assertion, but openQA "prefers" the 'refresh' match. So we click the 'refresh' button and *immediately* check_screen for apply, which is still visible...but by the time we go to click it, it's gone because the refresh found something new and now it's showing "Download". This tweak should help, because if we can 'see' both refresh and apply at the start, we'll just go ahead and click apply, we won't refresh. The logic becomes a little more obscure, but I'm not sure I see a fix for that. At least until KDE's tool finally settles down for two releases in a row and we might be able to simplify this whole thing. Signed-off-by: Adam Williamson --- tests/desktop_update_graphical.pm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/desktop_update_graphical.pm b/tests/desktop_update_graphical.pm index ec846fc9..b9cf95a2 100644 --- a/tests/desktop_update_graphical.pm +++ b/tests/desktop_update_graphical.pm @@ -60,24 +60,30 @@ sub run { # depending on automatic update checks, 'apply' or 'download' may # already be visible at this point, we may not need to refresh assert_screen ['desktop_package_tool_update_apply', 'desktop_package_tool_update_download', 'desktop_package_tool_update_refresh'], 120; - click_lastmatch if (match_has_tag "desktop_package_tool_update_refresh"); - # wait for refresh, then apply updates, moving the mouse every two - # minutes to avoid the idle screen blank kicking in. Depending on - # whether this is KDE or GNOME and what Fedora release, we may see - # 'apply' right away, or 'download' then 'apply'. my $tags = ['desktop_package_tool_update_download', 'desktop_package_tool_update_apply']; + # Apply updates, moving the mouse every two minutes to avoid the + # idle screen blank kicking in. Depending on whether this is KDE + # or GNOME and what Fedora release, we may see 'apply' right away, + # or 'download' then 'apply', or we may only see 'refresh' and + # need to click it first for (my $n = 1; $n < 6; $n++) { if (check_screen $tags, 120) { # if we see 'apply', we're done here, quit out of the loop last if (match_has_tag 'desktop_package_tool_update_apply'); - # if we see 'download', we're in the GNOME Software 3.30.5+ - # two-step process - let's hit it, and continue waiting for + # if we see 'download', let's hit it, and continue waiting # for apply (only) wait_screen_change { click_lastmatch; }; - $n -= 1 if ($n > 1); + $n -= 1 if ($n > 2); $tags = ['desktop_package_tool_update_apply']; next; } + elsif ($n == 1) { + # if we're in the first iteration of this loop and we can't + # see apply or download, that means we can only see refresh + # and should click it + click_lastmatch; + sleep 2; + } # move the mouse to stop the screen blanking on idle mouse_set 10, 10; mouse_hide;