Add build option --wd-server

To specify the host/port of an external
(already running) webdriver instance.
agranig/peering-route
Gerhard Jungwirth 12 years ago
parent 341aad8a93
commit cb2e48989f

@ -107,12 +107,14 @@ Build.PL - NGCP-Panel build system including test fixtures
./Build test --webdriver='java -jar selenium-server-standalone.jar'
./Build test --webdriver='chromedriver --url-base=wd/hub --port=4444'
./Build test --webdriver=selenium-rc # from CPAN distro Alien-SeleniumRC
./Build test --webdriver=external --wd-server=127.0.0.1:5555
./Build testcover --webdriver='phantomjs --webdriver=4444'
=head2 Options
--webdriver (required) external webdriver command
--wd-server HOST:PORT of an external webdriver to connect to
--server URI for socket test server
--help brief help message
--man full documentation
@ -122,6 +124,12 @@ Build.PL - NGCP-Panel build system including test fixtures
=head2 C<--webdriver>
(required) command to launch a webdriver
external if the webdriver is launched externally
=head2 C<--wd-server>
Host:Port of the webdriver to which the tests should connect.
Default is set by Test::WebDriver to localhost
=head2 C<--server>

@ -40,7 +40,7 @@ around('ACTION_test', sub {
require Getopt::Long;
my %opt = (server => 'http://localhost:5000');
Getopt::Long::GetOptions(\%opt, 'webdriver=s', 'server:s', 'help|?', 'man')
Getopt::Long::GetOptions(\%opt, 'webdriver=s', 'server:s', 'help|?', 'man', 'wd-server=s')
or die 'could not process command-line options';
require Pod::Usage;
@ -48,6 +48,12 @@ around('ACTION_test', sub {
Pod::Usage::pod2usage(-exitval => 0, -input => 'Build.PL', -verbose => 2) if $opt{man};
Pod::Usage::pod2usage("$0: --webdriver option required.\nRun `perldoc Build.PL`") unless $opt{webdriver};
if ($opt{'wd-server'}) {
my ($wd_host, $wd_port) = $opt{'wd-server'} =~ m{([^/:]+):([0-9]+)};
$ENV{TWD_HOST} = $wd_host;
$ENV{TWD_PORT} = $wd_port;
}
unless ($opt{webdriver} eq "external") {
$webdriver = child { exec $opt{webdriver} };
$self->wait_socket(qw(localhost 4444));

Loading…
Cancel
Save