add some tests against a sample catapp
Chris Nehren [Fri, 21 Jan 2011 21:11:45 +0000 (16:11 -0500)]
t/catapp.t [new file with mode: 0644]
t/catapppass.t [new file with mode: 0644]
t/corpus/thselenium.html [new file with mode: 0644]
t/corpus/thseleniumpass.html [new file with mode: 0644]

diff --git a/t/catapp.t b/t/catapp.t
new file mode 100644 (file)
index 0000000..eaa4425
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use lib 'lib';
+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;
+done_testing;
diff --git a/t/catapppass.t b/t/catapppass.t
new file mode 100644 (file)
index 0000000..8406d1c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use lib 'lib';
+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/thseleniumpass.html');
+$s->stop_server;
+done_testing;
diff --git a/t/corpus/thselenium.html b/t/corpus/thselenium.html
new file mode 100644 (file)
index 0000000..2eabc2f
--- /dev/null
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<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>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">thselenium</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/</td>
+       <td></td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>link=here</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td> consectetur adipiscing</td>
+       <td></td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>//a[@href='http://127.0.0.1:3000/echo']</td>
+       <td></td>
+</tr>
+<tr>
+       <td>type</td>
+       <td>query</td>
+       <td>foo</td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>//input[@value='Feed me now!']</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>You fed me foo just now!</td>
+       <td></td>
+</tr>
+<tr>
+       <td>type</td>
+       <td>query</td>
+       <td>bar</td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>//input[@value='Feed me now!']</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>You fed me foo just now!</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/t/corpus/thseleniumpass.html b/t/corpus/thseleniumpass.html
new file mode 100644 (file)
index 0000000..221bc8d
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<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>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">thseleniumpass</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/</td>
+       <td></td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>link=here</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td> ultrices a placerat eget, vehicula vel lectus. Nunc id dui velit. Pellentesque non eros diam. Donec bibendum tellus vel ligula ultricies eleifend suscipit lectus pulvinar. Etiam porta, metus id feugiat pulvinar, nibh justo aliquet dui, a gravida </td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>Maybe you'd like to try our echo server?</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyElementPresent</td>
+       <td>link=echo server</td>
+       <td></td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>link=echo server</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>Feed me, Seymour!</td>
+       <td></td>
+</tr>
+<tr>
+       <td>type</td>
+       <td>query</td>
+       <td>foo</td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>//input[@value='Feed me now!']</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>You fed me foo just now!</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyElementPresent</td>
+       <td>query</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>