binary.t 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #! /usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Test::More;
  5. use Selenium::Binary;
  6. use Selenium::Firefox::Binary;
  7. use Selenium::Chrome;
  8. use Selenium::PhantomJS;
  9. use Selenium::Firefox;
  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 $ghost = Selenium::PhantomJS->new( %caps );
  20. is( $ghost->browser_name, 'phantomjs', 'binary phantomjs is okay');
  21. isnt( $ghost->port, 4444, 'phantomjs can start up its own binary');
  22. }
  23. CHROME: {
  24. $ENV{PATH} .= ':/usr/local/lib/node_modules/protractor/selenium';
  25. my $chrome = Selenium::Chrome->new( %caps );
  26. ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
  27. isnt( $chrome->port, 4444, 'chrome can start up its own binary');
  28. $chrome->quit;
  29. }
  30. FIREFOX: {
  31. my $binary = Selenium::Firefox::Binary::path();
  32. ok(-x $binary, 'we can find some sort of firefox');
  33. my $firefox = Selenium::Firefox->new;
  34. isnt( $firefox->port, 4444, 'firefox can start up its own binary');
  35. }
  36. done_testing;