1
0

binary.t 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #! /usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Selenium::Firefox::Binary;
  5. use Selenium::Chrome;
  6. use Selenium::PhantomJS;
  7. use Selenium::Firefox;
  8. use Test::More;
  9. unless( $ENV{RELEASE_TESTING} ) {
  10. plan skip_all => "Author tests not required for installation.";
  11. }
  12. PHANTOMJS: {
  13. my $phantom = Selenium::PhantomJS->new;
  14. is( $phantom->browser_name, 'phantomjs', 'binary phantomjs is okay');
  15. isnt( $phantom->port, 4444, 'phantomjs can start up its own binary');
  16. ok( Selenium::BinaryModeBuilder::probe_port( $phantom->port ), 'the phantomjs binary is listening on its port');
  17. }
  18. CHROME: {
  19. # TODO: fix this test, as it's a hack that depends entirely on the
  20. # node module protractor's included `webdriver-manager` binary.
  21. $ENV{PATH} .= ':/usr/local/lib/node_modules/protractor/selenium';
  22. my $chrome = Selenium::Chrome->new;
  23. ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
  24. isnt( $chrome->port, 4444, 'chrome can start up its own binary');
  25. ok( Selenium::BinaryModeBuilder::probe_port( $chrome->port ), 'the chrome binary is listening on its port');
  26. }
  27. FIREFOX: {
  28. my $binary = Selenium::Firefox::Binary::firefox_path();
  29. ok(-x $binary, 'we can find some sort of firefox');
  30. my $command = Selenium::BinaryModeBuilder::_construct_command('firefox', 1234);
  31. ok($command =~ /firefox -no-remote/, 'firefox command has proper args');
  32. my $firefox = Selenium::Firefox->new;
  33. isnt( $firefox->port, 4444, 'firefox can start up its own binary');
  34. ok( Selenium::BinaryModeBuilder::probe_port( $firefox->port ), 'the firefox binary is listening on its port');
  35. }
  36. done_testing;