3 |
use warnings; |
use warnings; |
4 |
use strict; |
use strict; |
5 |
|
|
6 |
use Test::More tests => 3; |
use Test::More tests => 4; |
7 |
use Test::WWW::Mechanize; |
use Test::WWW::Mechanize; |
8 |
use File::Slurp; |
use File::Slurp; |
9 |
|
|
15 |
my $mech = Test::WWW::Mechanize->new; |
my $mech = Test::WWW::Mechanize->new; |
16 |
|
|
17 |
my $save_count = 1; |
my $save_count = 1; |
18 |
sub save { write_file "/tmp/login-$save_count.html", @_; $save_count++; } |
sub save { |
19 |
|
my $path = '/tmp/login-' . $save_count++ . '.html'; |
20 |
|
write_file $path, @_; |
21 |
|
warn "# save $path ", -s $path, " bytes\n"; |
22 |
|
} |
23 |
|
|
24 |
|
|
25 |
$mech->get_ok( 'https://localhost', 'opac' ); |
$mech->get_ok( 'https://localhost', 'opac' ); |
37 |
}, 'login'); |
}, 'login'); |
38 |
save $mech->content; |
save $mech->content; |
39 |
|
|
40 |
|
$mech->follow_link_ok({ url_regex => qr/logout/ }, 'logout' ); |