Bugzilla – Attachment 173482 Details for
Bug 33484
Ability to remember user's selected table configuration and search filters for tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33484: Fix selenium/patrons_search.t
Bug-33484-Fix-seleniumpatronssearcht.patch (text/plain), 5.76 KB, created by
Jonathan Druart
on 2024-10-28 09:46:41 UTC
(
hide
)
Description:
Bug 33484: Fix selenium/patrons_search.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-28 09:46:41 UTC
Size:
5.76 KB
patch
obsolete
>From 84d0586eb4f47d4ea33e7b711fbb1f5e986cfcd4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 21 Oct 2024 14:56:48 +0200 >Subject: [PATCH] Bug 33484: Fix selenium/patrons_search.t > >Filters are saved, we need to clear the form when needed. > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/selenium/patrons_search.t | 25 ++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t >index e2867d2d1dd..6507d627ee4 100755 >--- a/t/db_dependent/selenium/patrons_search.t >+++ b/t/db_dependent/selenium/patrons_search.t >@@ -280,6 +280,7 @@ subtest 'Search patrons' => sub { > $s->submit_form; > sleep $DT_delay && $s->wait_for_ajax; > >+ clear_filters(); > $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron'); > sleep $DT_delay && $s->wait_for_ajax; > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', $PatronsPerPage, 26, $total_number_of_patrons), 'Searching in standard brings back correct results' ); >@@ -288,10 +289,7 @@ subtest 'Search patrons' => sub { > sleep $DT_delay && $s->wait_for_ajax; > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', $PatronsPerPage, 25, $total_number_of_patrons), 'Filtering on library works in combination with main search' ); > >- # Reset the filters >- $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click(); >- $s->submit_form; >- sleep $DT_delay && $s->wait_for_ajax; >+ clear_filters(); > > # And make sure all the patrons are present > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries', $PatronsPerPage, $total_number_of_patrons), 'Resetting filters works as expected' ); >@@ -313,8 +311,7 @@ subtest 'Search patrons' => sub { > > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('No entries to show (filtered from %s total entries)', $total_number_of_patrons), 'Searching on a non-searchable attribute returns no results' ); > >- # clear form >- $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click(); >+ clear_filters(); > > # Search on searchable attribute, we expect 2 patrons > $s->fill_form( { 'search_patron_filter' => 'test_attr_2' } ); >@@ -323,8 +320,7 @@ subtest 'Search patrons' => sub { > > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', 2, 2, $total_number_of_patrons), 'Searching on a searchable attribute returns correct results' ); > >- # clear form >- $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click(); >+ clear_filters(); > > $s->fill_form( { 'search_patron_filter' => 'test_attr_3' } ); # Terms must be split > $s->submit_form; >@@ -332,8 +328,7 @@ subtest 'Search patrons' => sub { > > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', 2, 2, $total_number_of_patrons), 'Searching on a searchable attribute returns correct results' ); > >- # clear form >- $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click(); >+ clear_filters(); > > # Search on searchable attribute as specific field, we expect 2 patrons > $s->fill_form( { 'search_patron_filter' => 'test_attr_4' } ); >@@ -361,12 +356,14 @@ subtest 'Search patrons' => sub { > > C4::Context->set_preference( 'PatronsPerPage', 5 ); > $driver->get( $base_url . "/members/members-home.pl" ); >+ clear_filters(); > $s->fill_form( { 'search_patron_filter' => 'test_patron' } ); > $s->submit_form; > sleep $DT_delay && $s->wait_for_ajax; > my $patron_selected_text = $driver->find_element('//div[@id="table_search_selections"]/span')->get_text; > is( $patron_selected_text, "", "Patrons selected is not displayed" ); > >+ $driver->capture_screenshot('selenium_xxx.png'); > my @checkboxes = $driver->find_elements( > '//input[@type="checkbox"][@name="borrowernumber"]'); > $checkboxes[2]->click; >@@ -387,6 +384,7 @@ subtest 'Search patrons' => sub { > > # Perform another search > $driver->get( $base_url . "/members/members-home.pl" ); >+ clear_filters(); > $s->fill_form( { 'search_patron_filter' => 'test_patron' } ); > $s->submit_form; > sleep $DT_delay && $s->wait_for_ajax; >@@ -414,6 +412,7 @@ subtest 'Search patrons' => sub { > # We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980 > > $driver->get( $base_url . "/members/members-home.pl" ); >+ clear_filters(); > $s->fill_form( { 'search_patron_filter' => 'test_patron' } ); > $s->submit_form; > sleep $DT_delay && $s->wait_for_ajax; >@@ -741,3 +740,9 @@ sub is_patron_shown { > my @checkboxes = $driver->find_elements('//input[@type="checkbox"][@name="borrowernumber"]'); > return scalar( grep { $_->get_value == $patron->borrowernumber } @checkboxes ); > } >+ >+sub clear_filters { >+ $driver->find_element('//form[@class="patron_search_form"]//*[@class="btn btn-default clear_search"]')->click(); >+ $s->submit_form; >+ sleep $DT_delay && $s->wait_for_ajax; >+} >-- >2.34.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 33484
:
149444
|
149445
|
149447
|
149448
|
149449
|
149925
|
149926
|
149927
|
149928
|
149929
|
149930
|
149974
|
149975
|
149976
|
149977
|
149978
|
149979
|
173443
|
173444
|
173445
|
173446
|
173447
|
173448
|
173449
|
173450
|
173451
|
173452
|
173453
|
173454
|
173455
|
173456
|
173457
|
173458
|
173459
|
173460
|
173461
|
173462
|
173463
|
173464
|
173465
|
173466
|
173467
|
173468
|
173469
|
173470
|
173471
|
173472
|
173473
|
173474
|
173475
|
173476
|
173477
|
173478
|
173479
|
173480
|
173481
| 173482 |
173483
|
173484
|
173485
|
173486
|
173546
|
173606
|
173607
|
173985
|
174219