TT#68016 selenium: improve some test startups

some tests would do the "create empty entry" first and then create a new
entry, which is not very efficent when creation of entry is handled by a
function in common.pm. creating element first, then doing the "create empty
element" test after should be a little faster

Change-Id: I802da0a1e082ec881c847585e55115e566f730c0
changes/10/34910/4
Nico Schedel 6 years ago
parent 467321e2f3
commit fa3feb531f

@ -24,10 +24,7 @@ my $run_ok = 0;
$c->login_ok();
$c->create_reseller_contract($contractid);
$c->create_reseller($resellername, $contractid);
diag("Go to 'Billing Profiles' page");
$d->find_element('//*[@class="brand"]')->click();
$d->find_element('//*[@id="content"]//div[contains(text(), "Billing")]/../../div/a')->click();
$c->create_billing_profile($billingname, $resellername);
diag("Try to create an empty Billing Profile");
$d->find_element('Create Billing Profile', 'link_text')->click();
@ -37,10 +34,7 @@ diag("Check error messages");
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Handle field is required")]'));
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
diag("Create a legit Billing Profile");
$d->find_element('//*[@id="mod_close"]')->click();
$c->create_billing_profile($billingname, $resellername);
diag("Search Billing Profile");
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');

@ -36,9 +36,11 @@ $c->create_reseller($resellername, $contractid);
$c->create_contact($contactmail, $resellername);
$c->create_billing_profile($billingname, $resellername);
diag("Go to 'Customers' page");
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
$d->find_element('Customers', 'link_text')->click();
if($pbx == 1){
$c->create_customer($customerid, $contactmail, $billingname, 'pbx locked');
} else {
$c->create_customer($customerid, $contactmail, $billingname, 'locked');
}
diag("Try to create an empty Customer");
$d->find_element('Create Customer', 'link_text')->click();
@ -51,16 +53,8 @@ $d->find_element('#save', 'css')->click();
diag("Check if error messages appear");
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Contact field is required")]'));
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid \'billing_profile_id\', not defined.")]'));
diag("Continuing creating a legit customer");
$d->find_element('//*[@id="mod_close"]')->click();
if($pbx == 1){
$c->create_customer($customerid, $contactmail, $billingname, 'pbx locked');
} else {
$c->create_customer($customerid, $contactmail, $billingname, 'locked');
}
diag("Search Customer");
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test was not found');
@ -73,8 +67,6 @@ ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile is correct');
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "locked")]'), 'Status is correct');
$custnum = $d->get_text('//*[@id="Customer_table"]//tr[1]//td[1]');
$compstring = "Customer #" . $custnum . " successfully created - Details";
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, 'Correct Alert was shown');
diag("Check if Customer is locked");
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');

@ -19,7 +19,7 @@ my $run_ok = 0;
$c->login_ok();
$c->create_domain($domainstring);
diag("Try to add an empty Domain");
diag("Try to create an empty Domain");
$d->find_element('Create Domain', 'link_text')->click();
$d->find_element('//*[@id="save"]')->click();

@ -25,6 +25,7 @@ my $run_ok = 0;
$c->login_ok();
$c->create_reseller_contract($contractid);
$c->create_reseller($resellername, $contractid);
$c->create_ncos($resellername, $ncosname);
diag("Go to 'Number Porting' page");
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
@ -85,9 +86,6 @@ ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Level Name field is required")]'));
$d->find_element('//*[@id="mod_close"]')->click();
diag("Create a normal NCOS");
$c->create_ncos($resellername, $ncosname);
diag("Search our new NCOS");
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');

@ -20,10 +20,7 @@ my $run_ok = 0;
$c->login_ok();
$c->create_reseller_contract($contractid);
diag("Go to 'Resellers' page");
$d->find_element('//*[@class="brand"]')->click();
$d->find_element('//*[@id="content"]//div[contains(text(), "Resellers")]/../../div/a')->click();
$c->create_reseller($resellername, $contractid);
diag("Try to create an empty Reseller");
$d->find_element('Create Reseller', 'link_text')->click();
@ -33,10 +30,7 @@ $d->find_element('//*[@id="save"]')->click();
diag("Check error messages");
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Contract field is required")]'));
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
diag("Create a legit Reseller");
$d->find_element('#mod_close', 'css')->click();
$c->create_reseller($resellername, $contractid);
diag("Search Reseller");
$d->fill_element('#Resellers_table_filter label input', 'css', 'thisshouldnotexist');

@ -22,12 +22,9 @@ my $run_ok = 0;
$c->login_ok();
$c->create_reseller_contract($contractid);
$c->create_reseller($resellername, $contractid);
$c->create_rw_ruleset($rulesetname, $resellername);
diag("Go to 'Rewrite Rule Sets' page");
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
$d->find_element('Rewrite Rule Sets', 'link_text')->click();
diag("Try to create a empty Rewrite Rule Set");
diag("Try to create an empty Rewrite Rule Set");
$d->find_element('Create Rewrite Rule Set', 'link_text')->click();
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
$d->find_element('//*[@id="save"]')->click();
@ -35,13 +32,9 @@ $d->find_element('//*[@id="save"]')->click();
diag("Check error messages");
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
diag("Create a legit Rewrite Rule Set");
$d->find_element('#mod_close', 'css')->click();
$c->create_rw_ruleset($rulesetname, $resellername);
diag("Search Rewrite Rule Set");
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule set successfully created', 'Correct Alert was shown');
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);

Loading…
Cancel
Save