Эх сурвалжийг харах

Added NOTOK cmd_status when server is not responsible

jamadam 11 жил өмнө
parent
commit
0d73550c43

+ 1 - 0
lib/Selenium/Remote/RemoteConnection.pm

@@ -110,6 +110,7 @@ sub _process_response {
 
         if (($response->message ne 'No Content') && ($response->content ne '')) {
             if ($response->content_type !~ m/json/i) {
+                $data->{'cmd_status'} = 'NOTOK';
                 $data->{'cmd_return'} = 'Server returned error message '.$response->content.' instead of data';
                 return $data;
             }

+ 18 - 0
t/01-driver.t

@@ -35,6 +35,24 @@ my $driver = Selenium::Remote::Driver->new(browser_name => 'firefox');
 my $website = 'http://localhost:63636';
 my $ret;
 
+ERROR_MESSAGE: {
+    my $unused_port = do {
+        my $l = IO::Socket::INET->new(
+            Listen    => 5,
+            LocalHost => '127.0.0.1',
+            LocalPort => 0,
+            Proto     => 'tcp',
+            ReuseAddr => 1,
+        ) or die $!;
+        $l->sockport;
+    };
+    eval {
+        my $sel = Selenium::Remote::Driver->new(
+                                    host => 'localhost', port => $unused_port);
+    };
+    unlike($@, qr/Use of uninitialized value/, "not unhelpful message");
+}
+
 DESIRED_CAPABILITIES: {
     # We're using a different test method for these because we needed
     # to inspect payload of the POST to /session, and the method of