Many fixes.
Chris Nehren [Fri, 15 Apr 2011 06:54:43 +0000 (02:54 -0400)]
Remove obsolete tests.
Fix app server starting.
Fix catapp.t to use the new system.
Fix the remaining test corpus files to use relative URLs where appropriate.

lib/Test/Harness/Selenium.pm
t/catapp.t
t/corpus/basic.html [deleted file]
t/corpus/no_delay.html [deleted file]
t/corpus/thselenium.html
t/corpus/thseleniumpass.html

index 4b6cf60..dc4d936 100644 (file)
@@ -80,7 +80,8 @@ sub start_selenium_server {
       last;
     }
   }
-  die "timed out waiting for selenium server to start" if $tries == 5;
+  die "timed out waiting for selenium server to start at
+  http://$self->{selenium_rc}{host}:$self->{selenium_rc}{port}" if $tries == 5;
 }
 
 sub stop_selenium_server {
@@ -108,6 +109,9 @@ sub stop_app_server {
 
 sub test_directory {
   my ($self, $dir) = @_;
+  if(!exists $self->{app_server_proc}) {
+    $self->start_app_server;
+  }
   if($self->{selenium_rc}{start} && !$self->{selenium_rc}{selenium_server_proc}) {
     $self->start_selenium_server;
   }
index eaa4425..ee9e631 100644 (file)
@@ -7,13 +7,16 @@ use Test::Harness::Selenium;
 use Test::More;
 
 my $browser = shift;
-my $s = Test::Harness::Selenium->new({
-    host => 'localhost',
-    port => $< + 60_000,
-    browser_url => 'http://127.0.0.1:3000',
-    browser => $browser,
-});
-$s->start_server;
-$s->run_tests_for('t/corpus/thselenium.html');
-$s->stop_server;
+my $s = Test::Harness::Selenium->new(
+    selenium_rc => {
+      host => '10.0.0.8',
+      port => $< + 6900,
+      start => 1,
+      xvnc_display => 1,
+    },
+    app_base => 'http://10.0.0.5:3000',
+    app_server_cmd => 'examples/THSelenium-Test/script/thselenium_test_server.pl',
+    browser => '*firefox',
+);
+$s->test_directory('t/corpus/');
 done_testing;
diff --git a/t/corpus/basic.html b/t/corpus/basic.html
deleted file mode 100644 (file)
index 28e8497..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<html>
-<body>
-<table border="1" class="docutils" id="google-search-example">
-<colgroup>
-<col width="32%" />
-<col width="47%" />
-<col width="21%" />
-</colgroup>
-<tbody valign="top">
-<tr><td>open</td>
-<td>/</td>
-
-<td>&nbsp;</td>
-</tr>
-<tr><td>type</td>
-<td>q</td>
-<td>selenium rc</td>
-</tr>
-<tr><td>clickAndWait</td>
-<td>btnG</td>
-<td>&nbsp;</td>
-</tr>
-<tr><td>textLike</td>
-
-<td>Searches related to selenium rc</td>
-<td>&nbsp;</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
diff --git a/t/corpus/no_delay.html b/t/corpus/no_delay.html
deleted file mode 100644 (file)
index 8e74511..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<html>
-<body>
-<table border="1" class="docutils" id="google-search-example">
-<colgroup>
-<col width="32%" />
-<col width="47%" />
-<col width="21%" />
-</colgroup>
-<tbody valign="top">
-<tr><td>open</td>
-<td>/</td>
-
-<td>&nbsp;</td>
-</tr>
-<tr><td>type</td>
-<td>q</td>
-<td>selenium rc</td>
-</tr>
-<tr><td>textLike</td>
-
-<td>Searches related to rc</td>
-<td>&nbsp;</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
index 2eabc2f..e584e0e 100644 (file)
@@ -3,7 +3,6 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head profile="http://selenium-ide.openqa.org/profiles/test-case">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://127.0.0.1:3000/" />
 <title>thselenium</title>
 </head>
 <body>
@@ -28,7 +27,7 @@
 </tr>
 <tr>
        <td>clickAndWait</td>
-       <td>//a[@href='http://127.0.0.1:3000/echo']</td>
+       <td>//a[@href='/echo']</td>
        <td></td>
 </tr>
 <tr>
index 221bc8d..8249749 100644 (file)
@@ -3,7 +3,6 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head profile="http://selenium-ide.openqa.org/profiles/test-case">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://127.0.0.1:3000/" />
 <title>thseleniumpass</title>
 </head>
 <body>