From 56d79a483da8cac66aa22b9904fd2a64464b8eff Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 12 Jul 2022 10:25:25 +0200 Subject: [PATCH] Bug 31104: Add a selenium test Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/selenium/patrons_search.t | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t index 5c086b00ab..06e1753572 100755 --- a/t/db_dependent/selenium/patrons_search.t +++ b/t/db_dependent/selenium/patrons_search.t @@ -40,14 +40,14 @@ eval { require Selenium::Remote::Driver; }; if ( $@ ) { plan skip_all => "Selenium::Remote::Driver is needed for selenium tests."; } else { - plan tests => 1; + plan tests => 2; } my $s = t::lib::Selenium->new; my $driver = $s->driver; -my $opac_base_url = $s->opac_base_url; my $base_url = $s->base_url; +my $mainpage = $s->base_url . q|mainpage.pl|; my $builder = t::lib::TestBuilder->new; subtest 'Search patrons' => sub { @@ -152,6 +152,7 @@ subtest 'Search patrons' => sub { my $total_number_of_patrons = Koha::Patrons->search->count; my $table_id = "memberresultst"; + $driver->get($mainpage . q|?logout.x=1|); $s->auth; C4::Context->set_preference('DefaultPatronSearchFields',""); my $PatronsPerPage = 15; @@ -283,6 +284,19 @@ subtest 'Search patrons' => sub { push @cleanup, $attribute_type, $attribute_type_searchable; C4::Context->set_preference('DefaultPatronSearchFields',$default_patron_search_fields); C4::Context->set_preference('PatronsPerPage',$default_patron_per_page); +}; + +subtest 'Error too long' => sub { + plan tests => 1; + $driver->get($mainpage . q|?logout.x=1|); + $s->auth; - $driver->quit(); + my $very_long_string = q{some long test to search in patron fields some long test to search in patron fields some long test to search in patron fields}; + $driver->get( $base_url . "/members/members-home.pl" ); + $s->fill_form( { search_patron_filter => $very_long_string } ); + $s->submit_form; + $s->wait_for_ajax; + ok( 1, "No error when querying a very long search" ); }; + +$driver->quit(); -- 2.39.5