Quellcode durchsuchen

Added BAIL_OUT for conditions not supported yet - work in progress.

Aditya Ivaturi vor 15 Jahren
Ursprung
Commit
200033047b
3 geänderte Dateien mit 27 neuen und 6 gelöschten Zeilen
  1. 5 4
      t/00-load.t
  2. 11 1
      t/01-driver-live.t
  3. 11 1
      t/02-webelement-live.t

+ 5 - 4
t/00-load.t

@@ -1,10 +1,11 @@
-#!perl -T
+use strict;
 
 use Test::More tests => 1;
 
 BEGIN {
-    use_ok( 'Selenium::Remote::Driver' ) || print "Bail out!
-";
+    if ($^O eq 'MSWin32') {
+        BAIL_OUT 'Unit tests not supported yet, need to be on Mac on Linux with Firefox';
+    }
+    use_ok( 'Selenium::Remote::Driver' ) || print "Bail out!";
 }
 
-diag( "Testing Selenium::Remote::Driver $Selenium::Remote::Driver::VERSION, Perl $], $^X" );

+ 11 - 1
t/01-driver-live.t

@@ -2,10 +2,20 @@ use strict;
 use warnings;
 
 use Test::More 'no_plan';
+use Net::Ping;
 use Data::Dumper;
 
 BEGIN {
-    use_ok( 'Selenium::Remote::Driver' ) || print "Can't load Driver, giving up.";
+   my $p = Net::Ping->new("tcp", 2);
+    $p->port_number(4444);
+    unless ($p->ping('localhost')) {
+        BAIL_OUT ("Selenium server is not running on localhost:4444");
+        exit;
+    }
+    unless (use_ok( 'Selenium::Remote::Driver')) {
+        BAIL_OUT ("Couldn't load Driver");
+        exit;
+    }
 }
 
 # Start our local http server

+ 11 - 1
t/02-webelement-live.t

@@ -2,10 +2,20 @@ use strict;
 use warnings;
 
 use Test::More 'no_plan';
+use Net::Ping;
 use Data::Dumper;
 
 BEGIN {
-    use_ok( 'Selenium::Remote::Driver' ) || print "Can't load Driver, giving up.";
+    my $p = Net::Ping->new("tcp", 2);
+    $p->port_number(4444);
+    unless ($p->ping('localhost')) {
+        BAIL_OUT ("Selenium server is not running on localhost:4444");
+        exit;
+    }
+    unless (use_ok( 'Selenium::Remote::Driver')) {
+        BAIL_OUT ("Couldn't load Driver");
+        exit;
+    }
 }
 
 # Start our local http server