View | Details | Raw Unified | Return to bug 19883
Collapse All | Expand All

(-)a/t/db_dependent/selenium/hit_pages.t (-1 / +564 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use C4::Context;
21
22
use Test::More;
23
use MARC::Record;
24
use MARC::Field;
25
26
my $number_of_tests;
27
plan tests => $number_of_tests;
28
29
my $dbh      = C4::Context->dbh;
30
my $login    = $ENV{KOHA_USER} || 'koha';
31
my $password = $ENV{KOHA_PASS} || 'koha';
32
my $base_url= ( $ENV{KOHA_INTRANET_URL} || C4::Context->preference("staffClientBaseURL") ) . "/cgi-bin/koha/";
33
my $selenium_addr = $ENV{SELENIUM_ADDR} || 'localhost';
34
my $selenium_port = $ENV{SELENIUM_PORT} || 4444;
35
36
# Avoid "undef error - round() overflow. Try smaller precision or use Math::BigFloat"
37
$dbh->do(q|update aqbudgets set budget_encumb=0, budget_expend=0|);
38
39
my @pages;
40
41
# root
42
BEGIN { $number_of_tests += 4 }
43
push @pages, qw(
44
about.pl
45
edithelp.pl
46
help.pl
47
mainpage.pl
48
);
49
50
# admin
51
BEGIN { $number_of_tests += 70 }
52
push @pages, qw(
53
admin/admin-home.pl
54
admin/aqbudgetperiods.pl
55
admin/aqbudgetperiods.pl?op=add_form&budget_period_id=1
56
admin/aqbudgetperiods.pl?op=delete_confirm
57
admin/aqbudgets.pl
58
admin/aqbudgets.pl?budget_period_id=1
59
admin/aqbudgets.pl?op=add_form&budget_id=1&budget_period_id=1
60
admin/aqbudgets.pl?op=delete_confirm&budget_id=1&budget_period_id=1
61
~admin/aqcontract.pl
62
admin/aqcontract.pl?op=add_form&booksellerid=1
63
~admin/aqcontract.pl?op=add_form&contractnumber=1&booksellerid=1
64
~admin/aqcontract.pl?op=delete_confirm&contractnumber=1&booksellerid=1
65
admin/aqplan.pl
66
admin/aqplan.pl?budget_period_id=1
67
admin/audio_alerts.pl
68
admin/authorised_values.pl
69
admin/authorised_values.pl?op=add_form
70
admin/authorised_values.pl?searchfield=LOST
71
admin/authorised_values.pl?op=add_form&id=1
72
admin/authorised_values.pl?op=delete&id=1
73
admin/auth_subfields_structure.pl
74
admin/auth_tag_structure.pl
75
admin/authtypes.pl
76
admin/biblio_framework.pl
77
admin/biblio_framework.pl?op=add_form
78
admin/biblio_framework.pl?op=add_form&amp;frameworkcode=FA
79
admin/biblio_framework.pl?op=delete_confirm&amp;frameworkcode=FA
80
admin/branches.pl
81
admin/branches.pl?op=add_form
82
admin/branches.pl?op=add_form&amp;branchcode=CPL
83
admin/branches.pl?op=delete_confirm&amp;branchcode=CPL
84
~admin/branches.pl?categorycode=CAT&op=add_form_category
85
~admin/branches.pl?categorycode=CAT&amp;op=delete_confirm_category
86
admin/branch_transfer_limits.pl
87
admin/categories.pl
88
admin/categories.pl?op=add_form
89
admin/categories.pl?op=add_form&categorycode=S
90
admin/categories.pl?op=delete_confirm&categorycode=S
91
admin/checkmarc.pl
92
admin/cities.pl
93
admin/cities.pl?op=add_form
94
admin/cities.pl?op=add_form&cityid=1
95
admin/cities.pl?op=delete_confirm&cityid=1
96
admin/classsources.pl
97
admin/clone-rules.pl
98
admin/columns_settings.pl
99
admin/currency.pl
100
admin/currency.pl?op=add_form
101
admin/currency.pl?op=add_form&currency_code=EUR
102
admin/currency.pl?op=delete_confirm&currency_code=EUR
103
admin/didyoumean.pl
104
admin/edi_accounts.pl
105
admin/edi_ean_accounts.pl
106
admin/fieldmapping.pl
107
admin/import_export_framework.pl
108
admin/item_circulation_alerts.pl
109
admin/items_search_field.pl
110
admin/items_search_fields.pl
111
admin/itemtypes.pl
112
admin/itemtypes.pl?op=add_form
113
admin/itemtypes.pl?op=add_form&itemtype=BK
114
admin/itemtypes.pl?op=delete_confirm&itemtype=BK
115
admin/koha2marclinks.pl
116
admin/localization.pl
117
admin/marc_subfields_structure.pl
118
admin/marctagstructure.pl
119
admin/matching-rules.pl
120
admin/oai_set_mappings.pl
121
admin/oai_sets.pl
122
admin/patron-attr-types.pl
123
admin/preferences.pl
124
admin/printers.pl
125
admin/searchengine/elasticsearch/mappings.pl
126
admin/smart-rules.pl
127
admin/sms_providers.pl
128
admin/sru_modmapping.pl
129
admin/systempreferences.pl
130
admin/transport-cost-matrix.pl
131
admin/usage_statistics.pl
132
admin/z3950servers.pl
133
admin/z3950servers.pl?op=add&type=zed
134
admin/z3950servers.pl?op=add&type=sru
135
admin/z3950servers.pl?op=edit&id=1
136
admin/z3950servers.pl?op=add&id=1
137
admin/z3950servers.pl?op=delete_confirmed&id=1
138
);
139
140
# acqui
141
BEGIN { $number_of_tests += 61 }
142
push @pages, qw(
143
acqui/acqui-home.pl
144
~acqui/addorderiso2709.pl
145
~acqui/addorderiso2709.pl?import_batch_id=1&basketno=1&booksellerid=1
146
~acqui/addorder.pl
147
acqui/add_user_search.pl
148
~acqui/basketgroup.pl
149
acqui/basketgroup.pl?booksellerid=1
150
acqui/basketgroup.pl?op=add&booksellerid=1
151
acqui/basketgroup.pl?op=add&booksellerid=1&basketgroupid=1
152
acqui/basketheader.pl
153
acqui/basketheader.pl?booksellerid=1&op=add_form
154
~acqui/basket.pl
155
acqui/basket.pl?basketno=1
156
acqui/basket.pl?op=edi_confirm&basketno=1
157
acqui/basket.pl?op=close&basketno=1&booksellerid=1
158
acqui/basket.pl?op=reopen&basketno=1
159
acqui/booksellers.pl
160
acqui/booksellers.pl?booksellerid=1
161
acqui/booksellers.pl?booksellerid=1&allbaskets=1
162
acqui/cancelorder.pl
163
~acqui/cancelorder.pl?ordernumber=1&biblionumber=1&basketno=1
164
acqui/edi_ean.pl
165
acqui/edifactmsgs.pl
166
acqui/edimsg.pl
167
~acqui/finishreceive.pl
168
acqui/histsearch.pl
169
acqui/invoice-files.pl
170
~acqui/invoice.pl
171
~acqui/invoice.pl?invoiceid=1__need_to_create_invoice
172
~acqui/invoice.pl?op=reopen&invoiceid=1__need_to_create_invoice
173
acqui/invoices.pl
174
~acqui/invoices.pl?op=do_search&invoicenumber=1__need_to_create_invoice
175
acqui/lateorders-export.pl
176
acqui/lateorders.pl
177
~acqui/modordernotes.pl
178
~acqui/modordernotes.pl?ordernumber=1__need_to_create_order
179
~acqui/modordernotes.pl?ordernumber=1&type=internal
180
~acqui/modordernotes.pl?ordernumber=1&type=vendor
181
~acqui/neworderbiblio.pl
182
~acqui/neworderempty.pl
183
acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=1
184
~acqui/newordersubscription.pl
185
acqui/newordersubscription.pl?booksellerid=1&basketno=1
186
~acqui/newordersuggestion.pl
187
acqui/newordersuggestion.pl?booksellerid=1&basketno=1
188
acqui/ordered.pl
189
acqui/orderreceive.pl
190
acqui/parcel.pl
191
acqui/parcel.pl?invoiceid=1
192
~acqui/parcels.pl
193
acqui/parcels.pl?booksellerid=1
194
acqui/spent.pl
195
~acqui/supplier.pl
196
acqui/supplier.pl?booksellerid=1
197
acqui/transferorder.pl
198
~acqui/uncertainprice.pl
199
acqui/uncertainprice.pl?booksellerid=1
200
acqui/uncertainprice.pl?booksellerid=1&owner=1
201
acqui/updatesupplier.pl
202
~acqui/z3950_search.pl
203
acqui/z3950_search.pl?booksellerid=1&basketno=1
204
);
205
206
# acqui
207
BEGIN { $number_of_tests += 12 }
208
push @pages, qw(
209
authorities/auth_finder.pl
210
authorities/auth_finder.pl?authtypecode=PERSO_NAME
211
authorities/authorities-home.pl
212
authorities/authorities-list.pl
213
authorities/authorities.pl
214
authorities/blinddetail-biblio-search.pl
215
~authorities/detail-biblio-search.pl
216
authorities/detail.pl
217
authorities/detail.pl?authid=1
218
authorities/export.pl
219
~authorities/merge_ajax.pl__no_title_but_ok
220
authorities/merge.pl
221
~authorities/ysearch.pl__no_title_but_ok
222
);
223
224
# basket
225
BEGIN { $number_of_tests += 7 }
226
push @pages, qw(
227
basket/basket.pl
228
basket/downloadcart.pl
229
basket/downloadcart.pl?format=iso2709&bib_list=1
230
basket/downloadcart.pl?format=ris&bib_list=1
231
basket/downloadcart.pl?format=bibtex&bib_list=1
232
basket/downloadcart.pl?format=1&bib_list=1
233
basket/sendbasket.pl
234
);
235
236
# catalogue
237
BEGIN { $number_of_tests += 25 }
238
push @pages, qw(
239
catalogue/detail.pl
240
catalogue/detail.pl?biblionumber=1
241
catalogue/export.pl
242
~catalogue/getitem-ajax.pl__no_title_but_ok
243
~catalogue/getitem-ajax.pl?itemnumber=1__no_title_but_ok
244
catalogue/image.pl?imagenumber=1
245
catalogue/image.pl?imagenumber=1&thumbnail=1
246
catalogue/imageviewer.pl
247
catalogue/imageviewer.pl?biblionumber=1&imagenumber=1
248
catalogue/ISBDdetail.pl
249
catalogue/ISBDdetail.pl?biblionumber=1
250
~catalogue/issuehistory.pl
251
catalogue/issuehistory.pl?biblionumber=1
252
catalogue/itemsearch.pl
253
catalogue/labeledMARCdetail.pl
254
catalogue/labeledMARCdetail.pl?biblionumber=1
255
catalogue/MARCdetail.pl
256
catalogue/MARCdetail.pl?biblionumber=1
257
~catalogue/moredetail.pl
258
catalogue/moredetail.pl?biblionumber=1
259
catalogue/moredetail.pl?biblionumber=1&itemnumber=1
260
catalogue/search-history.pl
261
catalogue/search.pl
262
catalogue/search.pl?type=intranet&op=do_search&q=an=1
263
catalogue/search.pl?q=d
264
catalogue/showmarc.pl
265
catalogue/showmarc.pl?id=1
266
catalogue/showmarc.pl?id=1&viewas=html
267
catalogue/showmarc.pl?id=1&viewas=card
268
~catalogue/updateitem.pl
269
);
270
271
# cataloguing
272
BEGIN { $number_of_tests += 17 }
273
push @pages, qw(
274
cataloguing/addbiblio.pl
275
cataloguing/addbiblio.pl?biblionumber=1
276
cataloguing/addbiblio.pl?frameworkcode=FA
277
cataloguing/addbiblio.pl?mode=popup
278
cataloguing/addbooks.pl
279
~cataloguing/additem.pl
280
cataloguing/additem.pl?biblionumber=1
281
cataloguing/additem.pl?op=edititem&biblionumber=1&itemnumber=1
282
cataloguing/editor.pl
283
~cataloguing/linkitem.pl
284
~cataloguing/merge_ajax.pl__no_title_but_ok
285
cataloguing/merge.pl
286
cataloguing/merge.pl?biblionumber=1&biblionumber=2
287
cataloguing/moveitem.pl?biblionumber=1
288
cataloguing/plugin_launcher.pl
289
cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl
290
~cataloguing/ysearch.pl__this_die
291
~cataloguing/ysearch.pl?table=biblioitems&field=publishercode__no_title_but_ok
292
cataloguing/z3950_auth_search.pl
293
cataloguing/z3950_auth_search.pl?authid=1
294
cataloguing/z3950_search.pl
295
cataloguing/z3950_search.pl?biblionumber=1
296
);
297
298
# circ
299
BEGIN { $number_of_tests += 27 }
300
push @pages, qw(
301
circ/add_message.pl
302
~circ/article-request-slip.pl
303
~circ/article-request-slip.pl?id=1__need_to_create_AR
304
circ/article-requests.pl
305
circ/bookcount.pl
306
circ/bookcount.pl?biblionumber=1&bi=1&itm=1
307
circ/branchoverdues.pl
308
circ/branchtransfers.pl
309
circ/circulation-home.pl
310
circ/circulation.pl
311
circ/circulation.pl?borrowernumber=1
312
circ/circulation.pl?findborrower=42
313
circ/del_message.pl
314
circ/del_message.pl??message_id=1&borrowernumber=1
315
~circ/hold-transfer-slip.pl__timeout
316
circ/offline.pl
317
circ/on-site_checkouts.pl
318
circ/overdue.pl
319
circ/pendingreserves.pl
320
circ/renew.pl
321
circ/request-article.pl
322
circ/request-article.pl?biblionumber=1
323
circ/reserveratios.pl
324
circ/returns.pl
325
circ/returns.pl?itemnumber=1
326
circ/returns.pl?itemnumber=1&canceltransfer=1
327
circ/selectbranchprinter.pl
328
~circ/transfer-slip.pl__timeout
329
circ/transferstoreceive.pl
330
circ/view_holdsqueue.pl
331
circ/waitingreserves.pl
332
~circ/ypattrodue-attr-search-authvalue.pl__no_title_but_ok
333
~circ/ysearch.pl__no_title_but_ok
334
);
335
336
# clubs
337
BEGIN { $number_of_tests += 4 }
338
push @pages, qw(
339
clubs/club-enrollments.pl
340
clubs/club-enrollments.pl?id=1
341
~clubs/clubs-add-modify.pl
342
clubs/clubs-add-modify.pl?club_template_id=1
343
clubs/clubs.pl
344
~clubs/patron-clubs-tab.pl
345
~clubs/patron-clubs-tab.pl?borrowernumber=1
346
~clubs/patron-clubs-tab.pl?borrowernumber=1&id=1
347
~clubs/patron-enroll.pl
348
~clubs/patron-enroll.pl??borrowernumber=1&id=1
349
~clubs/templates-add-modify.pl&id=1
350
);
351
352
# course_reserves
353
BEGIN { $number_of_tests += 10 }
354
push @pages, qw(
355
course_reserves/add_items.pl
356
course_reserves/add_items.pl?course_id=1
357
course_reserves/course-details.pl
358
course_reserves/course-details.pl?course_id=1
359
course_reserves/course.pl
360
course_reserves/course.pl?course_id=1
361
course_reserves/course-reserves.pl
362
course_reserves/mod_course.pl
363
course_reserves/mod_course.pl?course_id=1
364
course_reserves/mod_course.pl?course_id=1&action=del
365
);
366
367
# ill TODO
368
BEGIN { $number_of_tests += 0 }
369
push @pages, qw(
370
);
371
372
# installer TODO
373
BEGIN { $number_of_tests += 0 }
374
push @pages, qw(
375
);
376
377
# labels TODO
378
BEGIN { $number_of_tests += 0 }
379
push @pages, qw(
380
);
381
382
# members
383
BEGIN { $number_of_tests += 57 }
384
push @pages, qw(
385
members/boraccount.pl
386
members/boraccount.pl?borrowernumber=1
387
~members/default_messageprefs.pl__no_title_but_ok
388
~members/default_messageprefs.pl?categorycode=CAT__no_title_but_ok
389
members/deletemem.pl
390
members/deletemem.pl?member=1
391
members/discharge.pl
392
members/discharge.pl?borrowernumber=1
393
members/discharges.pl
394
members/discharges.pl?op=allow&borrowernumber=1
395
members/files.pl
396
members/files.pl?borrowernumber=1
397
members/guarantor_search.pl
398
members/holdshistory.pl
399
members/holdshistory.pl?borrowernumber=1
400
~members/housebound.pl
401
members/housebound.pl?borrowernumber=1
402
members/mancredit.pl
403
members/mancredit.pl?borrowernumber=1
404
members/maninvoice.pl
405
members/maninvoice.pl?borrowernumber=1
406
members/memberentry.pl
407
members/memberentry.pl?op=modify&destination=circ&borrowernumber=1
408
members/member-flags.pl
409
members/member-flags.pl?member=1
410
members/member-password.pl
411
members/member-password.pl?member=1
412
members/member.pl
413
members/members-home.pl
414
members/members-update-do.pl
415
members/members-update.pl
416
members/mod_debarment.pl
417
members/mod_debarment.pl?borrowernumber=1&borrower_debarment_id=1&action=del
418
members/moremember.pl
419
members/moremember.pl?borrowernumber=1
420
members/nl-search.pl
421
members/notices.pl
422
members/notices.pl?borrowernumber=1
423
members/patronimage.pl
424
members/patronimage.pl?borrowernumber=1
425
members/paycollect.pl
426
members/paycollect.pl?borrowernumber=1
427
members/pay.pl
428
members/pay.pl?borrowernumber=1
429
members/printfeercpt.pl
430
~members/printfeercpt.pl?action=print&accountlines_id=1&borrowernumber=1__timeout
431
members/printinvoice.pl
432
~members/printinvoice.pl?action=print&accountlines_id=1&borrowernumber=1__timeout
433
~members/print_overdues.pl__timeout__but_should_not
434
~members/print_overdues.pl?borrowernumber=1__timeout
435
~members/printslip.pl
436
members/purchase-suggestions.pl
437
members/purchase-suggestions.pl?borrowernumber=1
438
members/readingrec.pl
439
members/readingrec.pl?borrowernumber=1
440
members/readingrec.pl?borrowernumber=1&op=export_barcodes
441
members/routing-lists.pl
442
members/routing-lists.pl?borrowernumber=1
443
members/setstatus.pl
444
members/setstatus.pl?borrowernumber=1&destination=circ&reregistration=y
445
members/statistics.pl
446
members/statistics.pl?borrowernumber=1
447
members/summary-print.pl
448
members/update-child.pl
449
);
450
451
# opac TODO
452
BEGIN { $number_of_tests += 0 }
453
push @pages, qw(
454
);
455
456
# patroncards TODO
457
BEGIN { $number_of_tests += 0 }
458
push @pages, qw(
459
);
460
461
# patron_lists TODO
462
BEGIN { $number_of_tests += 0 }
463
push @pages, qw(
464
);
465
466
# plugins TODO
467
BEGIN { $number_of_tests += 0 }
468
push @pages, qw(
469
);
470
471
# reports TODO
472
BEGIN { $number_of_tests += 0 }
473
push @pages, qw(
474
);
475
476
# reserves TODO
477
BEGIN { $number_of_tests += 0 }
478
push @pages, qw(
479
);
480
481
# reviews TODO
482
BEGIN { $number_of_tests += 0 }
483
push @pages, qw(
484
);
485
486
# serials TODO
487
BEGIN { $number_of_tests += 0 }
488
push @pages, qw(
489
);
490
491
# services TODO
492
BEGIN { $number_of_tests += 0 }
493
push @pages, qw(
494
);
495
496
# suggestions TODO
497
BEGIN { $number_of_tests += 0 }
498
push @pages, qw(
499
);
500
501
# svc TODO
502
BEGIN { $number_of_tests += 0 }
503
push @pages, qw(
504
);
505
506
# tags TODO
507
BEGIN { $number_of_tests += 0 }
508
push @pages, qw(
509
);
510
511
# tools TODO
512
BEGIN { $number_of_tests += 0 }
513
push @pages, qw(
514
);
515
516
# virtualshelves TODO
517
BEGIN { $number_of_tests += 0 }
518
push @pages, qw(
519
);
520
521
522
SKIP: {
523
    eval { require Selenium::Remote::Driver; };
524
    skip "Selenium::Remote::Driver is needed for selenium tests.", $number_of_tests if $@;
525
526
    my $driver = Selenium::Remote::Driver->new(
527
        port               => $selenium_port,
528
        remote_server_addr => $selenium_addr,
529
    );
530
531
    BEGIN { $number_of_tests += 1 }
532
    $driver->get($base_url."mainpage.pl");
533
    like( $driver->get_title(), qr(Log in to Koha), );
534
    auth( $driver, $login, $password );
535
536
    for my $page ( @pages ) {
537
        next if $page =~ m|^~|;
538
        $driver->get("$base_url/$page");
539
        my $title = $driver->get_title;
540
        ok( $title, "$page should have a title (maybe a 500 is raised)" );
541
    }
542
543
    $driver->quit();
544
};
545
546
sub auth {
547
    my ( $driver, $login, $password) = @_;
548
    fill_form( $driver, { userid => $login, password => $password } );
549
    my $login_button = $driver->find_element('//input[@id="submit"]');
550
    $login_button->submit();
551
}
552
553
sub fill_form {
554
    my ( $driver, $values ) = @_;
555
    while ( my ( $id, $value ) = each %$values ) {
556
        my $element = $driver->find_element('//*[@id="'.$id.'"]');
557
        my $tag = $element->get_tag_name();
558
        if ( $tag eq 'input' ) {
559
            $driver->find_element('//input[@id="'.$id.'"]')->send_keys($value);
560
        } elsif ( $tag eq 'select' ) {
561
            $driver->find_element('//select[@id="'.$id.'"]/option[@value="'.$value.'"]')->click;
562
        }
563
    }
564
}

Return to bug 19883