|
|
@@ -2,52 +2,66 @@
|
|
|
|
|
|
use strict;
|
|
|
use warnings;
|
|
|
+use File::Which qw/which/;
|
|
|
use Selenium::Firefox::Binary;
|
|
|
use Selenium::Chrome;
|
|
|
use Selenium::PhantomJS;
|
|
|
use Selenium::Firefox;
|
|
|
use Test::More;
|
|
|
|
|
|
-unless( $ENV{RELEASE_TESTING} ) {
|
|
|
+unless ( $ENV{RELEASE_TESTING} ) {
|
|
|
plan skip_all => "Author tests not required for installation.";
|
|
|
}
|
|
|
|
|
|
PHANTOMJS: {
|
|
|
- my $version = `phantomjs -v` // '';
|
|
|
- chomp $version;
|
|
|
+ SKIP: {
|
|
|
+ my $has_phantomjs = Selenium::CanStartBinary::_find_executable('phantomjs');
|
|
|
+ skip 'Phantomjs binary not found in path', 3
|
|
|
+ unless $has_phantomjs;
|
|
|
|
|
|
- skip 'PhantomJS binary not found in path', 3
|
|
|
- unless is_proper_phantomjs_available($version);
|
|
|
+ my $version = `phantomjs -v` // '';
|
|
|
+ chomp $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');
|
|
|
+ skip 'PhantomJS binary not found in path', 3
|
|
|
+ unless is_proper_phantomjs_available($version);
|
|
|
|
|
|
- ok( Selenium::CanStartBinary::probe_port( $phantom->port ), 'the phantomjs binary is listening on its port');
|
|
|
+ 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');
|
|
|
+
|
|
|
+ ok( Selenium::CanStartBinary::probe_port( $phantom->port ), 'the phantomjs binary is listening on its port');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
CHROME: {
|
|
|
- # TODO: fix this test, as it's a hack that depends entirely on the
|
|
|
- # node module protractor's included `webdriver-manager` binary.
|
|
|
- $ENV{PATH} .= ':/usr/local/lib/node_modules/protractor/selenium';
|
|
|
+ SKIP: {
|
|
|
+ my $has_chromedriver = Selenium::CanStartBinary::_find_executable('chromedriver');
|
|
|
+ skip 'Chrome binary not found in path', 3
|
|
|
+ unless $has_chromedriver;
|
|
|
|
|
|
- my $chrome = Selenium::Chrome->new;
|
|
|
- ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
|
|
|
- isnt( $chrome->port, 4444, 'chrome can start up its own binary');
|
|
|
+ my $chrome = Selenium::Chrome->new;
|
|
|
+ ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
|
|
|
+ isnt( $chrome->port, 4444, 'chrome can start up its own binary');
|
|
|
|
|
|
- ok( Selenium::CanStartBinary::probe_port( $chrome->port ), 'the chrome binary is listening on its port');
|
|
|
+ ok( Selenium::CanStartBinary::probe_port( $chrome->port ), 'the chrome binary is listening on its port');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
FIREFOX: {
|
|
|
- my $binary = Selenium::Firefox::Binary::firefox_path();
|
|
|
- ok(-x $binary, 'we can find some sort of firefox');
|
|
|
-
|
|
|
my $command = Selenium::CanStartBinary::_construct_command('firefox', 1234);
|
|
|
ok($command =~ /firefox -no-remote/, 'firefox command has proper args');
|
|
|
|
|
|
- my $firefox = Selenium::Firefox->new;
|
|
|
- isnt( $firefox->port, 4444, 'firefox can start up its own binary');
|
|
|
- ok( Selenium::CanStartBinary::probe_port( $firefox->port ), 'the firefox binary is listening on its port');
|
|
|
+ SKIP: {
|
|
|
+ my $binary = Selenium::Firefox::Binary::firefox_path();
|
|
|
+ skip 'Firefox binary not found in path', 3
|
|
|
+ unless $binary;
|
|
|
+
|
|
|
+ ok(-x $binary, 'we can find some sort of firefox');
|
|
|
+
|
|
|
+ my $firefox = Selenium::Firefox->new;
|
|
|
+ isnt( $firefox->port, 4444, 'firefox can start up its own binary');
|
|
|
+ ok( Selenium::CanStartBinary::probe_port( $firefox->port ), 'the firefox binary is listening on its port');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
sub is_proper_phantomjs_available {
|