Bugzilla – Attachment 130016 Details for
Bug 29458
Show login button consistently in relation to login instructions, reset and register links
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29458: Fix selenium test
Bug-29458-Fix-selenium-test.patch (text/plain), 2.13 KB, created by
Jonathan Druart
on 2022-01-31 16:02:12 UTC
(
hide
)
Description:
Bug 29458: Fix selenium test
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-31 16:02:12 UTC
Size:
2.13 KB
patch
obsolete
>From c011b7dd91705d6ba98ed7452bde71815859ab21 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 31 Jan 2022 16:39:59 +0100 >Subject: [PATCH] Bug 29458: Fix selenium test > >The authentication.t selenium tests (and a couple of others) were >failing with: >Error while executing command: element not interactable: Element <input class="btn btn-primary" type="submit"> could not be scrolled into view at /usr/local/share/perl/5.32.1/Selenium/Remote/Driver.pm line 411. at /usr/local/share/perl/5.32.1/Selenium/Remote/Driver.pm line 356. > >We changed the other of the form, and t::lib::Selenium::submit_form was >not getting the correct (first) form. The one from the auth modal was >retrieved and submit button was clicked. Selenium raised an error as it >is not displayed. >The ->is_displayed selenium method does not work, as per the doc >""" >Note: This does *not* tell you an element's 'visibility' property; as it still takes up space in the DOM and is therefore considered 'displayed'. >""" >https://metacpan.org/pod/Selenium::Remote::WebElement#is_displayed > >"The internet" is saying we should be able to use the following in our >xpath expression: not(ancestor::div[contains(@style,'display:none')] >but it actually only works if the display:none rule is defined on the >node (not from .css). Which does not work for us. > >The only solution I found is to check for the size of the element, which >is (0,0) if not effectively displayed. >--- > t/lib/Selenium.pm | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm >index b49bc730b02..6d9afacdce5 100644 >--- a/t/lib/Selenium.pm >+++ b/t/lib/Selenium.pm >@@ -135,7 +135,11 @@ sub submit_form { > } > > my $default_submit_selector = '//fieldset[@class="action"]/input[@type="submit"]'; >- $self->driver->find_element($default_submit_selector)->click >+ my @elts = map { my $size = $_->get_size; ( $size->{height} && $size->{width} ) ? $_ : () } $self->driver->find_elements($default_submit_selector); >+ >+ die "Too many forms are displayed. Cannot submit." if @elts > 1; >+ >+ return $elts[0]->click; > } > > sub click { >-- >2.25.1
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 29458
:
127539
|
127828
|
129240
|
129606
|
129612
|
129617
| 130016