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

controller_ncos.t:
- alert checks now print the actual displayed text if check fails
- added missing checks
- fixed one diag string

Change-Id: I240e9fe78c468ec1a8d203efc38936ab7e6eb825
changes/88/31588/3
Nico Schedel 6 years ago
parent 7bf6294b9b
commit 85ba31c393

@ -44,6 +44,7 @@ $d->fill_element('//*[@id="prefix"]', 'xpath', $prefix);
$d->find_element('//*[@id="save"]')->click();
diag("Search for LNP carrier");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "LNP carrier successfully created", "Correct Alert was shown");
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
@ -61,6 +62,7 @@ $d->fill_element('//*[@id="prefix"]', 'xpath', $prefix);
$d->find_element('//*[@id="save"]')->click();
diag("Search for LNP carrier");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "LNP carrier successfully updated", "Correct Alert was shown");
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
@ -94,12 +96,12 @@ $d->fill_element('//*[@id="description"]', 'xpath', "This is a simple descriptio
$d->find_element('//*[@id="save"]')->click();
diag('Search for our new NCOS');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS level successfully created", "Correct Alert was shown");
$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');
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
diag("Check NCOS details");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS level successfully created")]'), "Label 'NCOS level successfully created' was shown");
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]/tbody/tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]/tbody/tr[1]/td[contains(text(), ' . $ncosname . ')]'), 'NCOS name is correct');
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]/tbody/tr[1]/td[contains(text(), "blacklist")]'), "NCOS mode is correct");
@ -114,12 +116,12 @@ $d->fill_element('//*[@id="description"]', 'xpath', "This is a very simple descr
$d->find_element('//*[@id="save"]')->click();
diag('Search for NCOS');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS level successfully updated", "Correct Alert was shown");
$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');
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
diag("Check NCOS details");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS level successfully updated")]'), "Label 'NCOS level successfully updated' was shown");
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]/tbody/tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]/tbody/tr[1]/td[contains(text(), ' . $ncosname . ')]'), 'NCOS name is correct');
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]/tbody/tr[1]/td[contains(text(), "whitelist")]'), "NCOS mode is correct");
@ -143,7 +145,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Austrian Premium Numbers');
$d->find_element('//*[@id="save"]')->click();
diag("Check pattern details");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS pattern successfully created")]'), "Label 'NCOS pattern successfully created' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS pattern successfully created", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]/tbody/tr/td[contains(text(), "^439")]'), "Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]/tbody/tr/td[contains(text(), "Austrian Premium Numbers")]'), "Description is correct");
@ -154,7 +156,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'German Premium Numbers');
$d->find_element('//*[@id="save"]')->click();
diag("Check pattern details");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS pattern successfully updated")]'), "Label 'NCOS pattern successfully updated' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS pattern successfully updated", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]/tbody/tr/td[contains(text(), "^491")]'), "Pattern is correct");
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]/tbody/tr/td[contains(text(), "German Premium Numbers")]'), "Description is correct");
@ -171,6 +173,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Rule for LNP Carrier 1');
$d->find_element('//*[@id="save"]')->click();
diag("Check LNP details");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS lnp entry successfully created", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]/tbody/tr/td[contains(text(), "' . $lnpcarrier . '")]'), "LNP Carrier is correct");
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]/tbody/tr/td[contains(text(), "Rule for LNP Carrier 1")]'), "Description is correct");
@ -180,6 +183,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Rule for LNP Carrier 2');
$d->find_element('//*[@id="save"]')->click();
diag("Check LNP details");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS lnp entry successfully updated", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]/tbody/tr/td[contains(text(), "' . $lnpcarrier . '")]'), "LNP Carrier is correct");
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]/tbody/tr/td[contains(text(), "Rule for LNP Carrier 2")]'), "Description is correct");
@ -189,7 +193,7 @@ $d->select_if_unselected('//*[@id="local_ac"]');
$d->find_element('//*[@id="save"]')->click();
diag("Check if NCOS settings have been applied");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS level setting successfully updated")]'), "Label 'NCOS level setting successfully updated' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS level setting successfully updated", "Correct Alert was shown");
ok($d->find_element_by_xpath('//*[@id="local_ac"][@checked="checked"]'), 'Setting "Include local area code" was applied');
diag("Creating Domain to add NCOS Level");
@ -212,7 +216,7 @@ $d->find_element('//*[@id="ncos"]/option[contains(text(), "' . $ncosname . '")]'
$d->find_element('//*[@id="save"]')->click();
diag("Check if NCOS Level was applied");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "Preference ncos successfully updated")]'), "Label 'Preference ncos successfully updated' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference ncos successfully updated", "Correct Alert was shown");
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "ncos")]/../td/select/option[contains(text(), "' . $ncosname . '")][@selected="selected"]'), 'NCOS Level was applied');
diag('Go back to NCOS interface');
@ -233,7 +237,7 @@ $d->move_and_click('//*[@id="number_pattern_table"]//tr//td//a[contains(text(),
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag("Check if NCOS Number pattern was deleted");
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS pattern successfully deleted")]'), "Label 'NCOS pattern successfully deleted' was shown");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS pattern successfully deleted", "Correct Alert was shown");
ok($d->find_element_by_css('#number_pattern_table tr > td.dataTables_empty', 'css'), 'NCOS Number pattern was deleted');
diag("Delete LNP Entry");
@ -241,6 +245,7 @@ $d->move_and_click('//*[@id="lnp_carriers_table"]//tr//td//a[contains(text(), "D
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag("Check if LNP Entry was deleted");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS lnp entry successfully deleted", "Correct Alert was shown");
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'LNP Entry was deleted');
diag("Go back to NCOS page");
@ -265,8 +270,8 @@ $d->move_and_click('//*[@id="ncos_level_table"]/tbody/tr[1]/td/div/a[contains(te
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag("Check if Entry was deleted");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS level successfully deleted", "Correct Alert was shown");
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "NCOS level successfully deleted")]'), "Label 'NCOS level successfully deleted' was shown");
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'NCOS was deleted');
diag("Go to Number Porting Page");
@ -291,7 +296,8 @@ diag("Trying to delete LNP carrier");
$d->move_and_click('//*[@id="lnp_carriers_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="lnp_carriers_table_filter"]/label/input');
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag("Check if Entry is still here");
diag("Check if Entry was deleted");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "LNP carrier successfully deleted", "Correct Alert was shown");
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Entry was deleted');

Loading…
Cancel
Save