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

controller_profile.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: Ifcbc453a16eed70fac5b82b85419613ea19bb51b
changes/68/32668/1
Nico Schedel 6 years ago
parent d67dd2f078
commit 6c2676c4ea

@ -76,7 +76,7 @@ $d->fill_element('//*[@id="balance_interval.value"]', 'xpath', '300');
$d->find_element('//*[@id="save"]')->click();
diag('Search for Profile Package');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Profile package successfully created', "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Profile package successfully created', "Correct Alert was shown");
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
@ -93,7 +93,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'nice desc');
$d->find_element('//*[@id="save"]')->click();
diag('Search for Profile Package');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Profile package successfully updated', "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Profile package successfully updated', "Correct Alert was shown");
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
@ -124,7 +124,7 @@ diag('Press "Save" without entering anything');
$d->find_element('//*[@id="save"]')->click();
diag('Check Values');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Account balance successfully changed!', "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Account balance successfully changed!', "Correct Alert was shown");
$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click();
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "0.00")]'), "Cash Balance is correct");
@ -138,7 +138,7 @@ $d->fill_element('//*[@id="free_time_balance"]', 'xpath', '50');
$d->find_element('//*[@id="save"]')->click();
diag('Check Values');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Account balance successfully changed!', "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Account balance successfully changed!', "Correct Alert was shown");
$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click();
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "300.00")]'), "Cash Balance is correct");
@ -164,7 +164,7 @@ $d->find_element('//*[@id="packageidtable"]/tbody/tr[1]/td[4]/input')->click();
$d->find_element('//*[@id="save"]')->click();
diag("Check Details");
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Top-up using cash performed successfully!', "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Top-up using cash performed successfully!', "Correct Alert was shown");
$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click();
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "500.00")]'), "Cash Balance is correct");
@ -197,7 +197,7 @@ $d->move_and_click('//*[@id="packages_table"]//tr[1]//td//a[contains(text(), "De
$d->find_element('//*[@id="dataConfirmOK"]')->click();
diag('Check if Profile Package was deleted');
is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Profile package successfully deleted', "Correct Alert was shown");
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Profile package successfully deleted', "Correct Alert was shown");
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Profile Package was deleted');

Loading…
Cancel
Save