my $app; # app name (MyApp)
my $sel_pid; # pid of selenium server
my $app_pid; # pid of myapp server
+my $www_selenium;
=head1 NAME
=cut
-our $VERSION = '0.00_01';
+our $VERSION = '0.02';
-=head1 DEVELOPER RELEASE
+=head1 DEVELOPERISH RELEASE
-This is a developer release. It's working for me in production, but
+This is still a test release. It's working for me in production, but
it depends on a Java application (SeleniumRC), which can be
unreliable. On my Debian system, I had to put C<firefox-bin> in my
path, and add C</usr/lib/firefox> to C<LD_LIBRARY_PATH>. Every distro
Please report any problems to RT, the Catalyst mailing list, or the
#catalyst IRC channel on L<irc.perl.org>. Thanks!
-=head2 KNOWN ISSUES
-
-Sometimes the Selenium server doesn't die after the tests when running
-under C<make test>. C<prove> works fine, so until I (or you!) figure
-out the problem, use C<prove>.
-
=head1 SYNOPSIS
use Test::WWW::Selenium::Catalyst 'MyApp';
This module starts the SeleniumRC server and your Catalyst app so that
you can test it with SeleniumRC. Once you've called
-C<Test::WWW::Selenium::Catalyst->start>, everything is just like
+C<< Test::WWW::Selenium::Catalyst->start >>, everything is just like
L<Test::WWW::Selenium|Test::WWW:Selenium>.
-=head1 FUNCTIONS
+=head1 METHODS
=head2 start
my $pid;
if(0 == ($pid = fork())){
local $SIG{TERM} = sub {
- diag("Selenium server $$ going down (TERM)");
+ diag("Selenium server $$ going down (TERM)") if $DEBUG;
exit 0;
};
if(!$DEBUG){
close *STDERR;
close *STDOUT;
- close *STDIN;
+ #close *STDIN;
}
diag("Selenium running in $$") if $DEBUG;
- Alien::SeleniumRC->start()
+ Alien::SeleniumRC::start()
or croak "Can't start Selenium server";
diag("Selenium server $$ going down") if $DEBUG;
exit 1;
new(host => 'localhost',
port => 4444,
browser => $args->{browser} || '*firefox',
- browser_url => 'http://localhost:3000/'
+ browser_url => 'http://localhost:3000/',
+ auto_stop => 0,
);
};
$error = $@;
}
+ croak "Can't start selenium: $error" if $error;
- eval { $sel->start }
- or croak "Can't start selenium: $@ (previous error: $error)";
-
- return $sel;
+ return $www_selenium = $sel;
}
END {
+ if($www_selenium){
+ diag("Shutting down Selenium Server $sel_pid") if $DEBUG;
+ $www_selenium->do_command('shutDown');
+ undef $www_selenium;
+ }
if($sel_pid){
diag("Killing Selenium Server $sel_pid") if $DEBUG;
kill 15, $sel_pid or diag "Killing Selenium: $!";
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
-=head1 SUPPORT
-
-You can find documentation for this module with the perldoc command.
-
- perldoc Test::WWW::Selenium::Catalyst
-
-You can also look for information at:
+=head1 PATCHES
-=over 4
+Send me unified diffs against the git HEAD at:
-=item * AnnoCPAN: Annotated CPAN documentation
+ git://git.jrock.us/Test-WWW-Selenium-Catalyst
-L<http://annocpan.org/dist/Test-WWW-Selenium-Catalyst>
+You can view the repository online at
-=item * CPAN Ratings
+ http://git.jrock.us/?p=Test-WWW-Selenium-Catalyst.git;a=summary
-L<http://cpanratings.perl.org/d/Test-WWW-Selenium-Catalyst>
-
-=item * RT: CPAN's request tracker
-
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-WWW-Selenium-Catalyst>
-
-=item * Search CPAN
-
-L<http://search.cpan.org/dist/Test-WWW-Selenium-Catalyst>
-
-=back
+Thanks in advance for your contributions!
=head1 ACKNOWLEDGEMENTS