From 1f2d8b754246d2f42b9676f04536f31f086b4777 Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Thu, 25 Apr 2013 14:19:54 +0200 Subject: [PATCH] make all selenium tests work with chromium and htmlunit selenium tests are now working with: firefox, chrome, htmlunit, phantomjs --- t/admin-login.t | 10 +++++++--- t/controller_domain_selenium.t | 5 ++++- t/controller_reseller_selenium.t | 7 +++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/t/admin-login.t b/t/admin-login.t index bbb8f92a4f..abd5180a91 100644 --- a/t/admin-login.t +++ b/t/admin-login.t @@ -3,8 +3,12 @@ use lib 't/lib'; use Test::More import => [qw(done_testing is)]; use Test::WebDriver::Sipwise qw(); -my $d = Test::WebDriver::Sipwise->new; -$d->get($ENV{CATALYST_SERVER}); +my $browsername = $ENV{BROWSER_NAME} || ""; #possible values: htmlunit, chrome +my $d = Test::WebDriver::Sipwise->new (browser_name => $browsername, + 'proxy' => {'proxyType' => 'system'}); +my $uri = $ENV{CATALYST_SERVER} || 'http://localhost:3000'; +$d->get_ok("$uri/logout"); #make sure we are logged out +$d->get_ok("$uri/login"); $d->find(link_text => 'Admin')->click; @@ -12,6 +16,6 @@ $d->find(name => 'username')->send_keys('administrator'); $d->find(name => 'password')->send_keys('administrator'); $d->find(name => 'submit')->click; -is($d->get_text('//title'), 'Dashboard'); +$d->title_is('Dashboard'); done_testing; diff --git a/t/controller_domain_selenium.t b/t/controller_domain_selenium.t index 767b329bc1..0083f64554 100644 --- a/t/controller_domain_selenium.t +++ b/t/controller_domain_selenium.t @@ -3,7 +3,10 @@ use lib 't/lib'; use Test::More import => [qw(done_testing is ok)]; use Test::WebDriver::Sipwise qw(); -my $d = Test::WebDriver::Sipwise->new; +my $browsername = $ENV{BROWSER_NAME} || ""; #possible values: htmlunit, chrome +my $d = Test::WebDriver::Sipwise->new (browser_name => $browsername, + 'proxy' => {'proxyType' => 'system'}); +$d->set_window_size(800,1280) if ($browsername ne "htmlunit"); my $uri = $ENV{CATALYST_SERVER} || 'http://localhost:3000'; $d->get_ok("$uri/logout"); #make sure we are logged out $d->get_ok("$uri/login"); diff --git a/t/controller_reseller_selenium.t b/t/controller_reseller_selenium.t index 942aefd69b..f09b70aa9a 100644 --- a/t/controller_reseller_selenium.t +++ b/t/controller_reseller_selenium.t @@ -5,7 +5,10 @@ use Test::WebDriver::Sipwise qw(); #my $sel = Test::WWW::Selenium::Catalyst->start({default_names => 1}); -my $d = Test::WebDriver::Sipwise->new; +my $browsername = $ENV{BROWSER_NAME} || ""; #possible values: htmlunit, chrome +my $d = Test::WebDriver::Sipwise->new (browser_name => $browsername, + 'proxy' => {'proxyType' => 'system'}); +$d->set_window_size(800,1280) if ($browsername ne "htmlunit"); my $uri = $ENV{CATALYST_SERVER} || 'http://localhost:3000'; $d->get_ok("$uri/logout"); #make sure we are logged out $d->get_ok("$uri/login"); @@ -37,7 +40,7 @@ is($elem->get_text,'No matching records found'); $searchfield->clear(); $searchfield->send_keys('1'); $d->find_ok(css => '#Reseller_table tr.sw_action_row'); -is($d->find(css => '#Reseller_table tr:nth-of-type(1) > td:nth-of-type(1)')->get_text,'1'); +is($d->find(xpath => '//table[@id="Reseller_table"]//tr[1]/td[1]')->get_text,'1'); $d->findclick_ok(link_text => 'Create Reseller'); $d->findclick_ok(id => 'save');