From 6851262cf2dd9a5843c665b9d101fc6048244e84 Mon Sep 17 00:00:00 2001 From: Nico Schedel Date: Tue, 10 Sep 2019 10:16:45 +0200 Subject: [PATCH] TT#56376 selenium: workaround for customer tests going to wrong menu controller_customer.t: - check if test is currently in wrong menu - if yes, go back to customer details menu manually - if no, continue as usual - also check if customer details section in customer needs to be collapsed or not Change-Id: I17ae6f279cb37d46de86701668f5517b56c8ac3e (cherry picked from commit 9242d9286d05c75f57e120a009d8c00852e73bf4) --- t/selenium/controller_customer.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/t/selenium/controller_customer.t b/t/selenium/controller_customer.t index 8f9901d66a..86d35a6584 100644 --- a/t/selenium/controller_customer.t +++ b/t/selenium/controller_customer.t @@ -127,8 +127,17 @@ $d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains( $d->find_element('#save', 'css')->click(); diag("Check contact details"); -$d->find_element('//div[contains(@class,"accordion-heading")]//a[contains(text(),"Contact Details")]')->click(); is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Contact successfully changed', "Correct Alert was shown"); +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(), "Contact Details")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') { + $d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contact Details")]')->click(); +} ok($d->wait_for_text('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Email")]/../td[2]', $contactmail), "Email is correct"); ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Name")]/../td[contains(text(), "Alice")]'), "Name is correct"); ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Company")]/../td[contains(text(), "Sipwise")]'), "Company is correct");