From 32c2cff56c45ec35f326db26f996b9a0a3ad5478 Mon Sep 17 00:00:00 2001 From: Nico Schedel Date: Mon, 25 May 2020 11:27:46 +0200 Subject: [PATCH] TT#82258 fix customer creation on pro machines with cloudpbx enabled Some pro machines that are used for running tests have cloudpbx enabled and when trying to create a customer on those it will fail, because it wont select the product at all. this patch will select basic sip account as product if cloudpbx is enabled Change-Id: Ie6a4b5813017b245838b1f1ded875dab4975f52d --- t/lib/Selenium/Collection/Common.pm | 16 +++++++++++----- t/selenium/controller_customer.t | 6 +----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/t/lib/Selenium/Collection/Common.pm b/t/lib/Selenium/Collection/Common.pm index 0f52ff49da..27e0d6181c 100644 --- a/t/lib/Selenium/Collection/Common.pm +++ b/t/lib/Selenium/Collection/Common.pm @@ -3,7 +3,7 @@ package Selenium::Collection::Common; use warnings; use strict; use Moo; - +use TryCatch; use Test::More import => [qw(diag ok is)]; has 'driver' => ( @@ -233,6 +233,16 @@ sub create_customer { $self->driver->find_element('#contactidtable tr > td.dataTables_empty', 'css'); $self->driver->fill_element('#contactidtable_filter input', 'css', $contactmail); $self->driver->select_if_unselected('//table[@id="contactidtable"]/tbody/tr[1]/td//input[@type="checkbox"]'); + try { + $self->driver->set_timeout("implicit", 2_000); + $self->driver->fill_element('#productidtable_filter input', 'css', 'thisshouldnotexist'); + $self->driver->find_element('#productidtable tr > td.dataTables_empty', 'css'); + $self->driver->fill_element('#productidtable_filter input', 'css', 'Basic'); + $self->driver->find_element_by_xpath('//*[@id="productidtable"]//tr[1]//td/input')->click(); + $self->driver->set_timeout("implicit", 10_000); + } catch { + $self->driver->set_timeout("implicit", 10_000); + }; $self->driver->fill_element('#billing_profileidtable_filter input', 'css', 'thisshouldnotexist'); $self->driver->find_element('#billing_profileidtable tr > td.dataTables_empty', 'css'); $self->driver->fill_element('#billing_profileidtable_filter input', 'css', $billingname); @@ -243,10 +253,6 @@ sub create_customer { $self->driver->find_element('//*[@id="status"]/option[contains(text(), "locked")]')->click(); } $self->driver->fill_element('#external_id', 'css', $customerid); - if(index($special, 'pbx') != -1) { - diag("Creating Customer for PBX testing"); - $self->driver->select_if_unselected('//table[@id="productidtable"]/tbody/tr[1]/td[contains(text(),"Basic SIP Account")]/..//input[@type="checkbox"]'); - } $self->driver->find_element('#save', 'css')->click(); ok($self->driver->find_element_by_xpath('//*[@id="content"]//div[contains(text(), "successfully created")]'), 'Correct Alert was shown'); } diff --git a/t/selenium/controller_customer.t b/t/selenium/controller_customer.t index 047869de19..bac99ec48b 100644 --- a/t/selenium/controller_customer.t +++ b/t/selenium/controller_customer.t @@ -35,12 +35,8 @@ $c->create_reseller_contract($contractid); $c->create_reseller($resellername, $contractid); $c->create_contact($contactmail, $resellername); $c->create_billing_profile($billingname, $resellername); +$c->create_customer($customerid, $contactmail, $billingname, 'locked'); -if($pbx == 1){ - $c->create_customer($customerid, $contactmail, $billingname, 'pbx locked'); -} else { - $c->create_customer($customerid, $contactmail, $billingname, 'locked'); -} diag("Try to create an empty Customer"); $d->find_element('Create Customer', 'link_text')->click();