TT#56376 Add check for adding subscriber + cleanups

controller_customer.t:
- cleaned up some ok statements to see what acutally is going on.
- Added check for adding subscribers to a customer

Change-Id: I49a8f8e671472a7875ccc6d84d1fae50691a62ae
changes/25/28725/3
Nico Schedel 7 years ago
parent e08d2369d7
commit 3a9e1fb64f

@ -27,24 +27,28 @@ $d->find_element("Customers", 'link_text')->click();
diag("Create a Customer");
$d->find_element('//*[@id="masthead"]//h2[contains(text(),"Customers")]');
$d->find_element('Create Customer', 'link_text')->click();
diag(" - fill contact data");
diag("Fill contact data");
$d->fill_element('#contactidtable_filter input', 'css', 'thisshouldnotexist');
$d->find_element('#contactidtable tr > td.dataTables_empty', 'css');
$d->fill_element('#contactidtable_filter input', 'css', 'default-customer');
$d->select_if_unselected('//table[@id="contactidtable"]/tbody/tr[1]/td[contains(text(),"default-customer")]/..//input[@type="checkbox"]');
diag(" - fill billing data");
diag("Fill billing data");
$d->fill_element('#billing_profileidtable_filter input', 'css', 'thisshouldnotexist');
$d->find_element('#billing_profileidtable tr > td.dataTables_empty', 'css');
$d->fill_element('#billing_profileidtable_filter input', 'css', 'Default Billing Profile');
$d->select_if_unselected('//table[@id="billing_profileidtable"]/tbody/tr[1]/td[contains(text(),"Default Billing Profile")]/..//input[@type="checkbox"]');
diag(" - fill product data");
diag("Fill product data");
eval { #lets only try this
$d->select_if_unselected('//table[@id="productidtable"]/tbody/tr[1]/td[contains(text(),"Basic SIP Account")]/..//input[@type="checkbox"]');
};
diag(" - fill external_id");
diag("Fill external_id");
$d->scroll_to_id('external_id');
$d->fill_element('#external_id', 'css', $rnd_id);
diag(" - save");
diag("Save");
$d->find_element('#save', 'css')->click();
diag("Open Details for our just created Customer");
@ -53,9 +57,9 @@ $d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
$d->find_element('#Customer_table tr > td.dataTables_empty', 'css');
$d->fill_element('#Customer_table_filter input', 'css', $rnd_id);
my $row = $d->find_element('(//table/tbody/tr/td[contains(text(), "'.$rnd_id.'")]/..)[1]');
ok($row);
ok($row, 'Searching for current customer works');
my $edit_link = $d->find_child_element($row, '(./td//a)[contains(text(),"Details")]');
ok($edit_link);
ok($edit_link, 'Can click on Details');
$d->move_action(element => $row);
$edit_link->click();
@ -64,24 +68,57 @@ $d->find_element('//div[contains(@class,"accordion-heading")]//a[contains(text()
$d->find_element('//div[contains(@class,"accordion-body")]//*[contains(@class,"btn-primary") and contains(text(),"Edit Contact")]')->click();
$d->fill_element('div.modal #firstname', 'css', "Alice");
$d->fill_element('#company', 'css', 'Sipwise');
ok($d, 'Inserting name works');
# Choosing Country:
$d->fill_element('#countryidtable_filter input', 'css', 'thisshouldnotexist');
$d->find_element('#countryidtable tr > td.dataTables_empty', 'css');
$d->fill_element('#countryidtable_filter input', 'css', 'Ukraine');
$d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains(text(),"Ukraine")]/..//input[@type="checkbox"]');
ok($d, 'Successfuly added a Country');
# Save
$d->find_element('#save', 'css')->click();
diag("Check if successful");
$d->find_element('//div[contains(@class,"accordion-body")]//table//td[contains(text(),"Sipwise")]');
diag("Trying to add a subscriber");
$d->find_element('//*[@id="customer_details"]/div[4]/div[1]/a')->click();
$d->find_element('//*[@id="collapse_subs"]/div/a')->click();
diag('Enter necessary information');
$d->find_element('//*[@id="domainidtable_filter"]/label/input')->clear();
$d->find_element('//*[@id="domainidtable_filter"]/label/input')->send_keys('thisshouldnotexist');
$d->find_element('//*[@id="domainidtable"]/tbody/tr/td[contains(text(), "No matching records found")]');
$d->find_element('//*[@id="domainidtable_filter"]/label/input')->clear();
$d->find_element('//*[@id="domainidtable_filter"]/label/input')->send_keys('default');
$d->find_element('//*[@id="domainidtable"]/tbody/tr[1]/td[4]/input')->click();
$d->find_element('//*[@id="e164.cc"]')->send_keys('43');
$d->find_element('//*[@id="e164.ac"]')->send_keys('99');
$d->find_element('//*[@id="e164.sn"]')->send_keys(int(rand(99999999)));
my $emailstring = ("test" . int(rand(10000)) . "\@example.org");
$d->find_element('//*[@id="email"]')->send_keys($emailstring);
my $username = ('demo' . int(rand(1000)));
$d->find_element('//*[@id="webusername"]')->send_keys($username);
$d->find_element('//*[@id="webpassword"]')->send_keys('testing1234'); #workaround for misclicking on ok button
$d->find_element('//*[@id="gen_password"]')->click();
$d->find_element('//*[@id="username"]')->send_keys($username);
$d->find_element('//*[@id="password"]')->send_keys('testing1234'); #using normal pwd, cant easily seperate both generate buttons
$d->find_element('//*[@id="save"]')->click();
diag("Trying to find subscriber");
$d->find_element('//*[@id="subscribers_table_filter"]/label/input')->send_keys($username);
sleep(1) until $d->find_element('//*[@id="subscribers_table"]/tbody/tr/td[2]')->get_text() ~~ $username;
my $userfromtable = $d->get_text('//*[@id="subscribers_table"]/tbody/tr/td[2]');
is($userfromtable, $username, "Subscriber was found");
diag("Edit Fraud Limits");
my $elem = $d->find_element('//div[contains(@class,"accordion-heading")]//a[contains(text(),"Fraud Limits")]');
$d->scroll_to_element($elem);
$elem->click();
sleep 4 if ($d->browser_name_in("phantomjs", "chrome")); # time to move
$row = $d->find_element('//div[contains(@class,"accordion-body")]//table//tr/td[contains(text(),"Monthly Settings")]');
ok($row);
ok($row, 'Changed monthly settings');
$edit_link = $d->find_child_element($row, './../td//a[text()[contains(.,"Edit")]]');
ok($edit_link);
$d->move_action(element => $row);
@ -99,9 +136,9 @@ $d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
$d->find_element('#Customer_table tr > td.dataTables_empty', 'css');
$d->fill_element('#Customer_table_filter input', 'css', $rnd_id);
$row = $d->find_element('(//table/tbody/tr/td[contains(text(), "'.$rnd_id.'")]/..)[1]');
ok($row);
ok($row, 'Found customer');
$edit_link = $d->find_child_element($row, '(./td//a)[contains(text(),"Terminate")]');
ok($edit_link);
ok($edit_link, 'Found terminate button');
$d->move_action(element => $row);
$edit_link->click();
$d->find_text("Are you sure?");

Loading…
Cancel
Save