1
0

convenience.t 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. use strict;
  2. use warnings;
  3. use Selenium::Chrome;
  4. use Selenium::Firefox;
  5. use Selenium::InternetExplorer;
  6. use Selenium::PhantomJS;
  7. use Test::Selenium::Chrome;
  8. use Test::Selenium::Firefox;
  9. use Test::Selenium::InternetExplorer;
  10. use Test::Selenium::PhantomJS;
  11. use Test::More;
  12. $Selenium::Remote::Driver::FORCE_WD2 = 1;
  13. use FindBin;
  14. use lib $FindBin::Bin . '/lib';
  15. use TestHarness;
  16. my $harness = TestHarness->new(
  17. this_file => $FindBin::Script
  18. );
  19. my %caps = %{ $harness->base_caps };
  20. $caps{remote_server_addr} = '127.0.0.1';
  21. delete $caps{browser_name};
  22. subtest Driver => sub {
  23. my $phantomjs = Selenium::PhantomJS->new( %caps );
  24. ok( $phantomjs->browser_name eq 'phantomjs', 'convenience phantomjs is okay' );
  25. $phantomjs->quit;
  26. my $firefox = Selenium::Firefox->new( %caps );
  27. ok( $firefox->browser_name eq 'firefox', 'convenience firefox is okay' );
  28. $firefox->quit;
  29. my $chrome = Selenium::Chrome->new( %caps );
  30. ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
  31. $chrome->quit;
  32. };
  33. subtest TestDriver => sub {
  34. my $phantomjs = Test::Selenium::PhantomJS->new( %caps );
  35. ok( $phantomjs->browser_name eq 'phantomjs', 'convenience phantomjs is okay' );
  36. $phantomjs->get_ok('about:config');
  37. $phantomjs->quit;
  38. my $firefox = Test::Selenium::Firefox->new( %caps );
  39. $firefox->get_ok('about:config');
  40. ok( $firefox->browser_name eq 'firefox', 'convenience firefox is okay' );
  41. $firefox->quit;
  42. my $chrome = Test::Selenium::Chrome->new( %caps );
  43. ok( $chrome->browser_name eq 'chrome', 'convenience chrome is okay' );
  44. $chrome->get_ok('about:config');
  45. $chrome->quit;
  46. };
  47. done_testing;