Skip to content

Commit

Permalink
Merge pull request #5978 from Martchus/fix-test
Browse files Browse the repository at this point in the history
Fix race condition in `t/ui/18-tests-details.t`
  • Loading branch information
mergify[bot] authored Oct 4, 2024
2 parents 21f2e3b + 1549cea commit a54ab8d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions t/ui/18-tests-details.t
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@ sub current_tab { $driver->find_element('.nav.nav-tabs .active')->get_text }
# returns the contents of the candidates combo box as hash (key: tag, value: array of needle names)
sub find_candidate_needles {
# ensure the candidates menu is visible
my @candidates_menus = $driver->find_elements('#candidatesMenu');
is(scalar @candidates_menus, 1, 'exactly one candidates menu present at a time');
my $candidates_menu = wait_for_element(selector => '#candidatesMenu', is_displayed => 1) or return {};
# save implicit waiting time as long as we are only looking for elements
# that should be visible already
disable_timeout;
return {} unless $candidates_menus[0]->is_enabled;
$candidates_menus[0]->click();
return {} unless $candidates_menu->is_enabled;
$candidates_menu->click;

# read the tags/needles from the HTML structure
my @section_elements = $driver->find_elements('#needlediff_selector ul table');
Expand Down Expand Up @@ -152,7 +151,6 @@ subtest 'show job modules execution time' => sub {

subtest 'displaying image result with candidates' => sub {
$driver->find_element('[href="#step/bootloader/1"]')->click();
wait_for_ajax;
my $needles = find_candidate_needles;
is_deeply($needles, {'inst-bootmenu' => []}, 'correct tags displayed') or diag explain $needles;
};
Expand Down Expand Up @@ -611,7 +609,6 @@ sub test_with_error {
# check whether candidates are displayed as expected
my $random_number = int(rand(100000));
$driver->get("/tests/99946?prevent_caching=$random_number#step/yast2_lan/1");
wait_for_ajax_and_animations;
is_deeply(find_candidate_needles, $expect, $test_name // 'candidates displayed as expected');
}

Expand Down

0 comments on commit a54ab8d

Please sign in to comment.