From d1e7b89efd14f930655a1b3d214bcfe593d7977b Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 17 Dec 2018 12:10:06 -0800 Subject: [PATCH] Fix a potential race in desktop update test https://openqa.stg.fedoraproject.org/tests/424393 is a failure where the 'Download' [updates] button was already visible when we went to the tab. We already checked whether an 'apply' button is visible and skipped the 'refresh' click if so, but because the 'download' button is a new thing, we weren't skipping the 'refresh' click if 'download' was already visible. So in this case, even though we could already see 'download', we went ahead and clicked 'refresh'...then *immediately* started looking for 'download'. It seems that Software did not refresh and remove the 'Download' button *immediately* when we pressed 'refresh' - it left the 'Download' button visible briefly, and *in this brief window*, we clicked it. *Then* Software kinda 'noticed' we'd clicked 'Update', and it seems it just sort of throws away our click on 'Download' at that point and does the refresh. So at that point, the test thinks it's clicked 'Download' and expects to see 'Apply', but actually the 'Download' click got more or less thrown away, so the test fails, sitting at the 'Download' button. To solve this, let's just extend the existing check to skip the 'refresh' click if 'download' *or* 'apply' are already visible. There is a sort of possibility here that we could wind up downloading and installing some updates that existed and were noticed *before* we did our python3-kickstart trick, but not install the python3-kickstart update, and cause the test to fail because of that, but that doesn't seem to have happened before when we were seeing the 'update' button, so I think I'm not going to borrow trouble. If it happens, we'll deal with it I guess. The comment talks only about KDE, but clearly it can be the case that an automatic check makes the button visible on GNOME too, so let's rewrite the comment too. Signed-off-by: Adam Williamson --- tests/desktop_update_graphical.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/desktop_update_graphical.pm b/tests/desktop_update_graphical.pm index 1c69ba9c..638681cb 100644 --- a/tests/desktop_update_graphical.pm +++ b/tests/desktop_update_graphical.pm @@ -40,9 +40,9 @@ sub run { } } assert_and_click 'desktop_package_tool_update'; - # if this is KDE and it had already noticed the notification, we - # will already have the apply button at this point - unless (check_screen 'desktop_package_tool_update_apply', 5) { + # depending on automatic update checks, 'apply' or 'download' may + # already be visible at this point, we may not need to refresh + unless (check_screen ['desktop_package_tool_update_apply', 'desktop_package_tool_update_download'], 5) { # refresh updates assert_and_click 'desktop_package_tool_update_refresh', '', 120; }