Mozilla-Mechanize

 view release on metacpan or  search on metacpan

t/tick.t  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use warnings;

use URI::file;

use Test::More;
plan tests => 8;

use_ok( 'Mozilla::Mechanize' );

my $uri = URI::file->new_abs( "t/html/tick.html" )->as_string;

isa_ok my $moz = Mozilla::Mechanize->new(visible => 0), "Mozilla::Mechanize";

$moz->get( $uri );

SKIP: {
    skip "->success doesn't work yet", 1;
    ok $moz->success, "->success";
}

ok my $prev_uri = $moz->uri, "Got an uri back";

my $form = $moz->form_number(1);
isa_ok( $form, 'Mozilla::Mechanize::Form' );

$moz->tick("foo","hello");
$moz->tick("foo","bye");
$moz->untick("foo","hello");

$moz->click( 'submit' ); $moz->_wait_while_busy;

like $moz->uri, qr/[&?]foo=bye\b/, "(un)tick actions [foo=bye]";
like $moz->uri, qr/[&?]submit=Submit\b/, "(un)tick actions [submit=Submit]";
unlike $moz->uri, qr/[&?]foo=hello\b/, "(un)tick actions ![foo=hello]";

$moz->close();



( run in 1.498 second using v1.01-cache-2.11-cpan-302cb4679cc )