Procházet zdrojové kódy

Use Test::Time instead of Time::Mock

From an email:

> All my work laptops are Windows based computers, so I am stuck with
  Activestate or Strawberry perl. I tried to install
  Selenium::Remote:Driver with both cpanm and ppm commands, and both
  fails due to Time::Mock issue. Seems like Time::Mock does not support
  Windows: http://code.activestate.com/ppm/Time-Mock/

> I tried force install commands on cpan, but that didn't work either. I
  am not a professional programmer (I am actually a Pharmacist), so I am
  pretty much stuck right now. Should I try to downgrade a Selenium
  version and try to manually install?

Using Test::Time makes our test faster, significantly less flaky, and it
has excellent test success on Windows:

http://code.activestate.com/ppm/Test-Time/
Daniel Gempesaw před 10 roky
rodič
revize
15ca978672
2 změnil soubory, kde provedl 5 přidání a 4 odebrání
  1. 1 1
      cpanfile
  2. 4 3
      t/Waiter.t

+ 1 - 1
cpanfile

@@ -42,8 +42,8 @@ on 'test' => sub {
   requires "Test::Fatal" => "0";
   requires "Test::LWP::UserAgent" => "0";
   requires "Test::More" => "0";
+  requires "Test::Time" => "0";
   requires "Test::Warn" => "0";
-  requires "Time::Mock" => "0";
   requires "lib" => "0";
 };
 

+ 4 - 3
t/Waiter.t

@@ -5,14 +5,15 @@ use warnings;
 use Test::More;
 use Test::Warn;
 use Test::Fatal;
-use Time::Mock throttle => 100;
+use Test::Time;
 use Selenium::Waiter;
 
 SIMPLE_WAIT: {
     my $ret;
-    waits_ok( sub { $ret = wait_until { 1 } }, '<', 5, 'immediately true returns quickly' );
+    waits_ok( sub { $ret = wait_until { 1 } }, '<', 2, 'immediately true returns quickly' );
     ok($ret == 1, 'return value for a true wait_until is passed up');
-    waits_ok( sub { $ret = wait_until { 0 } }, '>', 25, 'never true expires the timeout' );
+
+    waits_ok( sub { $ret = wait_until { 0 } }, '==', 30, 'never true expires the timeout' );
     ok($ret eq '', 'return value for a false wait is an empty string');
 }