tests: do diag output

agranig/1_0_subfix
Gerhard Jungwirth 12 years ago
parent bf41772200
commit 29c4afa729

@ -1,6 +1,6 @@
use Sipwise::Base;
use lib 't/lib';
use Test::More import => [qw(done_testing is ok)];
use Test::More import => [qw(done_testing is ok diag)];
use Test::WebDriver::Sipwise qw();
my $browsername = $ENV{BROWSER_NAME} || ""; #possible values: htmlunit, chrome
@ -14,6 +14,7 @@ $d->set_implicit_wait_timeout(1000);
$d->findtext_ok('Subscriber Sign In');
diag("Go to Admin Login");
$d->findclick_ok(link_text => 'Admin');
$d->find(name => 'username')->send_keys('administrator');
$d->find(name => 'password')->send_keys('administrator');
@ -21,16 +22,20 @@ $d->findclick_ok(name => 'submit');
$d->title_is('Dashboard');
diag("Go to Domains page");
$d->findclick_ok(xpath => '//*[@id="main-nav"]//*[contains(text(),"Settings")]');
$d->find_ok(xpath => '//a[contains(@href,"/domain")]');
$d->findclick_ok(link_text => "Domains");
diag("Open Preferences of first Domain");
$d->title_is("Domains");
$d->findclick_ok(xpath => '//table[@id="Domain_table"]/tbody/tr[1]/td[1]/a');
diag('Open the tab "Access Restrictions"');
$d->location_like(qr!domain/\d+/preferences!); #/
$d->findclick_ok(link_text => "Access Restrictions");
diag("Click edit for the preference concurrent_max");
my $row = $d->find(xpath => '//table/tbody/tr/td[normalize-space(text()) = "concurrent_max"]');
ok($row);
my $edit_link = $d->find_child_element($row, '(./../td//a)[2]');
@ -38,12 +43,14 @@ ok($edit_link);
$d->move_to(element => $row);
$edit_link->click;
diag("Try to change this to a value which is not a number");
my $formfield = $d->find('id' => 'concurrent_max');
ok($formfield);
$formfield->clear;
$formfield->send_keys('thisisnonumber');
$d->findclick_ok(id => 'save');
diag('Type 789 and click Save');
$d->findtext_ok('Value must be an integer');
$formfield = $d->find('id' => 'concurrent_max');
ok($formfield);

@ -1,11 +1,10 @@
use Sipwise::Base;
use lib 't/lib';
use Test::More import => [qw(done_testing is ok)];
use Test::More import => [qw(done_testing is ok diag)];
use Test::WebDriver::Sipwise qw();
#my $sel = Test::WWW::Selenium::Catalyst->start({default_names => 1});
my $browsername = $ENV{BROWSER_NAME} || ""; #possible values: htmlunit, chrome
my $browsername = $ENV{BROWSER_NAME} || "";
#possible values: htmlunit, chrome, firefox (default)
my $d = Test::WebDriver::Sipwise->new (browser_name => $browsername,
'proxy' => {'proxyType' => 'system'});
$d->set_window_size(800,1280) if ($browsername ne "htmlunit");
@ -14,34 +13,35 @@ $d->get_ok("$uri/logout"); #make sure we are logged out
$d->get_ok("$uri/login");
$d->set_implicit_wait_timeout(1000);
#$sel->is_text_present_ok('Subscriber Sign In');
diag("Go to Admin Login");
$d->findclick_ok(link_text => 'Admin');
#$sel->type_ok('username', 'administrator');
#$sel->type_ok('password', 'administrator');
diag("Logging In");
$d->find(name => 'username')->send_keys('administrator');
$d->find(name => 'password')->send_keys('administrator');
$d->findclick_ok(name => 'submit');
#$sel->wait_for_page_to_load_ok(2000);
#$d->text_is('//title', 'Dashboard');
diag("Go to reseller list");
$d->title_is('Dashboard');
$d->findclick_ok(xpath => '//a[@class="btn" and @href="/reseller"]');
diag("Search nonexisting reseller");
my $searchfield = $d->find(css => '#Reseller_table_filter label input');
ok($searchfield);
$searchfield->send_keys('donotfindme');
diag("Verify that nothing is shown");
my $elem = $d->find(css => '#Reseller_table td.dataTables_empty');
ok($elem);
is($elem->get_text,'No matching records found');
diag('Search for "1" in resellers');
$searchfield->clear();
$searchfield->send_keys('1');
$d->find_ok(css => '#Reseller_table tr.sw_action_row');
is($d->find(xpath => '//table[@id="Reseller_table"]//tr[1]/td[1]')->get_text,'1');
diag("Going to create a reseller");
$d->findclick_ok(link_text => 'Create Reseller');
$d->findclick_ok(id => 'save');
$d->findtext_ok("Contract field is required");
@ -49,6 +49,7 @@ $d->findtext_ok("Name field is required");
$d->findtext_ok("Status field is required");
$d->findclick_ok(id => 'mod_close');
diag("Click Edit on the first reseller shown (first row)");
sleep 1; #prevent a StaleElementReferenceException
my $row = $d->find(xpath => '//*[@id="Reseller_table"]/tbody/tr[1]');
ok($row);
@ -59,6 +60,7 @@ $btn->click;
is($d->find(id => "name")->get_attribute("value"), "reseller 1");
$d->findclick_ok(id => 'mod_close');
diag("Click Delete on the first reseller shown");
sleep 1; #prevent a StaleElementReferenceException
$row = $d->find(xpath => '//*[@id="Reseller_table"]/tbody/tr[1]');
ok($row);

Loading…
Cancel
Save