=head1 DESCRIPTION

By inheriting from L<Test::WWW::Mechanize>, this module provides two
key benefits over using L<Maypole::CLI> in test scripts. First, it
inherits a plethora of methods for testing web content. Second,
cookies are handled transparently, allowing you to test applications
that use cookie-based sessions and authentication.

=head1 SYNOPSIS

    use Test::WWW::Mechanize::Maypole 'BeerDB';
    
    $ENV{MAYPOLE_TEMPLATES} = 'path/to/templates';
    
    my $mech = Test::WWW::Mechanize::Maypole->new;
    
    #
    # basic tests:
    #
    $mech->get_ok( "http://localhost/beerdb/"; );
    
    is( $mech->ct, "text/html" );
    
    $mech->content_contains( 'This is the frontpage' );
    
    #
    # logging in and storing cookies:
    #
    $mech->get_ok("http://localhost/beerdb/customer/buybeer";);
    $mech->content_contains( 'Login to BeerDB', 'got login page' );

    # specify which form we're interested in
    $mech->form_number(1); # the 1st form    
    
    # fill in credentials
    $mech->field( 'username' => 'landlord' );
    $mech->field( 'password' => 'handpump' );
    
    # get a HTTP::Response back
    my $response = $mech->click_button( name => 'submit' );
    like( $response->content, qr/Shop for beer/, 'got customer/buybeer page' );
    
    # check our cookies give access to other pages
    $mech->get_ok( "http://localhost/beerdb/customer/edit"; );
    $mech->content_contains( 'Update your details', "got customer
account edit page");

        
    # ... see Test::WWW::Mechanize for many more test methods
    
d.


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to