TT#56376 selenium: improved label checks for controller_rw_ruleset.t

controller_rw_ruleset.t:
- alert checks now print the actual displayed text if check fails
- add missing check

Change-Id: I8e1a371819af4a4427a91f308e574351b671ff0d
changes/17/31617/2
Nico Schedel 6 years ago
parent a3586f03c9
commit 8ccb2f05bc

@ -41,12 +41,12 @@ $d->find_element('#mod_close', 'css')->click();
$c->create_rw_ruleset($rulesetname, $resellername);
diag('Search for our new Rewrite Rule Set');
is($d->get_text('//*[@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);
diag('Check Rewrite Rule Set Details');
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule set successfully created")]'), "Label 'Rewrite rule set successfully created' was shown");
ok($d->wait_for_text('//*[@id="rewrite_rule_set_table"]//tr[1]/td[2]', $resellername), 'Reseller Name is correct');
ok($d->wait_for_text('//*[@id="rewrite_rule_set_table"]//tr[1]/td[3]', $rulesetname), 'Ruleset Name is correct');
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]//td[contains(text(), "For testing purposes")]'), 'Description is correct');
@ -59,12 +59,12 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'For very testing purposes')
$d->find_element('//*[@id="save"]')->click();
diag('Search for our new Rewrite Rule Set');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully updated", "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);
diag('Check Rewrite Rule Set Details');
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule set successfully updated")]'), "Label 'Rewrite rule set successfully updated' was shown");
ok($d->wait_for_text('//*[@id="rewrite_rule_set_table"]//tr[1]/td[2]', $resellername), 'Reseller Name is correct');
ok($d->wait_for_text('//*[@id="rewrite_rule_set_table"]//tr[1]/td[3]', $rulesetname), 'Ruleset Name is correct');
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]//td[contains(text(), "For very testing purposes")]'), 'Description is correct');
@ -96,7 +96,7 @@ $d->find_element('//*[@id="save"]')->click();
diag('Check if Rule has been created');
$d->find_element('Inbound Rewrite Rules for Caller', 'link_text')->click();
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule successfully created")]'), "Label 'Rewrite rule successfully created' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), "Match Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "\2")]'), "Replacement Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "Not International to E.164")]'), "Description is correct");
@ -108,7 +108,7 @@ $d->find_element('//*[@id="save"]')->click();
diag('Check if Rule has been edited');
$d->find_element('Inbound Rewrite Rules for Caller', 'link_text')->click();
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule successfully updated")]'), "Label 'Rewrite rule successfully updated' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully updated", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), "Match Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "\2")]'), "Replacement Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "International to E.164")]'), "Description is correct");
@ -123,7 +123,7 @@ $d->find_element('//*[@id="save"]')->click();
diag('Check if Rule has been created');
$d->find_element('Inbound Rewrite Rules for Callee', 'link_text')->click();
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule successfully created")]'), "Label 'Rewrite rule successfully created' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), "Match Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]//td[contains(text(), "\2")]'), "Replacement Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]//td[contains(text(), "Not International to E.164")]'), "Description is correct");
@ -135,7 +135,7 @@ $d->find_element('//*[@id="save"]')->click();
diag('Check if Rule has been edited');
$d->find_element('Inbound Rewrite Rules for Callee', 'link_text')->click();
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule successfully updated")]'), "Label 'Rewrite rule successfully updated' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully updated", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), "Match Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]//td[contains(text(), "\2")]'), "Replacement Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]//td[contains(text(), "International to E.164")]'), "Description is correct");
@ -157,7 +157,7 @@ ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]/
diag('Delete Rule');
$d->move_and_click('//*[@id="collapse_icaller"]//table//tr[1]//td//a[text()[contains(., "Delete")]]', 'xpath', '//*[@id="masthead"]//div/h2');
$d->find_element('//*[@id="dataConfirmOK"]')->click();
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule successfully deleted")]'), "Label 'Rewrite rule successfully deleted' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully deleted", "Correct Alert was shown");
=cut
diag('Go Back to the Rewrite Rule set Page');
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
@ -175,6 +175,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Im a clone, beep boop');
$d->find_element('//*[@id="clone"]')->click();
diag('Search for the cloned Rewrite Rule Set');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully cloned", "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', $rulesetclonename);
@ -215,7 +216,7 @@ $d->find_element('//*[@id="save"]')->click();
diag('Check if correct ruleset has been selected');
$d->find_element('Number Manipulations', 'link_text')->click;
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Preference rewrite_rule_set successfully updated")]'), "Label 'Preference rewrite_rule_set successfully updated' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference rewrite_rule_set successfully updated", "Correct Alert was shown");
ok($d->wait_for_text('//table/tbody/tr/td[contains(text(), "rewrite_rule_set")]/../td[4]/select/option[@selected="selected"]', $rulesetname), 'rewrite_rule_set value has been set');
diag('Delete Domain');
@ -230,8 +231,8 @@ ok($d->wait_for_text('//*[@id="rewrite_rule_set_table"]/tbody/tr[1]/td[3]', $rul
diag('Open delete dialog and press delete');
$c->delete_rw_ruleset($rulesetname, 0);
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully deleted", "Correct Alert was shown");
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Rewrite rule set successfully deleted")]'), "Label 'Rewrite rule set successfully deleted' was shown");
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Ruleset was deleted');
$c->delete_reseller_contract($contractid);

Loading…
Cancel
Save