TT#56376 selenium: add label checks to Common.pm

Common.pm:
- add checks to see if create/delete labels show up and if the show the
correct text

Change-Id: I71ca582779d9b9267bceb7a4dd3ca25a942268a3
changes/54/30954/2
Nico Schedel 6 years ago
parent 5a8afa9917
commit 49046fc55b

@ -50,6 +50,7 @@ sub create_domain {
$self->driver->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
$self->driver->find_element('//*[@id="domain"]')->send_keys($name);
$self->driver->find_element('//*[@id="save"]')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Domain successfully created")]'), "Label 'Domain successfully created' was shown");
}
sub delete_domain {
@ -70,6 +71,7 @@ sub delete_domain {
popup_confirm_cancel($self, 'We are NOT going to delete this domain');
} else {
popup_confirm_ok($self, 'We are going to delete this domain');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Domain successfully deleted!")]'), "Label 'Domain successfully deleted!' was shown");
};
}
@ -90,6 +92,7 @@ sub create_reseller {
$self->driver->select_if_unselected('//*[@id="contractidtable"]/tbody/tr/td[5]/input');
$self->driver->fill_element('//*[@id="name"]', 'xpath', $name);
$self->driver->find_element('//*[@id="save"]')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Reseller successfully created.")]'), "Label 'Reseller successfully created.' was shown");
}
sub create_reseller_contract {
@ -115,6 +118,7 @@ sub create_reseller_contract {
$self->driver->select_if_unselected('//*[@id="billing_profileidtable"]/tbody/tr[1]/td[4]/input');
$self->driver->fill_element('//*[@id="external_id"]', 'xpath', $resellerid);
$self->driver->find_element('//*[@id="save"]')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "successfully created")]'), "Label 'Contract successfully created' was shown");
}
@ -136,6 +140,7 @@ sub delete_reseller {
popup_confirm_cancel($self, 'We are NOT going to delete this reseller');
} else {
popup_confirm_ok($self, 'We are going to delete this reseller');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Successfully terminated reseller")]'), "Label 'Successfully terminated reseller' was shown");
};
}
@ -157,6 +162,7 @@ sub delete_reseller_contract {
popup_confirm_cancel($self, 'We are NOT going to delete this reseller contract');
} else {
popup_confirm_ok($self, 'We are going to delete this reseller contract');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Contract successfully terminated")]'), "Label 'Contract successfully terminated' was shown");
};
}
@ -178,6 +184,7 @@ sub create_rw_ruleset {
$self->driver->fill_element('//*[@id="name"]', 'xpath', $rulesetname);
$self->driver->fill_element('//*[@id="description"]', 'xpath', 'For testing purposes');
$self->driver->find_element('//*[@id="save"]')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule set successfully created")]'), "Label 'Rewrite rule set successfully created' was shown");
}
sub delete_rw_ruleset {
@ -198,6 +205,7 @@ sub delete_rw_ruleset {
popup_confirm_cancel($self, 'We are NOT going to delete this ruleset');
} else {
popup_confirm_ok($self, 'We are going to delete this ruleset');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule set successfully deleted")]'), "Label 'Rewrite rule set successfully deleted' was shown");
};
}
@ -226,6 +234,7 @@ sub create_customer {
$self->driver->select_if_unselected('//table[@id="productidtable"]/tbody/tr[1]/td[contains(text(),"Basic SIP Account")]/..//input[@type="checkbox"]');
}
$self->driver->find_element('#save', 'css')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "successfully created")]'), "Label 'Customer successfully created' was shown");
}
sub delete_customer {
@ -246,6 +255,7 @@ sub delete_customer {
popup_confirm_cancel($self, 'We are NOT going to terminate this customer');
} else {
popup_confirm_ok($self, 'We are going to terminate this customer');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Customer successfully terminated")]'), "Label 'Customer successfully terminated' was shown");
};
}
@ -269,6 +279,7 @@ sub create_contact {
$self->driver->fill_element('//*[@id="email"]', 'xpath', $contactmail);
$self->driver->fill_element('//*[@id="company"]', 'xpath', 'SIPWISE');
$self->driver->find_element('//*[@id="save"]')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Contact successfully created")]'), "Label 'Contact successfully created' was shown");
}
sub delete_contact {
@ -289,6 +300,7 @@ sub delete_contact {
popup_confirm_cancel($self, 'We are NOT going to terminate this contact');
} else {
popup_confirm_ok($self, 'We are going to terminate this contact');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Contact successfully terminated")]'), "Label 'Contact successfully terminated' was shown");
};
}
@ -311,6 +323,7 @@ sub create_billing_profile {
$self->driver->fill_element('[name=handle]', 'css', $billingname);
$self->driver->find_element('//select[@id="fraud_interval_lock"]/option[contains(text(),"foreign calls")]')->click();
$self->driver->find_element('//div[contains(@class,"modal")]//input[@type="submit"]')->click();
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Billing profile successfully created")]'), "Label 'Billing profile successfully created' was shown");
}
sub delete_billing_profile {
@ -329,6 +342,7 @@ sub delete_billing_profile {
popup_confirm_cancel($self, 'We are NOT going to terminate this billing profile');
} else {
popup_confirm_ok($self, 'We are going to terminate this billing profile');
ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Billing profile successfully terminated")]'), "Label 'Billing profile successfully terminated' was shown");
};
}

Loading…
Cancel
Save