TT#46791 Fix floating bug with 'Edit' problem on 'Weekdays' page

It was old floating issue which randomly failed the test and
jenkins job ngcp-panel-test-selenium-docker became often yellow.
The problem here was in two facts:
 - 'Edit' button available with mouseover only
 - there is AJAX on this page for filtering 'Dates' records.
Historically we have no ability to wait for all AJAX loadings.

When Selenium moved mouse over Edit column to press it,
AJAX can be finished and removed "Processing..." label
from "Dates" field. It cause loosing mouseover from "Edit"
button and button is hidden causing "element not interactable":
> # Click 'Edit' button for element 'Wednesday'
> Can't use string ("element not interactable") as a HASH ref while "strict refs" in use at /home/selenium/Selenium-Remote-Driver/lib/Selenium/Remote/Driver.pm line 684.
>  at /home/selenium/Selenium-Remote-Driver/lib/Selenium/Remote/Driver.pm line 655.
> # Tests were run but no plan was declared and done_testing() was not seen.
> # Looks like your test exited with 255 just after 27.

It has been workarounded here as we cannot wait for AJAX.
We are creating fake query for "Dates" (searching "thisshouldnotexist")
and waiting until the table "Dates" has no search results records.
It means AJAX has finished and we can continue with the test.

Also here I have renamed confusing button from 'edit' to 'delete',
as we press delete. And we have to clean previous search 'thisshouldnotexist'
with proper '2008-02-28' which we want to delete.

Change-Id: I55af32991687e82c3e57b15c066e772ff0b77123
changes/21/26121/1
Alexander Lutay 7 years ago
parent c111d1e3ce
commit a9399b1efd

@ -128,9 +128,18 @@ $edit_link->click();
ok($d->find_element('//*[@id="masthead"]//h2[contains(text(),"times for mytestprofile")]'));
diag("Edit Wednesday");
diag("Creating one 'Dates' record to be able search it later to wait for AJAX");
$d->find_element('Create Special Off-Peak Date', 'link_text')->click();
$d->fill_element('#start', 'css', "2018-01-01 11:11:11");
$d->fill_element('#end', 'css', "2018-01-01 12:12:12");
$d->find_element('#save', 'css')->click();
$d->find_text("Special offpeak entry successfully created");
diag("Wait for 'Dates' AXAJ is finished, otherwise it might hide 'Edit' popup button");
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', 'thisshouldnotexist');
$d->find_element('#date_definition_table tr > td.dataTables_empty', 'css');
diag("Move mouse over 'Weekdays' row to make 'Edit' button available");
$row = $d->find_element('//table//td[contains(text(),"Wednesday")]');
ok($row);
diag("Move mouse over 'Weekdays' row to make 'Edit' button available");
$d->move_action(element => ($d->find_element('//h3[contains(text(),"Weekdays")]')));
sleep 2 if ($d->browser_name_in("htmlunit"));
$d->move_action(element => $row);
@ -159,15 +168,16 @@ $d->fill_element('#end', 'css', "2008-02-28 13:37:00");
$d->find_element('#save', 'css')->click();
diag("Find/delete my created date definition");
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', '2008-02-28');
$elem = $d->find_element('//div[contains(@class,"dataTables_wrapper")]');
$d->scroll_to_element($elem);
$row = $d->find_element('//div[contains(@class,"dataTables_wrapper")]//td[contains(text(),"2008-02-28")]/..');
ok($row);
$d->move_action(element => $row);
$edit_link = $d->find_child_element($row, './/a[contains(@class,"btn-secondary")]');
ok($edit_link);
my $delete_button = $d->find_child_element($row, './/a[contains(@class,"btn-secondary")]');
ok($delete_button);
sleep 2 if ($browsername eq "htmlunit");
$edit_link->click();
$delete_button->click();
$d->find_text("Are you sure?");
$d->find_element('#dataConfirmOK', 'css')->click();

Loading…
Cancel
Save