5 |
|
|
6 |
use Test::More tests => 4; |
use Test::More tests => 4; |
7 |
use Test::WWW::Mechanize; |
use Test::WWW::Mechanize; |
|
use File::Slurp; |
|
8 |
|
|
9 |
our $config; |
our $config; |
10 |
require 't/config.pl'; |
require 't/config.pl'; |
14 |
my $mech = Test::WWW::Mechanize->new; |
my $mech = Test::WWW::Mechanize->new; |
15 |
|
|
16 |
my $save_count = 1; |
my $save_count = 1; |
17 |
sub save { write_file "/tmp/login-$save_count.html", @_; $save_count++; } |
sub save { |
18 |
|
my $path = '/tmp/login-' . $save_count++ . '.html'; |
19 |
|
open(my $fh, '>', $path); |
20 |
|
print $fh @_; |
21 |
|
warn "# save $path ", -s $path, " bytes\n"; |
22 |
|
} |
23 |
|
|
24 |
$mech->get_ok( 'https://localhost', 'opac' ); |
my $opac_url = $ENV{OPAC_URL} || 'http://ffzg.koha-dev.rot13.org'; |
25 |
|
|
26 |
|
$mech->get_ok( $opac_url, "opac $opac_url" ); |
27 |
save $mech->content; |
save $mech->content; |
28 |
|
|
29 |
$mech->follow_link_ok({ text_regex => qr/Log in to Your Account/i }, 'login form' ); |
$mech->follow_link_ok({ url_regex => qr/opac-user/i }, 'login form' ); |
30 |
save $mech->content; |
save $mech->content; |
31 |
|
|
32 |
$mech->submit_form_ok({ |
$mech->submit_form_ok({ |