Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Copyright (C) 2016 Mark Tompsett |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it |
8 |
# under the terms of the GNU General Public License as published by |
9 |
# the Free Software Foundation; either version 3 of the License, or |
10 |
# (at your option) any later version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but |
13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
# GNU General Public License for more details. |
16 |
# |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
20 |
use Modern::Perl; |
21 |
|
22 |
use Test::More; |
23 |
use Test::WWW::Mechanize; |
24 |
use XML::Simple; |
25 |
|
26 |
my $koha_conf = $ENV{KOHA_CONF}; |
27 |
my $xml = XMLin($koha_conf); |
28 |
|
29 |
my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; |
30 |
my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; |
31 |
my $intranet = $ENV{KOHA_INTRANET_URL}; |
32 |
|
33 |
# test KOHA_INTRANET_URL is set |
34 |
if ( not defined $intranet ) { |
35 |
plan skip_all => |
36 |
"Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n"; |
37 |
} |
38 |
|
39 |
$intranet =~ s/\/$//xsm; |
40 |
|
41 |
test_prefs_admin_search(); |
42 |
|
43 |
done_testing(); |
44 |
|
45 |
sub test_prefs_admin_search { |
46 |
|
47 |
my $agent = Test::WWW::Mechanize->new( autocheck => 1 ); |
48 |
|
49 |
$agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", |
50 |
'connect to intranet' ); |
51 |
$agent->form_name('loginform'); |
52 |
$agent->field( 'password', $password ); |
53 |
$agent->field( 'userid', $user ); |
54 |
$agent->field( 'branch', q{} ); |
55 |
$agent->click_ok( q{}, 'login to staff client' ); |
56 |
|
57 |
$agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'load main page' ); |
58 |
|
59 |
my $base_url = "$intranet/cgi-bin/koha/admin"; |
60 |
note "Base URL: $base_url\n"; |
61 |
my @test_urls = ( |
62 |
'admin-home.pl', |
63 |
'audio_alerts.pl', |
64 |
'authtypes.pl', |
65 |
'auth_tag_structure.pl', |
66 |
'authorised_values.pl', |
67 |
'biblio_framework.pl', |
68 |
'marctagstructure.pl', |
69 |
'branch_transfer_limits.pl', |
70 |
'branches.pl', |
71 |
'checkmarc.pl', |
72 |
'classsources.pl', |
73 |
'columns_settings.pl', |
74 |
'didyoumean.pl', |
75 |
'edi_accounts.pl', |
76 |
'edi_ean_accounts.pl', |
77 |
'fieldmapping.pl', |
78 |
'item_circulation_alerts.pl', |
79 |
'items_search_fields.pl', |
80 |
'items_search_field.pl', |
81 |
'itemtypes.pl', |
82 |
'koha2marclinks.pl', |
83 |
'matching-rules.pl', |
84 |
'oai_sets.pl', |
85 |
'oai_set_mappings.pl', |
86 |
'patron-attr-types.pl', |
87 |
'smart-rules.pl', |
88 |
'transport-cost-matrix.pl', |
89 |
'sms_providers.pl', |
90 |
); |
91 |
|
92 |
foreach my $test_url (@test_urls) { |
93 |
my $current_url = $base_url . q{/} . $test_url; |
94 |
eval { |
95 |
$agent->get_ok( $current_url, 'Checking ' . $test_url ); |
96 |
$agent->content_contains('#syspref_search','Expecting #syspref_search'); |
97 |
$agent->content_contains('#circ_search','Expecting #circ_search'); |
98 |
$agent->content_contains('#catalog_search','Expecting #catalog_search'); |
99 |
$agent->content_lacks('#checkin_search','Expecting no #checkin_search'); |
100 |
$agent->content_lacks('#renew_search','Expecting no #renew_search'); |
101 |
} || fail('Checking ' . $test_url . ' failed!'); |
102 |
} |
103 |
|
104 |
return; |
105 |
} |
106 |
|
107 |
1; |