Bugzilla – Attachment 158804 Details for
Bug 35008
ILS-DI should not ask for login with OpacPublic disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35008: (QA follow-up) Add selenium unit tests
Bug-35008-QA-follow-up-Add-selenium-unit-tests.patch (text/plain), 5.62 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-11-10 13:01:16 UTC
(
hide
)
Description:
Bug 35008: (QA follow-up) Add selenium unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-11-10 13:01:16 UTC
Size:
5.62 KB
patch
obsolete
>From 4a9ee658b72e5f6b98ac84a12d226a7cf220f4aa Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 10 Nov 2023 01:06:39 +0000 >Subject: [PATCH] Bug 35008: (QA follow-up) Add selenium unit tests > >This patch addds selenium tests for the ILS-DI feature. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/selenium/ilsdi.t | 120 ++++++++++++++++++++++++++++++++ > 1 file changed, 120 insertions(+) > create mode 100755 t/db_dependent/selenium/ilsdi.t > >diff --git a/t/db_dependent/selenium/ilsdi.t b/t/db_dependent/selenium/ilsdi.t >new file mode 100755 >index 00000000000..2eaeaaaa31b >--- /dev/null >+++ b/t/db_dependent/selenium/ilsdi.t >@@ -0,0 +1,120 @@ >+#!/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 XML::LibXML; >+ >+use Test::More tests => 4; >+ >+use t::lib::Selenium; >+use t::lib::TestBuilder; >+use utf8; >+ >+my $original_ILSDI_value = C4::Context->preference('ILS-DI'); >+my $original_OpacPublic_value = C4::Context->preference('OpacPublic'); >+my $builder = t::lib::TestBuilder->new; >+ >+my $login = $ENV{KOHA_USER} || 'koha'; >+ >+my @cleanup; >+ >+SKIP: { >+ eval { require Selenium::Remote::Driver; }; >+ skip "Selenium::Remote::Driver is needed for selenium tests.", 2 if $@; >+ >+ my $s = t::lib::Selenium->new; >+ my $driver = $s->driver; >+ $driver->set_window_size( 3840, 1080 ); >+ >+ subtest 'Disabled ILS-DI and enabled OPAC' => sub { >+ plan tests => 2; >+ C4::Context->set_preference( 'ILS-DI', 0 ); >+ C4::Context->set_preference( 'OpacPublic', 1 ); >+ my $ilsdi_page = $s->opac_base_url . q|ilsdi.pl?service=LookupPatron&id=abceasyas123|; >+ $driver->get($ilsdi_page); >+ my $xml_content = $driver->get_page_source; >+ my $parser = XML::LibXML->new(); >+ my $doc = $parser->parse_string($xml_content); >+ my $result = $doc->find('/LookupPatron/message'); >+ my $literal = $result->to_literal->value(); >+ is( "$literal", 'ILS-DI is disabled.', "ILS-DI is disabled" ); >+ >+ $driver->get( $s->opac_base_url . q|ilsdi.pl| ); >+ isnt( $driver->get_title(), 'Log in to your account ⺠Koha online catalog', "HTML explanation shows" ); >+ }; >+ >+ subtest 'Disabled ILS-DI and disabled OPAC' => sub { >+ plan tests => 2; >+ C4::Context->set_preference( 'ILS-DI', 0 ); >+ C4::Context->set_preference( 'OpacPublic', 0 ); >+ my $ilsdi_page = $s->opac_base_url . q|ilsdi.pl?service=LookupPatron&id=abceasyas123|; >+ $driver->get($ilsdi_page); >+ my $xml_content = $driver->get_page_source; >+ my $parser = XML::LibXML->new(); >+ my $doc = $parser->parse_string($xml_content); >+ my $result = $doc->find('/LookupPatron/message'); >+ my $literal = $result->to_literal->value(); >+ is( "$literal", 'ILS-DI is disabled.', "ILS-DI is disabled" ); >+ >+ $driver->get( $s->opac_base_url . q|ilsdi.pl| ); >+ isnt( $driver->get_title(), 'Log in to your account ⺠Koha online catalog', "HTML explanation shows" ); >+ }; >+ >+ subtest 'Enabled ILS-DI and enabled OPAC' => sub { >+ plan tests => 2; >+ C4::Context->set_preference( 'ILS-DI', 1 ); >+ C4::Context->set_preference( 'OpacPublic', 1 ); >+ my $ilsdi_page = $s->opac_base_url . q|ilsdi.pl?service=LookupPatron&id=abceasyas123|; >+ $driver->get($ilsdi_page); >+ my $xml_content = $driver->get_page_source; >+ my $parser = XML::LibXML->new(); >+ my $doc = $parser->parse_string($xml_content); >+ my $result = $doc->find('/LookupPatron/message'); >+ my $literal = $result->to_literal->value(); >+ isnt( "$literal", 'ILS-DI is disabled.', "ILS-DI is NOT disabled" ); >+ >+ $driver->get( $s->opac_base_url . q|ilsdi.pl| ); >+ isnt( $driver->get_title(), 'Log in to your account ⺠Koha online catalog', "HTML explanation shows" ); >+ }; >+ >+ subtest 'Enabled ILS-DI and disabled OPAC' => sub { >+ plan tests => 2; >+ C4::Context->set_preference( 'ILS-DI', 1 ); >+ C4::Context->set_preference( 'OpacPublic', 0 ); >+ my $ilsdi_page = $s->opac_base_url . q|ilsdi.pl?service=LookupPatron&id=abceasyas123|; >+ $driver->get($ilsdi_page); >+ my $xml_content = $driver->get_page_source; >+ my $parser = XML::LibXML->new(); >+ my $doc = $parser->parse_string($xml_content); >+ my $result = $doc->find('/LookupPatron/message'); >+ my $literal = $result->to_literal->value(); >+ isnt( "$literal", 'ILS-DI is disabled.', "ILS-DI is NOT disabled" ); >+ >+ $driver->get( $s->opac_base_url . q|ilsdi.pl| ); >+ isnt( $driver->get_title(), 'Log in to your account ⺠Koha online catalog', "HTML explanation shows" ); >+ }; >+ >+ $driver->quit(); >+} >+ >+END { >+ C4::Context->set_preference( 'ILS-DI', $original_ILSDI_value ); >+ C4::Context->set_preference( 'OpacPublic', $original_OpacPublic_value ); >+ $_->delete for @cleanup; >+} >-- >2.42.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 35008
:
156714
|
156768
|
158301
|
158780
| 158804