Skip to content

masaki/Brownie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Brownie - Browser integration framework inspired by Capybara

SYNOPSIS

OO-Style

use Test::More;
use Brownie::Session;

# external server
my $session = Brownie::Session->new(
    driver   => 'Mechanize',
    app_host => 'http://app.example.com:5000',
);

# PSGI app
my $session = Brownie::Session->new(
    driver => 'Mechanize',
    app    => sub { ...(PSGI app)... },
);

# PSGI file
my $session = Brownie::Session->new(
    driver => 'Mechanize',
    app    => 'app.psgi',
);

$session->visit('/');
is $session->title => 'Some Title';

$session->fill_in('User Name' => 'brownie');
$session->fill_in('Email Address' => '[email protected]');
$session->click_button('Login');
like $session->source => qr/Welcome (.+)/;

$session->fill_in(q => 'Brownie');
$session->click_link_or_button('Search');
like $session->title => qr/Search result of Brownie/i;

done_testing;

DSL-Style

use Brownie::DSL;

# external server
Brownie->driver('Mechanize');
Brownie->app_host('http://app.example.com:5000');

# PSGI app
Brownie->driver('Mechanize');
Brownie->app(sub { ...(PSGI app)... });

# psgi file
Brownie->driver('Mechanize');
Brownie->app('app.psgi');

visit('/');
is page->title, 'Some Title';

fill_in('User Name' => 'brownie');
fill_in('Email Address' => '[email protected]');
click_button('Login');
like page->source => qr/Welcome (.+)/;

fill_in(q => 'Brownie');
click_link_or_button('Search');
like page->title => qr/Search result of Brownie/i;

done_testing;

DESCRIPTION

Brownie is browser integration framework. It is inspired by Capybara (Ruby).

VOCABULARY

  • visit($url)

  • current_url

  • current_path

  • title

  • source

  • screenshot($filename)

  • click_link($locator)

  • click_button($locator)

  • click_on($locator)

  • fill_in($locator, $value)

  • choose($locator)

  • check($locator)

  • uncheck($locator)

  • select($locator)

  • unselect($locator)

  • attach_file($locator, $filename)

  • execute_script($javascript)

  • evaluate_script($javascript)

  • find($locator)

  • all($locator)

AUTHOR

NAKAGAWA Masaki <[email protected]>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Brownie::Session

Capybara

About

Browser integration framework inspired by Capybara

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages