binary.t 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #! /usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Selenium::Binary qw/_probe_port/;
  5. use Selenium::Firefox::Binary;
  6. use Selenium::Chrome;
  7. use Selenium::PhantomJS;
  8. use Selenium::Firefox;
  9. use Test::More;
  10. use FindBin;
  11. use lib $FindBin::Bin . '/lib';
  12. use TestHarness;
  13. my $harness = TestHarness->new(
  14. this_file => $FindBin::Script
  15. );
  16. my %caps = %{ $harness->base_caps };
  17. delete $caps{browser_name};
  18. PHANTOMJS: {
  19. my $phantom = Selenium::PhantomJS->new( %caps );
  20. is( $phantom->browser_name, 'phantomjs', 'binary phantomjs is okay');
  21. isnt( $phantom->port, 4444, 'phantomjs can start up its own binary');
  22. ok( _probe_port( $phantom->port ), 'the phantomjs binary is listening on its port');
  23. }
  24. CHROME: {
  25. $ENV{PATH} .= ':/usr/local/lib/node_modules/protractor/selenium';
  26. my $chrome = Selenium::Chrome->new( %caps );
  27. ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
  28. isnt( $chrome->port, 4444, 'chrome can start up its own binary');
  29. ok( _probe_port( $chrome->port ), 'the chrome binary is listening on its port');
  30. }
  31. FIREFOX: {
  32. my $binary = Selenium::Firefox::Binary::firefox_path();
  33. ok(-x $binary, 'we can find some sort of firefox');
  34. my $firefox = Selenium::Firefox->new;
  35. isnt( $firefox->port, 4444, 'firefox can start up its own binary');
  36. ok( _probe_port( $firefox->port ), 'the firefox binary is listening on its port');
  37. }
  38. done_testing;