Skip to content

Commit

Permalink
Changes to the POD.
Browse files Browse the repository at this point in the history
  • Loading branch information
kablamo committed Apr 29, 2012
1 parent 2240235 commit 31e0297
Showing 1 changed file with 82 additions and 86 deletions.
168 changes: 82 additions & 86 deletions lib/Test/WWW/Selenium/More.pm
Expand Up @@ -5,89 +5,41 @@ use Moose;
use Test::WWW::Selenium; use Test::WWW::Selenium;
use namespace::autoclean; use namespace::autoclean;


# ABSTRACT: More useful tools for Selenium testing # VERSION


=head1 SYNOPSIS =attr host
use Test::WWW::Selenium::More;
Test::WWW::Selenium::More->new
->note('this is a test. this is only a test.')
->open_ok("/")
->is_text_present_ok("Welcome to the internet")
->download_file_ok('link=Download my file');
=head1 DESCRIPTION
This library also provides method chaining and extra convenience methods.
This library extends L<Test::WWW::Selenium>. Please see that module's The hostname or ip address of the Selenium server. Defaults to 'localhost'.
documentation as well.
=attr port
=head1 RUNNING TESTS The port of the Selenium server. Defaults to '4444'.
See the RUNNING TESTS section of L<Test::WWW::Selenium::More::Manual>. =attr browser
The browser to run tests against on the Selenium server. Defaults to
'*chrome'.
=head1 ENVIRONMENT VARIABLES =attr browser_url
The following is a list of environment variables that affect the behavior of The Selenium server runs tests against this website.
this library. There are corresponding attributes for each (see the ATTRIBUTES
section).
=head2 SELENIUM_HOST =attr autostop
=head2 SELENIUM_PORT When $selenium goes out of scope the browser will be automatically shut down if
this attribute is set to true. Otherwise stop() must be called explicitly.
Defaults to 1.
=head2 SELENIUM_BROWSER =attr slow
=head2 SELENIUM_BROWSER_URL
=head2 SELENIUM_TIMEOUT
=head2 SELENIUM_AUTOSTOP
=head2 SELENIUM_SLOW
=head1 ATTRIBUTES
=head2 host
The hostname or ip address of the Selenium RC server
=head2 port
The port of the Selenium RC server
=head2 browser
The browser to run tests against on the Selenium RC server
=head2 browser_url
The website to run tests against on the Selenium RC server
=head2 autostop
If true, when $selenium goes out of scope, the browser will be automatically
closed. Otherwise you will need to call stop() explicitly to close the
browser.
=head2 slow
The number of seconds to sleep after each call to any Test::WWW::Selenium The number of seconds to sleep after each call to any Test::WWW::Selenium
method. This is useful for slowing down tests if you are watching them run in method. This is useful for slowing down tests if you are watching them run in
a browser. a browser. Defaults to 0.
Defaults to 0.
=head2 stash =attr stash
A HashRef of saved values. This behaves similar to the Catalyst stash. A HashRef of saved values. This behaves similar to the Catalyst stash.
=cut =cut


has host => ( is => 'rw', isa => 'Str', builder => '_host' ); has host => ( is => 'rw', isa => 'Str', builder => '_host' );
Expand Down Expand Up @@ -193,11 +145,7 @@ around wait_for_page_to_load => sub {


__PACKAGE__->meta->make_immutable; __PACKAGE__->meta->make_immutable;


=head1 FUNCTIONS =method load_data( $file )
=cut

=head2 load_data( $file )
Returns a data structure from $file. $file must have valid Perl syntax. Returns a data structure from $file. $file must have valid Perl syntax.
Expand Down Expand Up @@ -238,7 +186,7 @@ sub _wait_with_message {
return $self; return $self;
} }


=head2 follow_link_ok( $locator, $test_description ) =method follow_link_ok( $locator, $test_description )
Returns $self. Returns $self.
Expand All @@ -263,7 +211,7 @@ sub follow_link_ok {
return $self; return $self;
} }


=head2 fill_form_ok( $form ) =method fill_form_ok( $form )
Returns $self. Returns $self.
Expand Down Expand Up @@ -300,7 +248,7 @@ sub fill_form_ok {
return $self; return $self;
} }


=head2 submit_form_ok( $form ) =method submit_form_ok( $form )
Returns $self. Returns $self.
Expand Down Expand Up @@ -340,7 +288,7 @@ sub submit_form_ok {
return $self; return $self;
} }


=head2 wait_for_jquery_ok() =method wait_for_jquery_ok()
Returns $self. Returns $self.
Expand All @@ -360,7 +308,7 @@ sub wait_for_jquery_ok {
return $self; return $self;
} }


