TT#56376 selenium: ctr_other: prevent missing alert from crashing script

controller_other.t:
- sometimes, alerts wont get displayed in this test, which causes the script
to crash completley. it will now print a error message instead of crashing
the entire test

Change-Id: I84c7fa4d616eac9c071776d5d37235383d248a9e
(cherry picked from commit 34be39837e)
changes/01/32801/1
Nico Schedel 6 years ago
parent 01be7ca298
commit e7a9b29710

@ -45,7 +45,7 @@ $d->fill_element('//*[@id="label"]', 'xpath', 'label');
$d->find_element('//*[@id="save"]')->click();
diag('Search Call list suppression');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Call list suppression successfully created", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Call list suppression successfully created", "Correct Alert was shown");
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#call_list_suppression_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', $domainstring);
@ -67,7 +67,7 @@ $d->fill_element('//*[@id="label"]', 'xpath', 'text');
$d->find_element('//*[@id="save"]')->click();
diag('Search Call list suppression');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Call list suppression successfully updated", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Call list suppression successfully updated", "Correct Alert was shown");
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#call_list_suppression_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', $domainstring);
@ -94,7 +94,7 @@ $d->move_and_click('//*[@id="call_list_suppression_table"]//tr[1]//td//a[contain
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag('Check if Call list suppression was deleted');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Call list suppression successfully deleted", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Call list suppression successfully deleted", "Correct Alert was shown");
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', $domainstring);
ok($d->find_element_by_css('#call_list_suppression_table tr > td.dataTables_empty', 'css'), 'Call list suppression has been deleted');
@ -123,7 +123,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '0123456789');
$d->find_element('//*[@id="save"]')->click();
diag('Search for Phonebook entry');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Phonebook entry successfully created", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Phonebook entry successfully created", "Correct Alert was shown");
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
@ -142,7 +142,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '9876543210');
$d->find_element('//*[@id="save"]')->click();
diag('Search for Phonebook entry');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Phonebook entry successfully updated", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Phonebook entry successfully updated", "Correct Alert was shown");
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
@ -167,7 +167,7 @@ $d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "D
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag('Check if Phonebook entry has been deleted');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Phonebook entry successfully deleted", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Phonebook entry successfully deleted", "Correct Alert was shown");
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Phonebook entry has been deleted');
@ -197,7 +197,7 @@ $d->fill_element('//*[@id="email"]', 'xpath', $contactmail);
$d->find_element('//*[@id="save"]')->click();
diag('Search Contact');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully created", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully created", "Correct Alert was shown");
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
@ -228,7 +228,7 @@ $d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains(
$d->find_element('//*[@id="save"]')->click();
diag('Search Contact');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully changed", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully changed", "Correct Alert was shown");
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
@ -255,7 +255,7 @@ $d->move_and_click('//*[@id="contact_table"]//tr[1]//td//a[contains(text(), "Del
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag('Check if Contact was deleted');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully deleted", "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully deleted", "Correct Alert was shown");
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Contact has been deleted');

Loading…
Cancel
Save