Procházet zdrojové kódy

Simplify mock recording file lookup

Daniel Gempesaw před 9 roky
rodič
revize
7592cb0cd3
2 změnil soubory, kde provedl 24 přidání a 53 odebrání
  1. 23 39
      t/convenience.t
  2. 1 14
      t/lib/TestHarness.pm

+ 23 - 39
t/convenience.t

@@ -23,50 +23,34 @@ $caps{remote_server_addr} = '127.0.0.1';
 delete $caps{browser_name};
 
 subtest Driver => sub {
-	my $phantomjs = Selenium::PhantomJS->new( %caps );
-	ok( $phantomjs->browser_name eq 'phantomjs', 'convenience phantomjs is okay' );
-	$phantomjs->quit;
+    my $phantomjs = Selenium::PhantomJS->new( %caps );
+    ok( $phantomjs->browser_name eq 'phantomjs', 'convenience phantomjs is okay' );
+    $phantomjs->quit;
 
-	my $firefox = Selenium::Firefox->new( %caps );
-	ok( $firefox->browser_name eq 'firefox', 'convenience firefox is okay' );
-	$firefox->quit;
+    my $firefox = Selenium::Firefox->new( %caps );
+    ok( $firefox->browser_name eq 'firefox', 'convenience firefox is okay' );
+    $firefox->quit;
 
-	my $chrome = Selenium::Chrome->new( %caps );
-	ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
-	$chrome->quit;
-
-	SKIP: {
-		skip 'Can only test IE on windows', 1 unless $^O eq 'MSWin32';
-
-		my $ie = Selenium::InternetExplorer->new( %caps );
-		ok( $ie->browser_name eq 'internet_explorer', 'convenience ie is okay' );
-		$ie->quit;
-	}
+    my $chrome = Selenium::Chrome->new( %caps );
+    ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
+    $chrome->quit;
 };
 
 subtest TestDriver => sub {
-	my $phantomjs = Test::Selenium::PhantomJS->new( %caps );
-	ok( $phantomjs->browser_name eq 'phantomjs', 'convenience phantomjs is okay' );
-	$phantomjs->get_ok('about:config');
-	$phantomjs->quit;
-
-	my $firefox = Test::Selenium::Firefox->new( %caps );
-	$firefox->get_ok('about:config');
-	ok( $firefox->browser_name eq 'firefox', 'convenience firefox is okay' );
-	$firefox->quit;
-
-	my $chrome = Test::Selenium::Chrome->new( %caps );
-	ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
-	$chrome->get_ok('about:config');
-	$chrome->quit;
-
-	SKIP: {
-		skip 'Can only test IE on windows', 1 unless $^O eq 'MSWin32';
-
-		my $ie = Test::Selenium::InternetExplorer->new( %caps );
-		ok( $ie->browser_name eq 'internet_explorer', 'convenience ie is okay' );
-		$ie->quit;
-	}
+    my $phantomjs = Test::Selenium::PhantomJS->new( %caps );
+    ok( $phantomjs->browser_name eq 'phantomjs', 'convenience phantomjs is okay' );
+    $phantomjs->get_ok('about:config');
+    $phantomjs->quit;
+
+    my $firefox = Test::Selenium::Firefox->new( %caps );
+    $firefox->get_ok('about:config');
+    ok( $firefox->browser_name eq 'firefox', 'convenience firefox is okay' );
+    $firefox->quit;
+
+    my $chrome = Test::Selenium::Chrome->new( %caps );
+    ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
+    $chrome->get_ok('about:config');
+    $chrome->quit;
 };
 
 

+ 1 - 14
t/lib/TestHarness.pm

@@ -66,19 +66,6 @@ has record => (
     }
 );
 
-has os => (
-    is => 'ro',
-    init_args => undef,
-    default => sub {
-        my $os  = $^O;
-        if ($os =~ m/(aix|freebsd|openbsd|sunos|solaris)/) {
-            $os = 'linux';
-        }
-
-        return $os;
-    }
-);
-
 has base_caps => (
     is => 'rw',
     lazy => 1,
@@ -126,7 +113,7 @@ has mock_file => (
         my $test_name = lc($self->calling_file);
         $test_name =~ s/\.t$//;
 
-        my $mock_file = $mock_folder . $test_name . '-mock-' . $self->os . '.json';
+        my $mock_file = $mock_folder . $test_name . '-mock.json';
 
         # If we're replaying, we need a mock to read from. Otherwise,
         # we can't do anything