=head2 jquery_select_ok($locator, $menu_option) =method jquery_select_ok($locator, $menu_option)
Returns $self. Returns $self.
Expand All @@ -375,7 +323,7 @@ sub jquery_select_ok {
return $self; return $self;
} }


=head2 select_and_page_load_ok($locator, $menu_option) =method select_and_page_load_ok($locator, $menu_option)
Returns $self. Returns $self.
Expand All @@ -391,7 +339,7 @@ sub select_and_page_load_ok {
return $self; return $self;
} }


=head2 jquery_click_ok($locator, $menu_option) =method jquery_click_ok($locator, $menu_option)
Returns $self. Returns $self.
Expand All @@ -406,7 +354,7 @@ sub jquery_click_ok {
return $self; return $self;
} }


=head2 stash_text( $locator => $key ) =method stash_text( $locator => $key )
Returns $self. Returns $self.
Expand All @@ -423,7 +371,7 @@ sub stash_text {
return $self; return $self;
} }


=head2 stash_location( $key ) =method stash_location( $key )
Returns $self. Returns $self.
Expand All @@ -438,7 +386,7 @@ sub stash_location {
return $self; return $self;
} }


=head2 from_stash( $key ) =method from_stash( $key )
Returns a value from the stash. Returns a value from the stash.
Expand All @@ -450,7 +398,7 @@ sub from_stash {
return $self->_stash->{$key}; return $self->_stash->{$key};
} }


=head2 stash( $value => $key ) =method stash( $value => $key )
Returns $self. Returns $self.
Expand All @@ -466,7 +414,7 @@ sub stash {
return $self; return $self;
} }


=head2 note( $msg ) =method note( $msg )
Returns $self. Returns $self.
Expand All @@ -480,7 +428,7 @@ sub note {
return $self; return $self;
} }


=head2 is_text_not_present_ok( $text ) =method is_text_not_present_ok( $text )
Returns $self. Returns $self.
Expand All @@ -495,7 +443,7 @@ sub is_text_not_present_ok {
return $self; return $self;
} }


=head2 note_line( $msg ) =method note_line( $msg )
Outputs an underlined message, useful for dividing up test output. If no Outputs an underlined message, useful for dividing up test output. If no
message specified, then just prints the separator line. message specified, then just prints the separator line.
Expand All @@ -513,7 +461,7 @@ sub note_line {
return $self; return $self;
} }


=head2 download_file_ok($locator) =method download_file_ok($locator)
Parses the href attribute from a link on the current page. Downloads that url Parses the href attribute from a link on the current page. Downloads that url
via javascript's XMLHttpRequest. Checks that response status is 200. via javascript's XMLHttpRequest. Checks that response status is 200.
Expand Down Expand Up @@ -555,7 +503,7 @@ sub download_file_ok {
return $self; return $self;
} }


=head2 change_speed($seconds) =method change_speed($seconds)
This just updates the slow() attribute. The only difference is that it This just updates the slow() attribute. The only difference is that it
returns $self so that you can do method chaining. returns $self so that you can do method chaining.
Expand All @@ -571,6 +519,54 @@ sub change_speed {


1; 1;


# ABSTRACT: More tools for Selenium testing

=head1 SYNOPSIS
use Test::WWW::Selenium::More;
Test::WWW::Selenium::More->new()
->note('this is a test. this is only a test.')
->open_ok("/")
->is_text_present_ok("Welcome to the internet")
->download_file_ok('link=Download my file');
=head1 DESCRIPTION
If you are new to this module or Selenium testing in general, see the
L<Test::WWW::Selenium::More::Manual>.
This module provides method chaining and some useful tools for Selenium
testing.
This library extends L<Test::WWW::Selenium>. Please see that module's
documentation as well.
=head1 ENVIRONMENT VARIABLES
The following is a list of environment variables that affect the behavior of
this library. Each corresponds to an attribute (see the ATTRIBUTES
section).
=head2 SELENIUM_HOST
=head2 SELENIUM_PORT
=head2 SELENIUM_BROWSER
=head2 SELENIUM_BROWSER_URL
=head2 SELENIUM_TIMEOUT
=head2 SELENIUM_AUTOSTOP
=head2 SELENIUM_SLOW
=cut


# I used this command to get the list of functions in WWW::Selenium: # I used this command to get the list of functions in WWW::Selenium:
# grep '=item $sel-' /usr/local/lib/perl/5.10.0/WWW/Selenium.pm # grep '=item $sel-' /usr/local/lib/perl/5.10.0/WWW/Selenium.pm
# Then I used vim to get rid of the extra stuff. Then I used vim to add the # Then I used vim to get rid of the extra stuff. Then I used vim to add the
Expand Down

0 comments on commit 31e0297

Please sign in to comment.