Test-WWW-Mechanize
view release on metacpan or search on metacpan
The methods that look at the text of the page, ->text_like() and
->text_unlike(), now use the WWW::Mechanize method ->text() which caches
the text. This will be a big speedup if you call these methods more
than once.
[FIXED]
Normalized the use of single vs. double quotes in the default descriptions.
Fixed tests that fail under newer versions of LWP.
Fixed tests that fail if http_proxy or HTTP_PROXY are set.
Fixed tests that fail on Perl 5.14.
1.30 Wed Jun 9 12:23:48 CDT 2010
------------------------------------
[ENHANCEMENTS]
autolint used to only work on get_ok() calls. Now it works with
post_ok(), submit_form_ok(), follow_link_ok() and click_ok().
t/click_ok.t view on Meta::CPAN
use Test::WWW::Mechanize ();
use lib 't';
use TestServer;
my $server = TestServer->new;
my $pid = $server->background;
my $server_root = $server->root;
SUBMIT_GOOD_FORM: {
local @ENV{qw( http_proxy HTTP_PROXY )};
my $mech = Test::WWW::Mechanize->new();
isa_ok( $mech,'Test::WWW::Mechanize' );
$mech->get_ok( "$server_root/form.html" );
$mech->click_ok( 'big_button', 'Submit First Form' );
# XXX We need to check that the request is correct.
}
SUBMIT_GOOD_FORM_WITH_COORDINATES: {
local @ENV{qw( http_proxy HTTP_PROXY )};
my $mech = Test::WWW::Mechanize->new();
isa_ok( $mech,'Test::WWW::Mechanize' );
$mech->get_ok( "$server_root/form.html" );
$mech->click_ok( ['big_button',360,80], 'Submit First Form with coordinates' );
# XXX We need to check that the request is correct.
}
$server->stop;
t/delete_ok.t view on Meta::CPAN
use Test::WWW::Mechanize ();
use lib 't';
use TestServer;
my $server = TestServer->new;
my $pid = $server->background;
my $server_root = $server->root;
GOOD_DELETE: {
local @ENV{qw( http_proxy HTTP_PROXY )};
my $mech = Test::WWW::Mechanize->new( autocheck => 0 );
isa_ok($mech,'Test::WWW::Mechanize');
my $scratch = "$server_root/scratch.html";
$mech->delete_ok($scratch);
ok($mech->success, 'sanity check: we can load scratch.html');
test_out('ok 1 - Try to DELETE scratch.html');
t/headers.t view on Meta::CPAN
use lib 't';
use TestServer;
my $server = TestServer->new;
my $pid = $server->background;
my $server_root = $server->root;
use Test::WWW::Mechanize ();
my $mech = do {
local @ENV{qw( http_proxy HTTP_PROXY )};
Test::WWW::Mechanize->new( autocheck => 0 );
};
isa_ok($mech,'Test::WWW::Mechanize');
$mech->get_ok( "$server_root/form.html" );
GOOD_EXISTS: {
test_out( 'ok 1 - Has Content-Type' );
my $ok = $mech->header_exists_ok('Content-Type', 'Has Content-Type');
test_test( 'Gets existing header and reports success' );
is( ref($ok), '', 'get_ok() should only return a scalar' );
use lib 't';
use TestServer;
my $server = TestServer->new;
my $pid = $server->background;
my $server_root = $server->root;
my $text = 'This is what we are putting';
GOOD_PUT: {
local @ENV{qw( http_proxy HTTP_PROXY )};
my $mech = Test::WWW::Mechanize->new( autocheck => 0 );
isa_ok($mech,'Test::WWW::Mechanize');
my $scratch = "$server_root/scratch.html";
$mech->put_ok($scratch, {content => $text});
ok($mech->success, 'sanity check: we can load scratch.html');
test_out('ok 1 - Try to PUT scratch.html');
t/submit_form_ok.t view on Meta::CPAN
use Test::WWW::Mechanize ();
use lib 't';
use TestServer;
my $server = TestServer->new;
my $pid = $server->background;
my $server_root = $server->root;
SUBMIT_GOOD_FORM: {
local @ENV{qw( http_proxy HTTP_PROXY )};
my $mech = Test::WWW::Mechanize->new();
isa_ok( $mech,'Test::WWW::Mechanize' );
$mech->get_ok( "$server_root/form.html" );
$mech->submit_form_ok( {form_number =>1}, 'Submit First Form' );
}
$server->stop;
( run in 0.481 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )