6 use Test::More skip_all => 'Still need to get the error-handling on here working';
7 use Test::More tests => 9;
10 use_ok( 'WWW::Mechanize' );
13 # XXX We need tests in here to verify that we're asking for gzip output
15 my $mech = WWW::Mechanize->new;
16 isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
17 $mech->agent_alias( 'Linux Mozilla' );
19 my $first_page = 'http://www.computers4sure.com/';
20 $mech->get( $first_page );
21 is( $mech->response->code, 200, "Fetched $first_page" );
22 ok( $mech->content =~ /Support/, 'Found a likely word in the first page' );
24 my @links = $mech->find_all_links( url_regex => qr{product\.asp\?productid=} );
25 cmp_ok( scalar @links, '>', 10, 'Should have lots of product links' );
27 my $link = $links[@links/2]; # Pick one in the middle
28 isa_ok( $link, 'WWW::Mechanize::Link' );
29 my $link_str = $link->url;
31 # The problem we're having is that the 2nd get, following a link,
33 $mech->get( $link_str );
34 is( $mech->response->code, 200, "Fetched $link_str" );
35 ok( $mech->content =~ /Your price/i, 'Found a likely phrase in the second page' );
36 #print $mech->content;
39 eval 'use Test::Memory::Cycle';
40 skip 'Test::Memory::Cycle not installed', 1 if $@;
42 memory_cycle_ok( $mech, 'No memory cycles found' );