more selenium tests

for controllers: reseller, domain
agranig/1_0_subfix
Gerhard Jungwirth 13 years ago
parent af2dbd8825
commit 0ccd99747f

@ -7,7 +7,7 @@ my $d = Test::WebDriver::Sipwise->new;
$d->get_ok($ENV{CATALYST_SERVER} || 'http://localhost:3000');
$d->set_implicit_wait_timeout(1000);
#$sel->is_text_present_ok('Subscriber Sign In');
$d->findtext_ok('Subscriber Sign In');
$d->findclick_ok(link_text => 'Admin');
$d->find(name => 'username')->send_keys('administrator');
@ -16,6 +16,7 @@ $d->findclick_ok(name => 'submit');
$d->text_is('//title', 'Dashboard');
$d->findclick_ok(xpath => '//*[@id="main-nav"]//*[contains(text(),"Settings")]');
$d->find_ok(xpath => '//a[contains(@href,"/domain")]');
$d->findclick_ok(link_text => "Domains");
@ -24,13 +25,24 @@ $d->findclick_ok(xpath => "/html/body/div/div[4]/div/div[3]/table/tbody/tr/td/a"
$d->location_like(qr!domain/\d+/preferences!); #/
$d->findclick_ok(link_text => "Access Restrictions");
my $edit_link = $d->find(xpath => '//table/tbody/tr/td[normalize-space(text()) = "concurrent_max"]/../td/*/a');
my $edit_link = $d->find(xpath => '(//table/tbody/tr/td[normalize-space(text()) = "concurrent_max"]/../td//a)[2]');
ok($edit_link);
$d->move_to(element => $edit_link);
#if this doesen't work update your Selenium::Remote::Driver (still not working)
#$edit_link->hover;
#$edit_link->click;
#$d->click('LEFT');
#workaround to make the button visible
$d->execute_script('$(".sw_actions").removeAttr("style")');
$edit_link->click;
my $formfield = $d->find('id' => 'concurrent_max');
ok($formfield);
$formfield->clear;
$formfield->send_keys('thisisnonumber');
$d->findclick_ok(id => 'save');
$d->findtext_ok('Value must be an integer');
$formfield = $d->find('id' => 'concurrent_max');
ok($formfield);
$formfield->clear;
$formfield->send_keys('789');
$d->findclick_ok(id => 'save');
done_testing;
# vim: filetype=perl

@ -38,26 +38,27 @@ is($d->find(css => '#Reseller_table tr:nth-of-type(1) > td:nth-of-type(1)')->get
#the rest is not yet ported to webdriver:
#$sel->type_ok($searchfield, '');
#$sel->type_keys_ok($searchfield, 'asdfasdfasdf');
$d->findclick_ok(link_text => 'Create Reseller');
$d->findclick_ok(id => 'save');
$d->findtext_ok("Contract field is required");
$d->findtext_ok("Name field is required");
$d->findtext_ok("Status field is required");
$d->findclick_ok(id => 'mod_close');
#$sel->click_ok('//a[contains(text(),"Create Reseller")]');
#$sel->wait_for_page_to_load_ok(2000);
#$sel->click_ok('save');
#$sel->wait_for_page_to_load_ok(2000);
#$sel->click_ok('mod_close');
#$sel->wait_for_page_to_load_ok(2000);
#$sel->mouse_over_ok('css=#Reseller_table tr:nth-of-type(1)');
#$sel->click_ok('css=#Reseller_table tr:nth-of-type(1) a.btn-primary');
#$sel->wait_for_page_to_load_ok(2000);
#$sel->click_ok('mod_close');
#$sel->wait_for_page_to_load_ok(2000);
#$sel->mouse_over_ok('css=#Reseller_table tr:nth-of-type(1)');
#$sel->click_ok('css=#Reseller_table tr:nth-of-type(1) a.btn-secondary');
#$sel->wait_for_page_to_load_ok(2000);
#$sel->text_is('css=div.alert-info', 'Reseller delete not implemented!');
#workaround to make the button visible
$d->execute_script('$(".sw_actions").removeAttr("style").delay(500);');
$d->execute_script('$(".sw_actions").attr("style", "display:block")');
$d->findclick_ok(xpath => '//*[@id="Reseller_table"]/tbody/tr[1]//a[contains(text(),"Edit")]');
is($d->find(id => "name")->get_attribute("value"), "reseller 1");
$d->findclick_ok(id => 'mod_close');
#same workaround
$d->execute_script('$(".sw_actions").removeAttr("style").delay(500);');
$d->execute_script('$(".sw_actions").attr("style", "display:block")');
$d->findclick_ok(xpath => '//*[@id="Reseller_table"]/tbody/tr[1]//a[contains(@class,"btn-secondary")]');
$d->findtext_ok("Are you sure?");
$d->findclick_ok(xpath => '//div[@id="dataConfirmModal"]//a[contains(text(),"Delete")]');
is($d->find(css => 'div.alert-info')->get_text, 'Reseller delete not implemented!');
#$sel->debug();
#<STDIN>; # pause
done_testing;
# vim: filetype=perl

@ -12,3 +12,7 @@ method findclick(Str $scheme, Str $query) {
$elem->click;
return 1;
}
method findtext(Str $text, Any $ignore) {
return $self->find(xpath => "//*[contains(text(),\"$text\")]");
}

Loading…
Cancel
Save