From 2a96f6ac234a50a6a314899e5f52c0bfa176e092 Mon Sep 17 00:00:00 2001 From: Nico Schedel Date: Thu, 5 Sep 2019 09:18:56 +0200 Subject: [PATCH] TT#56376 selenium: workaround for subscriber tests going to wrong menu controller_subscriber.t: - check if test is currently in wrong menu - if yes, go back to customer subscriber menu manually - if no, continue as usual - also check if subscriber section in customer needs to be collapsed or not Change-Id: I1e505409c10edae08dbb36095bb1dc71fbd52d54 (cherry picked from commit 299ef3967a0b04d29b58bfb49f19503663bf3a24) --- t/selenium/controller_subscriber.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/t/selenium/controller_subscriber.t b/t/selenium/controller_subscriber.t index 3290fff48c..097e567f74 100644 --- a/t/selenium/controller_subscriber.t +++ b/t/selenium/controller_subscriber.t @@ -74,7 +74,16 @@ $d->find_element('//*[@id="save"]')->click(); diag('Trying to find Subscriber'); is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber successfully created", "Correct Alert was shown"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]')->click(); +if($d->find_element_by_xpath('//*[@id="masthead"]/div/div/div/h2')->get_text() eq "Customers"){ #workaround for misbehaving ngcp panel randomly throwing test out of customer details + $d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist'); + ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty'), 'Garbage text was not found'); + $d->fill_element('#Customer_table_filter input', 'css', $customerid); + ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[2]', $customerid), 'Found customer'); + $d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(), "Details")]', 'xpath', '//*[@id="Customer_table_filter"]/label/input'); +} +if($d->find_element_by_xpath('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') { + $d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]')->click(); +} $d->fill_element('//*[@id="subscribers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist'); ok($d->find_element_by_css('#subscribers_table tr > td.dataTables_empty'), 'Table is empty'); $d->fill_element('//*[@id="subscribers_table_filter"]/label/input', 'xpath', $username);