TT#56376 selenium: add function create_contact() and delete_contact()

Common.pm:
- add new functions create_contact and delete_contact()
- these will be used for more tests in controller_customer and for invoice
tests

Change-Id: Ifbcbaab0c8ae899b6dd8a804ef7f1d0ac54e3689
changes/86/30486/4
Nico Schedel 7 years ago
parent c5acf9eab6
commit 45b34265de

@ -252,6 +252,47 @@ sub delete_customer {
};
}
sub create_contact {
my($self, $contactmail, $reseller) = @_;
diag("Go to Contacts page");
$self->driver->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
$self->driver->find_element("Contacts", 'link_text')->click();
diag("Trying to Create a new Contact");
$self->driver->find_element("Create Contact", 'link_text')->click();
$self->driver->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($self->driver->find_element_by_css('#reselleridtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$self->driver->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', $reseller);
ok($self->driver->wait_for_text('//*[@id="reselleridtable"]/tbody/tr[1]/td[2]', $reseller), 'Reseller was found');
$self->driver->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
$self->driver->fill_element('//*[@id="firstname"]', 'xpath', 'Test');
$self->driver->fill_element('//*[@id="lastname"]', 'xpath', 'User');
$self->driver->fill_element('//*[@id="email"]', 'xpath', $contactmail);
$self->driver->fill_element('//*[@id="company"]', 'xpath', 'SIPWISE');
$self->driver->find_element('//*[@id="save"]')->click();
}
sub delete_contact {
my($self, $contactmail, $cancel) = @_;
diag("Go to Contacts page");
$self->driver->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
$self->driver->find_element("Contacts", 'link_text')->click();
diag("Trying to Delete the Contact");
$self->driver->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($self->driver->find_element_by_css('#contact_table tr > td.dataTables_empty'), "Garbage text was not found");
$self->driver->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $contactmail);
ok($self->driver->wait_for_text('//*[@id="contact_table"]/tbody/tr[1]/td[6]', $contactmail), 'Found contact');
$self->driver->move_and_click('//*[@id="contact_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="contact_table_filter"]//input');
if($cancel){
popup_confirm_cancel($self, 'We are NOT going to terminate this customer');
} else {
popup_confirm_ok($self, 'We are going to terminate this customer');
};
}
sub popup_confirm_ok {
my($self, $message) = @_;

Loading…
Cancel
Save