From: Chris Nehren Date: Fri, 21 Jan 2011 21:11:45 +0000 (-0500) Subject: add some tests against a sample catapp X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cf46ca55e50c4e264f290af53c29de7e6bcbf3ff;p=scpubgit%2FTest-Harness-Selenium.git add some tests against a sample catapp --- diff --git a/t/catapp.t b/t/catapp.t new file mode 100644 index 0000000..eaa4425 --- /dev/null +++ b/t/catapp.t @@ -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 index 0000000..8406d1c --- /dev/null +++ b/t/catapppass.t @@ -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 index 0000000..2eabc2f --- /dev/null +++ b/t/corpus/thselenium.html @@ -0,0 +1,67 @@ + + + + + + +thselenium + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
thselenium
open/
clickAndWaitlink=here
verifyTextPresent consectetur adipiscing
clickAndWait//a[@href='http://127.0.0.1:3000/echo']
typequeryfoo
clickAndWait//input[@value='Feed me now!']
verifyTextPresentYou fed me foo just now!
typequerybar
clickAndWait//input[@value='Feed me now!']
verifyTextPresentYou fed me foo just now!
+ + diff --git a/t/corpus/thseleniumpass.html b/t/corpus/thseleniumpass.html new file mode 100644 index 0000000..221bc8d --- /dev/null +++ b/t/corpus/thseleniumpass.html @@ -0,0 +1,72 @@ + + + + + + +thseleniumpass + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
thseleniumpass
open/
clickAndWaitlink=here
verifyTextPresent 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
verifyTextPresentMaybe you'd like to try our echo server?
verifyElementPresentlink=echo server
clickAndWaitlink=echo server
verifyTextPresentFeed me, Seymour!
typequeryfoo
clickAndWait//input[@value='Feed me now!']
verifyTextPresentYou fed me foo just now!
verifyElementPresentquery
+ +