Bugzilla – Attachment 89267 Details for
Bug 22781
Fields on patron search results should be html/json filtered
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22781: Add tests
Bug-22781-Add-tests.patch (text/plain), 4.46 KB, created by
Jonathan Druart
on 2019-05-03 01:34:23 UTC
(
hide
)
Description:
Bug 22781: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-05-03 01:34:23 UTC
Size:
4.46 KB
patch
obsolete
>From 3feb1269900a65ec445bc4203b851222f63a9626 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 1 May 2019 20:28:55 -0400 >Subject: [PATCH] Bug 22781: Add tests > >Test plan: >Apply only this patch >=> The tests will fail, the library's name is not correctly escaped. > >Note: >This applies for the whole patchset, when the tests fail you will need >to remove the patrons added by the tests with the following SQL query: > delete from borrowers where surname like "test_patron_%"; >We are expecting END to be called even if something goes wrong, but >DESTROY must be used instead. This will be fixed separately, on its own >bug report. >--- > t/db_dependent/selenium/patrons_search.t | 102 +++++++++++++++++++++++++++++++ > 1 file changed, 102 insertions(+) > create mode 100644 t/db_dependent/selenium/patrons_search.t > >diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t >new file mode 100644 >index 0000000000..6cd831118c >--- /dev/null >+++ b/t/db_dependent/selenium/patrons_search.t >@@ -0,0 +1,102 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use C4::Context; >+ >+use utf8; >+use Test::More tests => 1; >+use Test::MockModule; >+ >+use C4::Context; >+use Koha::AuthUtils; >+use t::lib::Mocks; >+use t::lib::Selenium; >+use t::lib::TestBuilder; >+ >+eval { require Selenium::Remote::Driver; }; >+skip "Selenium::Remote::Driver is needed for selenium tests.", 1 if $@; >+ >+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 $builder = t::lib::TestBuilder->new; >+ >+our @cleanup; >+subtest 'Search patrons' => sub { >+ plan tests => 3; >+ >+ my @patrons; >+ my $borrowernotes = q|<strong>just 'a" note</strong> \123 â¤|; >+ my $borrowernotes_displayed = q|just 'a" note \123 â¤|; >+ my $branchname = q|<strong>just 'another" library</strong> \123 â¤|; >+ my $patron_category = $builder->build_object( >+ { class => 'Koha::Patron::Categories', category_type => 'A' } ); >+ my $library = $builder->build_object( >+ { class => 'Koha::Libraries', value => { branchname => $branchname } } >+ ); >+ for my $i ( 1 .. 25 ) { >+ push @patrons, >+ $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ surname => "test_patron_" . $i++, >+ categorycode => $patron_category->categorycode, >+ branchcode => $library->branchcode, >+ borrowernotes => $borrowernotes, >+ } >+ } >+ ); >+ } >+ >+ $s->auth; >+ $driver->get( $base_url . "/members/members-home.pl" ); >+ $s->fill_form( { searchmember_filter => 'test_patron' } ); >+ $s->submit_form; >+ my $first_patron = $patrons[0]; >+ >+ my @td = $driver->find_elements('//table[@id="memberresultst"]/tbody/tr/td'); >+ is( $td[5]->get_text, $branchname, >+ 'Column "Library" should be the 6th and contain the html tags - they have been html filtered' >+ ); >+ is( $td[9]->get_text, $borrowernotes_displayed, >+ 'Column "Circ note" should be the 10th and not contain the html tags - they have not been html filtered' >+ ); >+ >+ $driver->find_element( >+ '//a[@href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=' >+ . $first_patron->borrowernumber >+ . '"]' )->click; >+ is( >+ $driver->get_title, >+ sprintf( >+ "Koha ⺠Patrons ⺠Modify patron %s %s (%s)", >+ $first_patron->firstname, $first_patron->surname, >+ $first_patron->category->description, >+ ) >+ ); >+ push @cleanup, $_ for @patrons; >+ push @cleanup, $library; >+ push @cleanup, $patron_category; >+}; >+ >+END { >+ $_->delete for @cleanup; >+} >-- >2.11.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 22781
:
89267
|
89268
|
89269
|
89270
|
89271
|
89395
|
89396
|
89397
|
89398
|
89399
|
89582
|
89583
|
89584
|
89585
|
89586