Skip Menu |
 

This queue is for tickets about the Test-WWW-Selenium-Catalyst CPAN distribution.

Report information
The Basics
Id: 33214
Status: resolved
Priority: 0/
Queue: Test-WWW-Selenium-Catalyst

People
Owner: Nobody in particular
Requestors: nine [...] detonation.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
Test-WWW-Selenium-Catalyst-external-selenium.diff



Subject: Patch allowing an external Selenium server to be used
Download (untitled) / with headers
text/plain 536b
It can be useful to use an already running external Selenium server for testing for example to run the catalyst app on a server, while Selenium and thus the controlled browser is running on the developer's machine. The patch allows this by setting an environment variable (EXTERNAL_SELENIUM, but I don't really like that name), though long-term I'd more like to move starting of the Selenium server to object instantiation (like the Catalyst server), so the choice of which Selenium server to use can be put into the application.
Subject: Test-WWW-Selenium-Catalyst-external-selenium.diff
diff -Naur Test-WWW-Selenium-Catalyst-0.01/Makefile.PL Test-WWW-Selenium-Catalyst-0.02/Makefile.PL --- Test-WWW-Selenium-Catalyst-0.01/Makefile.PL 2007-05-27 10:20:09.000000000 +0200 +++ Test-WWW-Selenium-Catalyst-0.02/Makefile.PL 2008-02-13 15:32:29.000000000 +0100 @@ -14,6 +14,7 @@ 'Test::WWW::Selenium' => 0, 'Test::More' => 0, 'Catalyst::Utils' => 0, + 'Sys::Hostname::FQDN' => 0, ); auto_install(); WriteAll(); diff -Naur Test-WWW-Selenium-Catalyst-0.01/lib/Test/WWW/Selenium/Catalyst.pm Test-WWW-Selenium-Catalyst-0.02/lib/Test/WWW/Selenium/Catalyst.pm --- Test-WWW-Selenium-Catalyst-0.01/lib/Test/WWW/Selenium/Catalyst.pm 2008-02-07 14:54:34.000000000 +0100 +++ Test-WWW-Selenium-Catalyst-0.02/lib/Test/WWW/Selenium/Catalyst.pm 2008-02-13 15:29:45.000000000 +0100 @@ -7,6 +7,7 @@ use Test::WWW::Selenium; use Test::More; use Catalyst::Utils; +use Sys::Hostname::FQDN qw(fqdn); BEGIN { $ENV{CATALYST_ENGINE} ||= 'HTTP'; } @@ -124,13 +125,20 @@ } # if it's something else, leave the CATALYST_DEBUG setting in tact - _start_server() or croak "Couldn't start selenium server"; + _start_server() or croak "Couldn't start selenium server" unless $ENV{EXTERNAL_SELENIUM}; return 1; } sub start { my $class = shift; my $args = shift || {}; + my $host = 'localhost'; + my $port = 4444; + my $catalyst_host = 'localhost'; + if ($ENV{EXTERNAL_SELENIUM}) { + ($host, $port) = split /:/, $ENV{EXTERNAL_SELENIUM}; + $catalyst_host = fqdn; + } # start a Catalyst MyApp server eval("use $app"); @@ -143,7 +151,7 @@ exit 0; }; diag("Catalyst server running in $$") if $DEBUG; - $app->run('3000', 'localhost'); + $app->run('3000', $catalyst_host); exit 1; } $app_pid = $pid; @@ -158,10 +166,10 @@ eval { $sel = Test::WWW::Selenium-> - new(host => 'localhost', - port => 4444, + new(host => $host, + port => $port, browser => $args->{browser} || '*firefox', - browser_url => 'http://localhost:3000/', + browser_url => "http://$catalyst_host:3000/", auto_stop => 0, ); }; @@ -174,9 +182,12 @@ END { if($www_selenium){ - diag("Shutting down Selenium Server $sel_pid") if $DEBUG; - $www_selenium->do_command('shutDown'); - undef $www_selenium; + $www_selenium->stop(); + if($sel_pid){ + 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;
So is there any chance of getting a new version with this patch?
Download (untitled) / with headers
text/plain 348b
On Wed Apr 01 10:50:32 2009, NINE wrote: Show quoted text
> So is there any chance of getting a new version with this patch?
I made similar changes already (before I had permissions to update the RT queue.) Can you please try the latest version and see if they suit your needs? There's an SELENIUM_SERVER environment variable (along the lines of CATALYST_SERVER)
Download (untitled) / with headers
text/plain 666b
On Mon Apr 06 03:55:49 2009, ASH wrote: Show quoted text
> I made similar changes already (before I had permissions to update the > RT queue.) Can you > please try the latest version and see if they suit your needs? There's > an SELENIUM_SERVER > environment variable (along the lines of CATALYST_SERVER)
With version 0.05_99 which is the latest according to CPAN I do not see any effect of a SELENIUM_SERVER env var, nor can I find any code dealing with it in the module. Also neither the Changes (http://search.cpan.org/src/ASH/Test-WWW-Selenium-Catalyst-0.05_99/Changes) or the README mention anything like that. Are you sure you released a version with this changes yet? :)
Download (untitled) / with headers
text/plain 219b
On Mon Apr 06 04:18:46 2009, NINE wrote: Show quoted text
> Are you sure you released a version with this changes yet? :)
Yes, 0.06 has this change, and 0.07 has a change to not accidentally shutdown external servers we didn't start.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.