Bläddra i källkod

added coercion, and removed the call to get_ok in the tests (wont work)

Emmanuel Peroumalnaik 12 år sedan
förälder
incheckning
b74ad7b892

+ 3 - 0
lib/Selenium/Remote/Driver.pm

@@ -186,11 +186,13 @@ has 'remote_server_addr' => (
 
 has 'browser_name' => (
     is      => 'rw',
+    coerce  => sub { ( defined($_[0]) ? $_[0] : 'firefox' )},
     default => sub {'firefox'},
 );
 
 has 'platform' => (
     is      => 'rw',
+    coerce  => sub { ( defined($_[0]) ? $_[0] : 'ANY' )},
     default => sub {'ANY'},
 );
 
@@ -239,6 +241,7 @@ has 'commands' => (
 
 has 'auto_close' => (
     is      => 'rw',
+    coerce  => sub { ( defined($_[0]) ? $_[0] : 1 )},
     default => sub {1},
 );
 

+ 2 - 0
lib/Test/Selenium/Remote/Driver.pm

@@ -83,6 +83,8 @@ sub AUTOLOAD {
         my $cmd = $1;
 
         # make a subroutine for ok() around the selenium command
+        # TODO: fix the thing for get_ok, it won't work as its arg get
+        # pop'd in $name (so the call to get has no args => end of game)
         $sub = sub {
             my $self = shift;
             my $name = pop;

+ 1 - 1
t/Test-Selenium-Remote-Driver-google.t

@@ -12,7 +12,7 @@ unless ($host and $port) {
 my $t = Test::Selenium::Remote::Driver->new(
     remote_server_addr => $host, port => $port,
 );
-$t->get_ok('http://www.google.com');
+$t->get('http://www.google.com');
 $t->title_like(qr/Google/);
 $t->body_like(qr/Google/);