|
|
@@ -11,25 +11,32 @@ my $repo_root = abs_path($this_folder) . '/';
|
|
|
|
|
|
reset_env();
|
|
|
start_server();
|
|
|
+output_linux_help();
|
|
|
|
|
|
-my $built_lib = glob('Selenium-Remote-Driver-*/lib');
|
|
|
-if (not defined $built_lib) {
|
|
|
- print ' Building a dist.';
|
|
|
- print `cd $repo_root && dzil build`;
|
|
|
-}
|
|
|
-# If built_lib wasn't around in the first place, we'll have to glob
|
|
|
-# for it again.
|
|
|
-$built_lib = $repo_root . ($built_lib || glob('Selenium-Remote-Driver-*/lib'));
|
|
|
-
|
|
|
-if ($^O eq 'linux') {
|
|
|
- print "Headless and need a webdriver server started? Try\n\n\tDISPLAY=:1 xvfb-run --auto-servernum java -jar /usr/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar\n\n";
|
|
|
-}
|
|
|
-
|
|
|
+my $built_lib = find_built_lib();
|
|
|
my $export = $^O eq 'MSWin32' ? 'set' : 'export';
|
|
|
my $wait = $^O eq 'MSWin32' ? 'START /WAIT' : '';
|
|
|
print `$export WD_MOCKING_RECORD=1 && cd $repo_root && prove -I$built_lib -rv t/`;
|
|
|
reset_env();
|
|
|
|
|
|
+sub find_built_lib {
|
|
|
+ my $built_lib = glob($repo_root . 'Selenium-Remote-Driver-*/lib');
|
|
|
+ if (not defined $built_lib) {
|
|
|
+ print 'Building a dist.' . "\n";
|
|
|
+ print `cd $repo_root && dzil build`;
|
|
|
+ }
|
|
|
+ # If built_lib wasn't around in the first place, we'll have to glob
|
|
|
+ # for it again.
|
|
|
+ $built_lib ||= glob($repo_root . 'Selenium-Remote-Driver-*/lib');
|
|
|
+ return $built_lib;
|
|
|
+}
|
|
|
+
|
|
|
+sub output_linux_help {
|
|
|
+ if ($^O eq 'linux') {
|
|
|
+ print "Headless and need a webdriver server started? Try\n\n\tDISPLAY=:1 xvfb-run --auto-servernum java -jar /usr/lib/node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar\n\n";
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
sub start_server {
|
|
|
if ($^O eq 'MSWin32') {
|
|
|
system('start "TEMP_HTTP_SERVER" /MIN perl ' . $repo_root . 't/http-server.pl');
|
|
|
@@ -37,6 +44,7 @@ sub start_server {
|
|
|
else {
|
|
|
system('perl ' . $repo_root . 't/http-server.pl > /dev/null &');
|
|
|
}
|
|
|
+ print 'Starting a new server.' . "\n";
|
|
|
}
|
|
|
|
|
|
sub kill_server {
|
|
|
@@ -54,6 +62,6 @@ sub reset_env {
|
|
|
print 'Cleaning. ';
|
|
|
`cd $repo_root && dzil clean`;
|
|
|
}
|
|
|
- print 'Taking out any existing servers. ';
|
|
|
+ print 'Taking out any existing servers. ' . "\n";
|
|
|
kill_server();
|
|
|
}
|