6 use Test::More tests => 13;
10 delete @ENV{ grep { lc eq 'http_proxy' } keys %ENV };
11 delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
12 use_ok( 'WWW::Mechanize' );
15 my $server = LocalServer->spawn;
16 isa_ok( $server, 'LocalServer' );
18 my $mech = WWW::Mechanize->new();
19 isa_ok( $mech, 'WWW::Mechanize', 'Created the object' ) or die;
21 my $response = $mech->get( $server->url );
22 isa_ok( $response, 'HTTP::Response', 'Got back a response' ) or die;
23 is( $mech->uri, $server->url, "Got the correct page" );
24 ok( $response->is_success, 'Got local page' ) or die 'cannot even fetch local page';
25 ok( $mech->is_html, 'is HTML' );
27 is( $mech->value('upload'), '', 'Hopefully no upload happens');
29 $mech->field(query => 'foo'); # Filled the 'q' field
31 $response = $mech->submit;
32 isa_ok( $response, 'HTTP::Response', 'Got back a response' );
33 ok( $response->is_success, 'Can click "submit" ("submit" button)');
35 like($mech->content, qr/\bfoo\b/i, 'Found "Foo"');
37 is( $mech->value('upload'), '', 'No upload happens' );
40 eval 'use Test::Memory::Cycle';
41 skip 'Test::Memory::Cycle not installed', 1 if $@;
43 memory_cycle_ok( $mech, 'Mech: no cycles' );