TT#56376 selenium: changes for create_customer()

Common.pm:
- create_customer() now requires a contact and billing profile
- will enable tests for invoices

controller_customer and controller_subscriber have been changed to use
create_customer() correctly

Change-Id: Icde5caf82205537f24dd2c6c6c1ee7476583e049
changes/40/30540/2
Nico Schedel 6 years ago
parent 22ab442c06
commit 41e53f6d44

@ -204,8 +204,8 @@ sub delete_rw_ruleset {
}
sub create_customer {
my($self, $customerid, $pbx) = @_;
return unless $customerid;
my($self, $customerid, $contactmail, $billingname, $pbx) = @_;
return unless $customerid && $contactmail && $billingname;
diag("Go to Customers page");
$self->driver->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
@ -216,12 +216,12 @@ sub create_customer {
$self->driver->find_element('Create Customer', 'link_text')->click();
$self->driver->fill_element('#contactidtable_filter input', 'css', 'thisshouldnotexist');
$self->driver->find_element('#contactidtable tr > td.dataTables_empty', 'css');
$self->driver->fill_element('#contactidtable_filter input', 'css', 'default-customer');
$self->driver->select_if_unselected('//table[@id="contactidtable"]/tbody/tr[1]/td[contains(text(),"default-customer")]/..//input[@type="checkbox"]');
$self->driver->fill_element('#contactidtable_filter input', 'css', $contactmail);
$self->driver->select_if_unselected('//table[@id="contactidtable"]/tbody/tr[1]/td//input[@type="checkbox"]');
$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', 'Default Billing Profile');
$self->driver->select_if_unselected('//table[@id="billing_profileidtable"]/tbody/tr[1]/td[contains(text(),"Default Billing Profile")]/..//input[@type="checkbox"]');
$self->driver->fill_element('#billing_profileidtable_filter input', 'css', $billingname);
$self->driver->select_if_unselected('//table[@id="billing_profileidtable"]/tbody/tr[1]/td//input[@type="checkbox"]');
$self->driver->scroll_to_id('external_id');
$self->driver->fill_element('#external_id', 'css', $customerid);
if($pbx) {

@ -16,6 +16,10 @@ sub ctr_customer {
my $pbx = $ENV{PBX};
my $customerid = ("id" . int(rand(100000)) . "ok");
my $resellername = ("reseller" . int(rand(100000)) . "test");
my $contractid = ("contract" . int(rand(100000)) . "test");
my $contactmail = ("contact" . int(rand(100000)) . '@test.org');
my $billingname = ("billing" . int(rand(100000)) . "test");
if(!$pbx){
print "---PBX check is DISABLED---\n";
@ -25,11 +29,15 @@ sub ctr_customer {
};
$c->login_ok();
$c->create_reseller_contract($contractid);
$c->create_reseller($resellername, $contractid);
$c->create_contact($contactmail, $resellername);
$c->create_billing_profile($billingname, $resellername);
if($pbx == 1){
$c->create_customer($customerid, 1);
$c->create_customer($customerid, $contactmail, $billingname, 1);
} else {
$c->create_customer($customerid);
$c->create_customer($customerid, $contactmail, $billingname);
}
diag("Search for Customer");
@ -40,9 +48,9 @@ sub ctr_customer {
diag("Check customer details");
ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer ID is correct');
ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "default")]'), 'Reseller is correct');
ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "default-customer")]', 'default-customer@default.invalid'), 'Contact Email is correct');
ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "Default Billing Profile")]'), 'Billing Profile is correct');
ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[4]', $contactmail), 'Contact Email is correct');
ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile is correct');
diag("Open Details for our just created Customer");
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
@ -63,7 +71,7 @@ sub ctr_customer {
$d->find_element('#save', 'css')->click(); # Save
diag("Check contact details");
ok($d->wait_for_text('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Email")]/../td[2]', 'default-customer@default.invalid'), "Email is correct");
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");
ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Address")]/../td[text()[contains(.,"03141")]]'), "Postal code is correct");
@ -133,6 +141,12 @@ sub ctr_customer {
$c->delete_customer($customerid, 0);
$d->fill_element('//*[@id="Customer_table_filter"]/label/input', 'xpath', $customerid);
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Customer was deleted');
$c->delete_reseller_contract($contractid);
$c->delete_reseller($resellername);
$c->delete_contact($contactmail);
$c->delete_billing_profile($billingname);
}
if(! caller) {

@ -23,10 +23,18 @@ sub ctr_subscriber {
my $sourcename = ("test" . int(10000) . "source");
my $setname = ("test" . int(rand(10000)) . "set");
my $profilename = ("test" . int(rand(10000)) . "profile");
my $contactmail = ("contact" . int(rand(100000)) . '@test.org');
my $resellername = ("reseller" . int(rand(100000)) . "test");
my $contractid = ("contract" . int(rand(100000)) . "test");
my $billingname = ("billing" . int(rand(100000)) . "test");
$c->login_ok();
$c->create_domain($domainstring);
$c->create_customer($customerid);
$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);
diag("Open Details for our just created Customer");
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
@ -73,8 +81,8 @@ sub ctr_subscriber {
diag('Enter profile set information');
$d->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#reselleridtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
$d->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', 'default');
ok($d->wait_for_text('//*[@id="reselleridtable"]/tbody/tr[1]/td[2]', 'default'), "Reseller found");
$d->fill_element('//*[@id="reselleridtable_filter"]/label/input', 'xpath', $resellername);
ok($d->wait_for_text('//*[@id="reselleridtable"]/tbody/tr[1]/td[2]', $resellername), "Reseller found");
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
$d->fill_element('//*[@id="name"]', 'xpath', $setname);
$d->fill_element('//*[@id="description"]', 'xpath', 'This is a description. It describes things');
@ -88,7 +96,7 @@ sub ctr_subscriber {
diag('Check details');
ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $setname), 'Name is correct');
ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[4]', 'This is a description. It describes things'), 'Description is correct');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//td[contains(text(), "default")]'), 'Reseller is correct');
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//td[contains(text(), "' . $resellername .'")]'), 'Reseller is correct');
diag('Enter "Profiles" menu');
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Profiles")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
@ -121,7 +129,7 @@ sub ctr_subscriber {
$d->fill_element('//*[@id="subscriber_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
ok($d->find_element_by_css('#subscriber_table tr > td.dataTables_empty'), 'Table is empty');
$d->fill_element('//*[@id="subscriber_table_filter"]/label/input', 'xpath', $username);
ok($d->wait_for_text('//*[@id="subscriber_table"]/tbody/tr/td[3]', 'default-customer@default.invalid'), 'Contact Email is correct');
ok($d->wait_for_text('//*[@id="subscriber_table"]/tbody/tr/td[3]', $contactmail), 'Contact Email is correct');
ok($d->wait_for_text('//*[@id="subscriber_table"]/tbody/tr/td[4]', $username), 'Subscriber name is correct');
ok($d->wait_for_text('//*[@id="subscriber_table"]/tbody/tr/td[5]', $domainstring), 'Domain name is correct');
@ -309,7 +317,12 @@ sub ctr_subscriber {
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
$c->delete_customer($customerid);
$c->delete_reseller_contract($contractid);
$c->delete_reseller($resellername);
$c->delete_contact($contactmail);
$c->delete_billing_profile($billingname);
$c->delete_domain($domainstring);
}
if(! caller) {

Loading…
Cancel
Save