04-commands-implemented.t 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 Selenium::Remote::Spec;
  6. use Test::More;
  7. unless($ENV{RELEASE_TESTING}) {
  8. plan(skip_all=>"Author tests not required for installation.");
  9. }
  10. my $comm = Selenium::Remote::Commands->new->get_cmds;
  11. for my $command (keys %{$comm}) {
  12. my $found_command = 0;
  13. for my $file (
  14. qw{lib/Selenium/Remote/Driver.pm
  15. lib/Selenium/Remote/WebElement.pm
  16. lib/Selenium/Firefox.pm}
  17. ) {
  18. open(my $fh, '<', $file) or die "Couldn't open file $file";
  19. for (<$fh>) {
  20. if (/'?command'?\s*=>\s*'$command'/
  21. or /{'?commands'?}->\{'?$command'?}/) {
  22. pass("find $command");
  23. $found_command = 1;
  24. }
  25. }
  26. }
  27. if (!$found_command && $command !~ /Gecko|screenshot/i) {
  28. fail("find $command");
  29. }
  30. }
  31. note "*************** WD3 methods ********************";
  32. $comm = Selenium::Remote::Spec->new->get_cmds;
  33. for my $command (keys %{$comm}) {
  34. my $found_command = 0;
  35. for my $file (
  36. qw{lib/Selenium/Remote/Driver.pm
  37. lib/Selenium/Remote/WebElement.pm
  38. lib/Selenium/Firefox.pm}
  39. ) {
  40. open(my $fh, '<', $file) or die "Couldn't open file $file";
  41. for (<$fh>) {
  42. if (/'?command'?\s*=>\s*'$command'/
  43. or /{'?commands'?}->\{'?$command'?}/) {
  44. pass("find $command");
  45. $found_command = 1;
  46. }
  47. }
  48. }
  49. if (!$found_command && $command !~ /Gecko|screenshot/i) {
  50. fail("find $command");
  51. }
  52. }
  53. done_testing;
  54. 1;