From: Chris Nehren Date: Thu, 16 Dec 2010 12:11:34 +0000 (-0500) Subject: basic working code, needs more hammering and testing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FTest-Harness-Selenium.git;a=commitdiff_plain;h=3749d2e5d81454c0265a7226579c5b6169aa9487 basic working code, needs more hammering and testing --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ee84da --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.sw* diff --git a/basic.html b/basic.html new file mode 100644 index 0000000..28e8497 --- /dev/null +++ b/basic.html @@ -0,0 +1,31 @@ + + + +++++ + + + + + + + + + + + + + + + + + + + + +
open/ 
typeqselenium rc
clickAndWaitbtnG 
textLikeSearches related to selenium rc 
+ + diff --git a/lib/Test/Harness/Selenium.pm b/lib/Test/Harness/Selenium.pm index defe00f..d4eda0e 100644 --- a/lib/Test/Harness/Selenium.pm +++ b/lib/Test/Harness/Selenium.pm @@ -2,7 +2,7 @@ package Test::Harness::Selenium; use strictures 1; use File::Find; -use WWW::Selenium; +use Socialtext::WikiFixture::Selenese; use HTML::TableExtract; use IO::All; @@ -27,19 +27,25 @@ BEGIN { } } +sub new { + my ($class, $self) = @_; + bless $self, $class; +} + sub test_directory { - my ($self) = @_; - my @tests = File::Find::Rule->file()->name('*.html')->in($self->{dir}); + my ($self, $dir) = @_; + my @tests = File::Find::Rule->file()->name('*.html')->in($dir); $self->run_tests_for($_) for @tests; } sub run_tests_for { my ($self, $html_file) = @_; my $rows = $self->get_rows_for($html_file); - my $src = WWW::Selenium->new( - host => $args->{host}, - port => $args->{port}, - browser_url => $args->{browser_url}, + my $src = Socialtext::WikiFixture::Selenese->new( + host => $self->{host}, + port => $self->{port}, + browser => $self->{browser}, + browser_url => $self->{browser_url}, ); $src->run_test_table($rows); } diff --git a/t b/t new file mode 100644 index 0000000..b6430f1 --- /dev/null +++ b/t @@ -0,0 +1,14 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use lib 'lib'; +use Test::Harness::Selenium; + +my $s = Test::Harness::Selenium->new({ + host => 'localhost', + port => 4444, + browser_url => 'http://www.google.com', + browser => shift, +}); +$s->run_tests_for('basic.html');