Bugzilla – Attachment 160976 Details for
Bug 35506
selenium/regressions.t is failing randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35506: Demo of the fix that uses flag in page JS
Bug-35506-Demo-of-the-fix-that-uses-flag-in-page-J.patch (text/plain), 2.79 KB, created by
Victor Grousset/tuxayo
on 2024-01-12 14:58:05 UTC
(
hide
)
Description:
Bug 35506: Demo of the fix that uses flag in page JS
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-01-12 14:58:05 UTC
Size:
2.79 KB
patch
obsolete
>From e7853b03b7313476fab8753de819e8c624915ee1 Mon Sep 17 00:00:00 2001 >From: Victor Grousset/tuxayo <victor@tuxayo.net> >Date: Fri, 12 Jan 2024 15:56:28 +0100 >Subject: [PATCH] Bug 35506: Demo of the fix that uses flag in page JS > >--- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 2 +- > t/db_dependent/selenium/regressions.t | 2 ++ > t/lib/Selenium.pm | 22 ++++++++++++++++++++ > 3 files changed, 25 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 3bcea4a2d4..a14c0ad9b7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -281,7 +281,7 @@ $(document).ready(function() { > return false; > }); > console.log("show checkouts handler attached") >- >+ window._pageFullyReady = {}; > } > ,2000); > >diff --git a/t/db_dependent/selenium/regressions.t b/t/db_dependent/selenium/regressions.t >index b9e9cb2edf..935cb81391 100755 >--- a/t/db_dependent/selenium/regressions.t >+++ b/t/db_dependent/selenium/regressions.t >@@ -186,6 +186,7 @@ subtest 'Display circulation table correctly' => sub { > . "/circ/circulation.pl?borrowernumber=" > . $patron->borrowernumber ); > >+ $s->wait_for_page_fully_ready; > # Display the table clicking on the "Show checkouts" button > $driver->find_element('//a[@id="issues-table-load-now-button"]')->click; > >@@ -313,6 +314,7 @@ subtest 'Encoding in session variables' => sub { > $driver->find_element('//input[@id="barcode"]')->send_keys( $item->barcode ); > $driver->find_element('//fieldset[@id="circ_circulation_issue"]/button[@type="submit"]')->click; > >+ $s->wait_for_page_fully_ready; > # Display the table clicking on the "Show checkouts" button > $driver->find_element('//a[@id="issues-table-load-now-button"]') > ->click; >diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm >index 1117ce7762..96d562a1aa 100644 >--- a/t/lib/Selenium.pm >+++ b/t/lib/Selenium.pm >@@ -265,6 +265,28 @@ sub click_when_visible { > $elt->click unless $clicked; # finally Raise the error > } > >+ >+sub wait_for_page_fully_ready { >+ my ($self) = @_; >+ >+ my $is_ready; >+ my $max_retries = $self->max_retries; >+ >+ my $i; >+ while ( not $is_ready ) { >+ warn "############# waiting (" . $i . ")"; >+ $is_ready = $self->driver->execute_script('return window._pageFullyReady'); >+ $self->driver->pause(333) unless $is_ready; >+ >+ if ( $max_retries <= ++$i ) { >+ $self->capture( $self->driver ); >+ $self->driver->quit(); >+ die "Cannot wait more for page to be fully ready (wait_for_page_fully_ready)"; >+ } >+ } >+} >+ >+ > sub max_retries { 10 } > > =head1 NAME >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35506
:
160511
|
160975
|
160976
|
161301
|
161302
|
161609
|
161630
|
161631