4 use Test::More qw/no_plan/;
6 use HTTP::Request::Common;
11 my $cookie_jar = HTTP::Cookies->new;
12 my $agent = WWW::Mechanize->new();
14 # give the agent a place to stash the cookies
15 $agent->cookie_jar($cookie_jar);
21 my $url = $RT::WebURL;
22 diag "Base URL is '$url'" if $ENV{TEST_VERBOSE};
25 is ($agent->{'status'}, 200, "Loaded a page");
29 # follow the link marked "Login"
31 ok($agent->{form}->find_input('user'));
33 ok($agent->{form}->find_input('pass'));
34 ok ($agent->{'content'} =~ /username:/i);
35 $agent->field( 'user' => 'root' );
36 $agent->field( 'pass' => 'password' );
37 # the field isn't named, so we have to click link 0
39 is($agent->{'status'}, 200, "Fetched the page ok");
40 ok( $agent->{'content'} =~ /Logout/i, "Found a logout link");
44 find ( \&wanted , 'html/');
47 -f && /\.html$/ && $_ !~ /Logout.html$/ && test_get($File::Find::name);
54 diag( "testing $url/$file" ) if $ENV{TEST_VERBOSE};
55 ok ($agent->get("$url/$file", "GET $url/$file"));
56 is ($agent->{'status'}, 200, "Loaded $file");
57 # ok( $agent->{'content'} =~ /Logout/i, "Found a logout link on $file ");
58 ok( $agent->{'content'} !~ /Not logged in/i, "Still logged in for $file");
59 ok( $agent->{'content'} !~ /raw error/i, "Didn't get a Mason compilation error on $file");