Bugzilla – Attachment 121652 Details for
Bug 28489
CGI::Session is incorrectly serialized to DB in production env / when strict_sql_modes = 0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28489: Add selenium tests
Bug-28489-Add-selenium-tests.patch (text/plain), 4.72 KB, created by
David Cook
on 2021-06-07 02:27:49 UTC
(
hide
)
Description:
Bug 28489: Add selenium tests
Filename:
MIME Type:
Creator:
David Cook
Created:
2021-06-07 02:27:49 UTC
Size:
4.72 KB
patch
obsolete
>From ff6b80ad2683743710c95c47c491d62c4ee721f8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 5 Jun 2021 14:50:48 +0200 >Subject: [PATCH] Bug 28489: Add selenium tests > >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > t/db_dependent/selenium/regressions.t | 89 +++++++++++++++++++++++++++++++++-- > 1 file changed, 86 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/selenium/regressions.t b/t/db_dependent/selenium/regressions.t >index df6f8b86bc..c0cc48d125 100755 >--- a/t/db_dependent/selenium/regressions.t >+++ b/t/db_dependent/selenium/regressions.t >@@ -16,10 +16,11 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use utf8; > > use C4::Context; > >-use Test::More tests => 6; >+use Test::More tests => 7; > use Test::MockModule; > > use C4::Context; >@@ -32,7 +33,7 @@ use t::lib::TestBuilder; > use t::lib::Mocks; > > eval { require Selenium::Remote::Driver; }; >-skip "Selenium::Remote::Driver is needed for selenium tests.", 1 if $@; >+skip "Selenium::Remote::Driver is needed for selenium tests.", 7 if $@; > > my $s = t::lib::Selenium->new; > >@@ -254,9 +255,91 @@ subtest 'XSS vulnerabilities in pagination' => sub { > > push @cleanup, $patron, $patron->category, $patron->library; > >- $driver->quit(); > }; > >+subtest 'Encoding in session variables' => sub { >+ plan tests => 18; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $library->branchcode, flags => 0 } >+ } >+ ); >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio->biblionumber, >+ library => $library->branchcode, >+ } >+ ); >+ >+ my $original_SessionStorage = C4::Context->preference('SessionStorage'); >+ for my $SessionStorage ( qw( memcached mysql tmp ) ) { >+ C4::Context->set_preference( 'SessionStorage', $SessionStorage ); >+ for my $branchname (qw( Test1 Test2â¤ï¸ Test3ä )) { >+ my $library = >+ Koha::Libraries->find($branchname) || $builder->build_object( >+ { >+ class => 'Koha::Libraries', >+ value => { >+ branchcode => $branchname, >+ branchname => $branchname, >+ } >+ } >+ ); >+ # Make sure we are logged in >+ $driver->get( $base_url . q|mainpage.pl?logout.x=1| ); >+ $s->auth; >+ # Switch to the new library >+ $driver->get( $base_url . 'circ/set-library.pl' ); >+ $s->fill_form( { branch => $branchname } ); >+ $s->submit_form; >+ # Check an item out >+ $driver->get( $base_url >+ . 'circ/circulation.pl?borrowernumber=' >+ . $patron->borrowernumber ); >+ # We must have the logged-in-branch-name displayed, or we got a 500 >+ is( >+ $driver->find_element( '//span[@class="logged-in-branch-name"]')->get_text(), >+ $branchname, >+ sprintf( "logged-in-branch-name set - SessionStorage=%s, branchname=%s", $SessionStorage, $branchname >+ ) >+ ); >+ >+ $driver->find_element('//input[@id="barcode"]')->send_keys( $item->barcode ); >+ $driver->find_element('//fieldset[@id="circ_circulation_issue"]/button[@type="submit"]')->click; >+ >+ # Display the table clicking on the "Show checkouts" button >+ $driver->find_element('//a[@id="issues-table-load-now-button"]') >+ ->click; >+ >+ my @tds = $driver->find_elements( >+ '//table[@id="issues-table"]/tbody/tr[2]/td'); >+ >+ # Select the td for "Checked out from" (FIXME this is not robust and could be improved >+ my $td_checked_out_from = $tds[8]; >+ is( >+ $td_checked_out_from->get_text(), >+ $branchname, >+ sprintf( "'Checked out from' column should contain the branchname - SessionStorage=%s, branchname=%s", $SessionStorage, $branchname ) >+ ); >+ >+ # Check the item in >+ AddReturn( $item->barcode, $library->branchcode ); >+ } >+ } >+ >+ C4::Context->set_preference('SessionStorage', $original_SessionStorage); >+ push @cleanup, $item, $biblio, $patron, $patron->category, $patron->library; >+ >+}; >+ >+$driver->quit(); >+ > END { > C4::Context->set_preference('SearchEngine', $SearchEngine_value); > C4::Context->set_preference('AudioAlerts', $AudioAlerts_value); >-- >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 28489
:
121539
|
121541
|
121563
|
121564
|
121565
|
121570
|
121571
|
121584
|
121585
|
121624
|
121637
|
121638
|
121639
|
121640
|
121648
|
121650
|
121651
|
121652
|
121653
|
121654
|
121831
|
121832
|
121833
|
121834
|
121835
|
121848
|
121849
|
121850
|
121851
|
121852