04-commands-implemented.t 831 B

123456789101112131415161718192021222324252627282930313233343536
  1. use strict;
  2. use warnings;
  3. # TODO: find another way to do this checking, this is so fragile
  4. use Selenium::Remote::Commands;
  5. use Test::More;
  6. unless($ENV{RELEASE_TESTING}) {
  7. plan(skip_all=>"Author tests not required for installation.");
  8. }
  9. my $comm = Selenium::Remote::Commands->new->get_cmds;
  10. for my $command (keys %{$comm}) {
  11. my $found_command = 0;
  12. for my $file (
  13. qw{lib/Selenium/Remote/Driver.pm
  14. lib/Selenium/Remote/WebElement.pm
  15. lib/Selenium/Firefox.pm}
  16. ) {
  17. open(my $fh, '<', $file) or die "Couldn't open file $file";
  18. for (<$fh>) {
  19. if (/'?command'?\s*=>\s*'$command'/
  20. or /{'?commands'?}->\{'?$command'?}/) {
  21. pass("find $command");
  22. $found_command = 1;
  23. }
  24. }
  25. }
  26. if (!$found_command && $command !~ /Gecko/) {
  27. fail("find $command");
  28. }
  29. }
  30. done_testing;
  31. 1;