Skip to content

Commit

Permalink
Merge pull request #5461 from Martchus/next-and-previous
Browse files Browse the repository at this point in the history
Avoid sporadic failures in `t/ui/16-tests_job_next_previous.t`
  • Loading branch information
mergify[bot] authored Feb 7, 2024
2 parents 0421525 + 1953654 commit 199e451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions t/lib/OpenQA/SeleniumTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ sub wait_until_element_gone ($selector, @args) {
sub wait_for_element (%args) {
my $selector = $args{selector};
my $expected_is_displayed = $args{is_displayed};
my $trigger_function = $args{trigger_function};
my $method = $args{method} // $find_method;

my $element;
wait_until(
sub {
$trigger_function->() if $trigger_function;
my @elements = $_driver->find_elements($selector, $method);
if (scalar @elements >= 1
&& (!defined $expected_is_displayed || $elements[0]->is_displayed == $expected_is_displayed))
Expand Down
6 changes: 4 additions & 2 deletions t/ui/16-tests_job_next_previous.t
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ driver_missing unless my $driver = call_driver;
disable_timeout;

sub goto_next_previous_tab {
$driver->find_element('#nav-item-for-next_previous')->click();
wait_for_element(selector => '.dataTables_wrapper');
wait_for_element(
trigger_function => sub { $driver->find_element_by_link_text('Next & previous results')->click },
selector => '.dataTables_wrapper'
);
wait_for_ajax(msg => 'Next & previous table ready');
}

Expand Down

0 comments on commit 199e451

Please sign in to comment.