Skip to content

Commit

Permalink
Support using a subclassed Test::WWW::Selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Closs committed Sep 9, 2011
1 parent f62c72e commit 732d91e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -38,3 +38,4 @@ Jason May <jason.a.may@gmail.com>
Stanislav Sinyagin <ssinyagin@k-open.com>
Tomohiro Hosaka <bokutin@bokut.in>
Kazuhiro Osawa <ko@yappo.ne.jp>
Luke Closs <lukec@cpan.org>
7 changes: 5 additions & 2 deletions lib/Jifty/Test/WWW/Selenium.pm
Expand Up @@ -26,7 +26,9 @@ starts selenium remote control for you, unless C<SELENIUM_RC_SERVER>
is specified when the test is run. You might also want to set
C<SELENIUM_RC_TEST_AGAINST> to your local IP address so
C<SELENIUM_RC_SERVER> can test against you. C<SELENIUM_RC_BROWSER>
tells the rc server what browser to run the tests with.
tells the rc server what browser to run the tests with. You may want
to set C<SELENIUM_CLASS> to a subclass of L<Test::WWW::Selenium> to
refactor methods common to your application.
=head2 rc_ok
Expand Down Expand Up @@ -59,13 +61,14 @@ sub rc_ok {
$args{browser_url} ||= 'http://'.($ENV{SELENIUM_RC_TEST_AGAINST} || $args{test_server} || 'localhost').':'.$server->port;

$args{browser} ||= $ENV{SELENIUM_RC_BROWSER} || $class->_get_default_browser;
$args{selenium_class} ||= $ENV{SELENIUM_CLASS} || 'Test::WWW::Selenium';

$SIG{CHLD} = \&_REAPER;

my $try = 5;
my $sel;
while ($try--) {
$sel = eval { Test::WWW::Selenium->new( %args, auto_stop => 0 ) };
$sel = eval { $args{selenium_class}->new( %args, auto_stop => 0 ) };
last if $sel;
Test::More::diag "waiting for selenium rc...";
sleep 3;
Expand Down

0 comments on commit 732d91e

Please sign in to comment.