TT#78161 selenium: fix search calls to work better with search field caching

controller_billing.t, controller_profileset.t, controller_timeset.t:
- search field caching caused some problems, where elements would not show
up because cached search would not find elements which the names got updated

Change-Id: I11ae4dca9c07a720f2d491878402cd36650b015d
changes/58/38658/3
Nico Schedel 5 years ago
parent 433fcf5726
commit 309356249b

@ -346,6 +346,9 @@ $d->fill_element('#end', 'css', "2019-01-01 23:59:59");
$d->find_element('#save', 'css')->click();
diag("Check if Date Definition is correct");
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#date_definition_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', '2018-01-01 00:00:00');
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully updated', 'Correct Alert was shown');
ok($d->find_element_by_xpath('//*[@id="date_definition_table"]//tr[1]/td[contains(text(), "2018-01-01 00:00:00")]'), 'Start Date Definition is correct');
ok($d->find_element_by_xpath('//*[@id="date_definition_table"]//tr[1]/td[contains(text(), "2019-01-01 23:59:59")]'), 'End Date Definition is correct');

@ -6,6 +6,7 @@ use Test::More import => [qw(done_testing is ok diag todo_skip)];
use Selenium::Remote::Driver::FirefoxExtensions;
use Selenium::Collection::Common;
use Selenium::Collection::Functions;
use Selenium::Remote::WDKeys;
my ($port) = @_;
my $d = Selenium::Collection::Functions::create_driver($port);
@ -108,7 +109,7 @@ $d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpat
ok($d->find_element_by_css('#subscriber_profile_table tr > td.dataTables_empty'), 'Table is empty');
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', $profilename);
diag("Check profile details");
diag("Check Profile details");
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "This is a description. It describes things")]'), 'Description is correct');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]', $setname), 'Profile Set is correct');
@ -121,7 +122,12 @@ $d->fill_element('//*[@id="name"]', 'xpath', $profilename);
$d->fill_element('//*[@id="description"]', 'xpath', 'Very very useful description');
$d->find_element('//*[@id="save"]')->click();
diag("Check profile details");
diag("Search Profile");
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#subscriber_profile_table tr > td.dataTables_empty'), 'Table is empty');
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', $profilename);
diag("Check Profile details");
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "Very very useful description")]'), 'Description is correct');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]', $setname), 'Profile Set is correct');
@ -168,6 +174,8 @@ $d->select_if_unselected('//*[@id="set_default"]', 'xpath');
$d->find_element('//*[@id="save"]')->click();
diag("Check if cloned Profile is now default");
$d->find_element_by_xpath('//*[@id="subscriber_profile_table_filter"]/label/input')->clear();
$d->find_element_by_xpath('//*[@id="subscriber_profile_table_filter"]/label/input')->send_keys(KEYS->{'return'});
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Subscriber profile successfully updated", 'Correct Alert was shown');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr/td[contains(text(), "' . $cloneprofilename . '")]//..//td[contains(text(), "1")]'), 'Cloned Profile is now default');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr/td[contains(text(), "' . $profilename . '")]//..//td[contains(text(), "0")]'), 'Original Profile is no longer default');

@ -129,6 +129,12 @@ $d->unselect_if_selected('//*[@id="byday.weekdays.4"]');
$d->fill_element('//*[@id="byday.weekdaynumber"]', 'xpath', '+2FR');
$d->find_element('//*[@id="save"]')->click();
diag("Search Event");
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Event entry successfully created', 'Correct Alert was shown');
$d->fill_element('//*[@id="event_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#event_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="event_table_filter"]/label/input', 'xpath', 'Very important event');
diag("Check details");
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Event entry successfully created', 'Correct Alert was shown');
ok($d->find_element_by_xpath('//*[@id="event_table"]//tr[1]/td[contains(text(), "Very important event")]'), "Description is correct");

Loading…
Cancel
Save