Browse Source

Check for proper version of phantomjs binary in test

Daniel Gempesaw 10 years ago
parent
commit
aee1e7df6c
1 changed files with 13 additions and 0 deletions
  1. 13 0
      t/binary.t

+ 13 - 0
t/binary.t

@@ -13,6 +13,12 @@ unless( $ENV{RELEASE_TESTING} ) {
 }
 
 PHANTOMJS: {
+    my $version = `phantomjs -v` // '';
+    chomp $version;
+
+    skip 'PhantomJS binary not found in path', 3
+      unless is_proper_phantomjs_available($version);
+
     my $phantom = Selenium::PhantomJS->new;
     is( $phantom->browser_name, 'phantomjs', 'binary phantomjs is okay');
     isnt( $phantom->port, 4444, 'phantomjs can start up its own binary');
@@ -44,4 +50,11 @@ FIREFOX: {
     ok( Selenium::BinaryModeBuilder::probe_port( $firefox->port ), 'the firefox binary is listening on its port');
 }
 
+sub is_proper_phantomjs_available {
+    my ($ver) = @_;
+
+    $ver =~ s/\.\d$//;
+    return $ver >= 1.9;
+}
+
 done_testing;