Bugzilla – Attachment 113922 Details for
Bug 27055
Update Firefox version used in Selenium GUI tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP Bug 27055: Fix compatibility with newer Selenium+Firefox version
WIP-Bug-27055-Fix-compatibility-with-newer-Seleniu.patch (text/plain), 5.83 KB, created by
Victor Grousset/tuxayo
on 2020-11-23 13:15:10 UTC
(
hide
)
Description:
WIP Bug 27055: Fix compatibility with newer Selenium+Firefox version
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-11-23 13:15:10 UTC
Size:
5.83 KB
patch
obsolete
>From da78fe6e53b3e7dc59d56fbe6568396639afd1cd Mon Sep 17 00:00:00 2001 >From: Victor Grousset/tuxayo <victor@tuxayo.net> >Date: Thu, 19 Nov 2020 13:47:45 +0100 >Subject: [PATCH] WIP Bug 27055: Fix compatibility with newer Selenium+Firefox > version > >Fix "submit is not a function error" >A submit button should be named "submit", in this case, it's id. >https://stackoverflow.com/questions/833032/submit-is-not-a-function-error-in-javascript > >Fix some uses of get_attribute() > >Fix with wait_for_element_visible() > >WIP: >1. Fix SCSS which used the id=submit >2. Fix other tests, there are major issues like crash at the beginning > or endless duration > >== Test plan == >1. Update selenium/standalone-firefox to the latest version [1] >2. prove t/db_dependent/selenium/authentication.t >3. It fails with: arguments[0].form.submit is not a function >4. Apply patch >5. Retest >6. Success > >[1] In koha-testing-docker you can do it with >docker-compose.yml > selenium: >- image: selenium/standalone-firefox:2.53.1-americium >+ image: selenium/standalone-firefox >--- > koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 2 +- > t/db_dependent/selenium/regressions.t | 10 ++++++---- > t/db_dependent/selenium/update_child_to_adult.t | 3 ++- > t/lib/Selenium.pm | 4 ++-- > 4 files changed, 11 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >index b980f1e3af..046f288bcf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt >@@ -112,7 +112,7 @@ > > <!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> --> > >-<p class="submit"><input id="submit" type="submit" value="Login" tabindex="4" /></p> >+<p class="submit"><input id="submit-button" type="submit" value="Login" tabindex="4" /></p> > </form> > [% IF ( casAuthentication ) %] > <h4>Cas login</h4> >diff --git a/t/db_dependent/selenium/regressions.t b/t/db_dependent/selenium/regressions.t >index 3ee8fa190c..d3b597a984 100755 >--- a/t/db_dependent/selenium/regressions.t >+++ b/t/db_dependent/selenium/regressions.t >@@ -59,10 +59,12 @@ subtest 'OPAC - borrowernumber and branchcode as html attributes' => sub { > $patron->set_password({ password => $password }); > $s->opac_auth( $patron->userid, $password ); > my $elt = $driver->find_element('//span[@class="loggedinusername"]'); >- is( $elt->get_attribute('data-branchcode'), $patron->library->branchcode, >+ is( $elt->get_attribute('data-branchcode', 1), $patron->library->branchcode, > "Since bug 20921 span.loggedinusername should contain data-branchcode" >+ # No idea why we need the second param of get_attribute(). As >+ # data-branchcode is still there after page finished loading. > ); >- is( $elt->get_attribute('data-borrowernumber'), $patron->borrowernumber, >+ is( $elt->get_attribute('data-borrowernumber', 1), $patron->borrowernumber, > "Since bug 20921 span.loggedinusername should contain data-borrowernumber" > ); > push @cleanup, $patron, $patron->category, $patron->library; >@@ -168,11 +170,11 @@ subtest 'Display circulation table correctly' => sub { > > my @thead_th = $driver->find_elements('//table[@id="issues-table"]/thead/tr/th'); > my $thead_length = 0; >- $thead_length += $_->get_attribute('colspan') || 0 for @thead_th; >+ $thead_length += $_->get_attribute('colspan', 1) || 0 for @thead_th; > > my @tfoot_td = $driver->find_elements('//table[@id="issues-table"]/tfoot/tr/td'); > my $tfoot_length = 0; >- $tfoot_length += $_->get_attribute('colspan') || 0 for @tfoot_td; >+ $tfoot_length += $_->get_attribute('colspan', 1) || 0 for @tfoot_td; > > my @tbody_td = $driver->find_elements('//table[@id="issues-table"]/tbody/tr[2]/td'); > my $tbody_length = 0; >diff --git a/t/db_dependent/selenium/update_child_to_adult.t b/t/db_dependent/selenium/update_child_to_adult.t >index 1443e91de8..ca0275bf48 100755 >--- a/t/db_dependent/selenium/update_child_to_adult.t >+++ b/t/db_dependent/selenium/update_child_to_adult.t >@@ -117,6 +117,7 @@ subtest 'Update child to patron' => sub { > # Note that if there is only 1 adult in the DB the popup does not appears, but an alert instead. Not tested so far. > my $handles = $driver->get_window_handles; > $driver->switch_to_window($handles->[1]); >+ $s->wait_for_element_visible('//table[@id="catst"]'); # category table > $driver->find_element('//input[@id="catcode'.$patron_category_A->categorycode.'"]')->click; > $s->submit_form; > >@@ -134,7 +135,7 @@ subtest 'Update child to patron' => sub { > $driver->find_element('//div[@id="toolbar"]/div[@class="btn-group"][last()]')->click; # More button group > > my $update_link = $driver->find_element('//a[@id="updatechild"]'); >- is($update_link->get_attribute('data-toggle'), 'tooltip', q|The update link should have a data-toggle attribute => it's a tooltip, not clickable|); >+ is($update_link->get_attribute('data-toggle', 1), 'tooltip', q|The update link should have a data-toggle attribute => it's a tooltip, not clickable|); > $update_link->click; > like( $driver->get_current_url, qr{/members/moremember\.pl\?borrowernumber=$adult_borrowernumber$}, 'After clicking the link, nothing happens, no # in the URL'); > }; >diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm >index 261502aae1..d3910c56ca 100644 >--- a/t/lib/Selenium.pm >+++ b/t/lib/Selenium.pm >@@ -103,8 +103,8 @@ sub auth { > > $self->driver->get($mainpage); > $self->fill_form( { userid => $login, password => $password } ); >- my $login_button = $self->driver->find_element('//input[@id="submit"]'); >- $login_button->submit(); >+ my $login_button = $self->driver->find_element('//input[@id="submit-button"]'); >+ $login_button->click(); > } > > sub opac_auth { >-- >2.29.2
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 27055
:
113810
|
113922
|
114005
|
114584
|
114725