From 5d6feb9808958a2235ac75c649e3f9feed5e52f4 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 3 Sep 2021 10:12:26 -0700 Subject: [PATCH] Tweak Cockpit 'Join Domain...' click Always do the page-down thing, having it conditional just makes things more complicated unnecessarily. Try up to 5 times to click the link, because Cockpit sometimes redraws itself before us identifying it and clicking on it, e.g.: https://openqa.fedoraproject.org/tests/968422 Signed-off-by: Adam Williamson --- tests/realmd_join_cockpit.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/realmd_join_cockpit.pm b/tests/realmd_join_cockpit.pm index 39453146..bbf061fb 100644 --- a/tests/realmd_join_cockpit.pm +++ b/tests/realmd_join_cockpit.pm @@ -31,17 +31,18 @@ sub run { # check_type_string in cockpit because of that fucking constantly # scrolling graph start_cockpit(1); - # we may have to scroll down before the button is visible - if (check_screen "cockpit_join_domain_button", 5) { - click_lastmatch; - } - else { - # to activate the right pane - assert_and_click "cockpit_main"; - send_key "pgdn"; - # wait out scroll... - wait_still_screen 2; + # to activate the right pane + assert_and_click "cockpit_main"; + send_key "pgdn"; + # wait out scroll... + wait_still_screen 2; + # sometimes this click fails because CPU usage goes from one line + # to two at just the wrong moment and the link moves, so if it + # didn't work, try again a few times + my $count = 4; + while ($count > 0) { assert_and_click "cockpit_join_domain_button", 5; + last if (check_screen "cockpit_join_domain", 30); } assert_screen "cockpit_join_domain"; type_string("\t\t", 4);