- rewrite tests in python rather than perl - support tests with firefox and chrome. chrome tests arent enabled yet. browser can be chosen on launch with "firefox", "chrome" or "all" Change-Id: I8bdd616fd0e0127939bff18364efe15e2f02fe31mr9.5.1
parent
1db7f4d13a
commit
72beda0138
@ -1,47 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is diag ok)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use TryCatch;
|
||||
|
||||
sub admin_login {
|
||||
my ($port) = @_;
|
||||
$port = '4444' unless $port;
|
||||
|
||||
my $browsername = $ENV{BROWSER_NAME} || "firefox"; # possible values: firefox, htmlunit, chrome
|
||||
|
||||
my $d = Selenium::Remote::Driver::FirefoxExtensions->new(
|
||||
browser_name => $browsername,
|
||||
extra_capabilities => {
|
||||
acceptInsecureCerts => \1,
|
||||
},
|
||||
port => $port
|
||||
);
|
||||
try {
|
||||
my $login = 'administrator';
|
||||
my $pwd = 'administrator';
|
||||
my $uri = $ENV{CATALYST_SERVER} || 'http://localhost:3000';
|
||||
$d->get("$uri/logout");
|
||||
$d->get("$uri/login");
|
||||
$d->find_element('#username', 'css')->send_keys($login);
|
||||
$d->find_element('#password', 'css')->send_keys($pwd);
|
||||
$d->find_element('#submit', 'css')->click();
|
||||
$d->quit();
|
||||
return 1;
|
||||
}
|
||||
catch {
|
||||
$d->quit();
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
if(! caller) {
|
||||
admin_login();
|
||||
done_testing;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@ -1,278 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $uri = $ENV{CATALYST_SERVER} || 'http://localhost:3000';
|
||||
my $adminname = ("admin" . int(rand(100000)) . "test");
|
||||
my $adminpwd = ("pwd" . int(rand(100000)) . "test");
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
|
||||
diag("Go to 'Administrators' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Administrators', 'link_text')->click();
|
||||
|
||||
diag("Try to create a new Administrator");
|
||||
$d->find_element('Create Administrator', 'link_text')->click();
|
||||
|
||||
diag("Save without entering anything");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Administrator")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Login field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Please enter a password in this field")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->fill_element('//*[@id="login"]', 'xpath', $adminname);
|
||||
$d->fill_element('//*[@id="password"]', 'xpath', $adminpwd);
|
||||
$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]'));
|
||||
$d->unselect_if_selected('//*[@id="show_passwords"]');
|
||||
$d->unselect_if_selected('//*[@id="call_data"]');
|
||||
$d->unselect_if_selected('//*[@id="billing_data"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Administrator");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
|
||||
diag("Check Administrator details");
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[8][contains(text(), "0")]'), 'Read-Only value is correct');
|
||||
|
||||
diag("Edit Administrator details. Enable read-only setting");
|
||||
$adminname = ("admin" . int(rand(100000)) . "test");
|
||||
$d->move_and_click('//*[@id="administrator_table"]//tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Administrator")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="login"]', 'xpath', $adminname);
|
||||
$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]'));
|
||||
$d->select_if_unselected('//*[@id="read_only"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Administrator details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[7][contains(text(), "1")]'), 'Read-Only value is correct');
|
||||
|
||||
diag("Try to log in new Administrator without any credentials");
|
||||
$d->get("$uri/logout");
|
||||
$d->get("$uri/login");
|
||||
ok($d->find_element('/html/body//div//h1[contains(text(), "Admin Sign In")]'), "Text 'Admin Sign In' found");
|
||||
is($d->get_title, '', 'No Tab Title was set');
|
||||
$d->fill_element('#username', 'css', "");
|
||||
$d->fill_element('#password', 'css', "");
|
||||
$d->find_element('#submit', 'css')->click();
|
||||
ok($d->find_element('/html/body//div//h1[contains(text(), "Admin Sign In")]'), "Text 'Admin Sign In' found");
|
||||
ok($d->find_element('//form//div/span'), "Error Message was shown");
|
||||
|
||||
diag("Try to log in new Administrator with invalid credentials");
|
||||
ok($c->login_ok("invalid", "creds", 1), "Login failed as intended");
|
||||
|
||||
diag("Try to log in new Administrator with invalid password");
|
||||
ok($c->login_ok($adminname, "invalidpass", 1), "Login failed as intended");
|
||||
|
||||
diag("Try to log in new Administrator with no password");
|
||||
$d->get("$uri/logout");
|
||||
$d->get("$uri/login");
|
||||
ok($d->find_element('/html/body//div//h1[contains(text(), "Admin Sign In")]'), "Text 'Admin Sign In' found");
|
||||
is($d->get_title, '', 'No Tab Title was set');
|
||||
$d->fill_element('#username', 'css', $adminname);
|
||||
$d->fill_element('#password', 'css', "");
|
||||
$d->find_element('#submit', 'css')->click();
|
||||
ok($d->find_element('/html/body//div//h1[contains(text(), "Admin Sign In")]'), "Text 'Admin Sign In' found");
|
||||
ok($d->find_element('//form//div/span'), "Error Message was shown");
|
||||
|
||||
diag("Try to log in new Administrator for real this time");
|
||||
$c->login_ok($adminname, $adminpwd);
|
||||
|
||||
diag("Go to 'Administrators' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Administrators', 'link_text')->click();
|
||||
|
||||
diag("Check if only your Administrator is shown");
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), '. $adminname .')]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), '. $resellername .')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[6][contains(text(), "1")]'), 'Read-Only value is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table_info"][contains(text(), "Showing 1 to 1 of 1 entries")]'), 'Only 1 entry exists');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'administrator');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Administrator table is empty');
|
||||
|
||||
diag("Go to 'Customers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Customers', 'link_text')->click();
|
||||
|
||||
diag("Check if table is empty");
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Customer table is empty');
|
||||
|
||||
diag("Go to 'Domains' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Domains', 'link_text')->click();
|
||||
|
||||
diag("Check if table is empty");
|
||||
ok($d->find_element_by_css('#Domain_table tr > td.dataTables_empty', 'css'), 'Domain table is empty');
|
||||
|
||||
diag("Switch over to default Administrator");
|
||||
$c->login_ok();
|
||||
|
||||
diag("Go to 'Administrators' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Administrators', 'link_text')->click();
|
||||
|
||||
diag("Edit Administrator permissions. Make Administrator inactive");
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname .'")]'), 'Administrator found');
|
||||
$d->move_and_click('//*[@id="administrator_table"]//tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Administrator")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]'));
|
||||
$d->find_element('//*[@id="is_active"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Administrator details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[7][contains(text(), "0")]'), 'Active value is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[8][contains(text(), "1")]'), 'Read-Only value is correct');
|
||||
|
||||
diag("Do deactivated Administrator login");
|
||||
$d->get("$uri/logout");
|
||||
$d->get("$uri/login");
|
||||
$d->fill_element('#username', 'css', $adminname);
|
||||
$d->fill_element('#password', 'css', $adminpwd);
|
||||
$d->find_element('#submit', 'css')->click();
|
||||
ok($d->find_element_by_xpath('/html/body//div//span[contains(text(), "Invalid username/password")]'), 'Login failed as intended');
|
||||
|
||||
diag("Switch over to default Administrator");
|
||||
$c->login_ok();
|
||||
|
||||
diag("Go to 'Administrators' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Administrators', 'link_text')->click();
|
||||
|
||||
diag("Give new Administrator default permissions");
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Administrator found');
|
||||
$d->move_and_click('//*[@id="administrator_table"]/tbody/tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Administrator")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="is_superuser"]'));
|
||||
$d->select_if_unselected('//*[@id="is_superuser"]');
|
||||
$d->select_if_unselected('//*[@id="is_master"]');
|
||||
$d->select_if_unselected('//*[@id="is_active"]');
|
||||
$d->unselect_if_selected('//*[@id="read_only"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Administrator details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[5][contains(text(), "1")]'), 'Master value is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[7][contains(text(), "1")]'), 'Active value is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[8][contains(text(), "0")]'), 'Read-Only value is correct');
|
||||
|
||||
diag("Log in new Administrator");
|
||||
$c->login_ok($adminname, $adminpwd);
|
||||
|
||||
diag("Go to 'Administrators' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Administrators', 'link_text')->click();
|
||||
|
||||
diag("Check if Administrator is still here");
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Administrator is still here');
|
||||
|
||||
diag("Switch over to default Administrator");
|
||||
$c->login_ok();
|
||||
|
||||
diag("Go to 'Administrators' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Administrators', 'link_text')->click();
|
||||
|
||||
diag("See if invalid 'lawful_intercept' setting gets rejected");
|
||||
$d->select_if_unselected('//*[@id="lawful_intercept"]');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Administrator found');
|
||||
$d->move_and_click('//*[@id="administrator_table"]/tbody/tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Administrator")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="lawful_intercept"]');
|
||||
$d->select_if_unselected('//*[@id="can_reset_password"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
ok($d->find_element_by_xpath('//form//div[@class="control-group error"]//span[@class="help-inline"]'), 'Error message was shown');
|
||||
$d->unselect_if_selected('//*[@id="lawful_intercept"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully updated', 'Correct Alert was shown');
|
||||
|
||||
diag("Try to NOT delete Administrator");
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Administrator found');
|
||||
$d->move_and_click('//*[@id="administrator_table"]/tbody/tr[1]/td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Administrator is still here");
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_xpath('//*[@id="administrator_table"]//tr[1]/td[contains(text(), "' . $adminname . '")]'), 'Administrator is still here');
|
||||
|
||||
diag("Try to delete Administrator");
|
||||
$d->move_and_click('//*[@id="administrator_table"]/tbody/tr[1]/td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="administrator_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Administrator has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="administrator_table_filter"]/label/input', 'xpath', $adminname);
|
||||
ok($d->find_element_by_css('#administrator_table tr > td.dataTables_empty', 'css'), 'Administrator has been deleted');
|
||||
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_admin.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,487 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $billingname = ("billing" . int(rand(100000)) . "test");
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $billingnetwork = ("billing" . int(rand(100000)) . "network");
|
||||
my $zonename = ("billing" . int(rand(100000)) . "zone");
|
||||
my $zonedetailname = ("zone" . int(rand(100000)) . "detail");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_billing_profile($billingname, $resellername);
|
||||
|
||||
diag("Try to create an empty Billing Profile");
|
||||
$d->find_element('Create Billing Profile', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Billing Profile")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Handle field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Search Billing Profile");
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $billingname);
|
||||
|
||||
diag("Check if values are correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]/tbody/tr/td[2][contains(text(), "' . $billingname . '")]'), 'Billing name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]/tbody/tr/td[3][contains(text(), "' . $resellername . '")]'), 'Reseller name is correct');
|
||||
|
||||
diag("Edit Billing Profile");
|
||||
$billingname = ("billing" . int(rand(100000)) . "test");
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]/tbody/tr[1]//td//div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Billing Profile")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#name', 'css', $billingname);
|
||||
$d->select_if_unselected('//*[@id="prepaid"]');
|
||||
$d->fill_element('#interval_charge', 'css', '3.2');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if values are correct");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing profile successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $billingname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]//td/input[@checked="checked"]'), 'Prepaid setting is correct');
|
||||
|
||||
diag("Open 'Fees' page");
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]/tbody/tr[1]//td//div//a[contains(text(), "Fees")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
|
||||
diag("Go to 'Billing Zones' page");
|
||||
$d->find_element('Edit Zones', 'link_text')->click();
|
||||
|
||||
diag("Create a Billing Zone");
|
||||
$d->find_element('Create', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Billing Zone")]'), 'Edit window has been opened');
|
||||
|
||||
diag("Save without entering anything");
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Zone field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="zone"]', 'xpath', $zonename);
|
||||
$d->fill_element('//*[@id="detail"]', 'xpath', $zonedetailname);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Zone successfully created', 'Correct Alert was shown');
|
||||
|
||||
diag("Check Billing Zone details");
|
||||
$d->fill_element('//*[@id="billing_zone_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_zone_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_zone_table_filter"]/label/input', 'xpath', $zonename);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_zone_table"]//tr[1]/td[contains(text(), "' . $zonename .'")]'), 'Billing Zone name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_zone_table"]//tr[1]/td[contains(text(), "' . $zonedetailname . '")]'), 'Billing Zone detail is correct');
|
||||
|
||||
diag("Go back to Billing Fees page");
|
||||
$d->find_element('Back', 'link_text')->click();
|
||||
|
||||
diag("Create a Billing Fee");
|
||||
$d->find_element('Create Fee Entry', 'link_text')->click();
|
||||
|
||||
diag("Save without entering anything");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Billing Fee")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="billing_zoneidtable"]//tr[1]/td[4]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Zone field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Destination field is required")]'));
|
||||
|
||||
diag("Fill in invalid values");
|
||||
$d->fill_element('#source', 'css', '.*');
|
||||
$d->fill_element('#destination', 'css', '.+');
|
||||
$d->fill_element('//*[@id="onpeak_init_rate"]', 'xpath', 'e');
|
||||
$d->fill_element('//*[@id="onpeak_init_interval"]', 'xpath', 'e');
|
||||
$d->fill_element('//*[@id="onpeak_follow_rate"]', 'xpath', 'e');
|
||||
$d->fill_element('//*[@id="onpeak_follow_interval"]', 'xpath', 'e');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Must be a number. May contain numbers, +, - and decimal separator")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Onpeak init interval must be greater than 0")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Onpeak follow interval must be greater than 0")]'));
|
||||
|
||||
diag("Fill in more invalid values");
|
||||
$d->fill_element('//*[@id="onpeak_init_rate"]', 'xpath', '0');
|
||||
$d->fill_element('//*[@id="onpeak_init_interval"]', 'xpath', '-10');
|
||||
$d->fill_element('//*[@id="onpeak_follow_rate"]', 'xpath', '0');
|
||||
$d->fill_element('//*[@id="onpeak_follow_interval"]', 'xpath', '-10');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Onpeak init interval must be greater than 0")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Onpeak follow interval must be greater than 0")]'));
|
||||
|
||||
diag("Fill in valid values");
|
||||
$d->select_if_unselected('//*[@id="billing_zoneidtable"]//tr[1]/td[4]/input');
|
||||
$d->fill_element('//*[@id="onpeak_init_interval"]', 'xpath', '1');
|
||||
$d->fill_element('//*[@id="onpeak_follow_interval"]', 'xpath', '1');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Fee successfully created!', 'Correct Alert was shown');
|
||||
|
||||
diag("Check Billing Fee details");
|
||||
$d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_fee_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', $zonedetailname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), ".*")]'), 'Source pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), ".+")]'), 'Destination pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "Regular expression - longest pattern")]'), 'Match Mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "out")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "' . $zonedetailname . '")]'), 'Zone detail is correct');
|
||||
|
||||
diag("Edit Billing Fee");
|
||||
$d->move_and_click('//*[@id="billing_fee_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="billing_fee_table_filter"]/label/input');
|
||||
$d->move_and_click('//*[@id="direction"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Billing Fee")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Billing Fee")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="direction"]/option[@value="in"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing fee successfully changed!', 'Correct Alert was shown');
|
||||
|
||||
diag("Check Billing Fee details");
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), ".*")]'), 'Source pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), ".+")]'), 'Destination pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "Regular expression - longest pattern")]'), 'Match Mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "in")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "' . $zonedetailname . '")]'), 'Zone detail is correct');
|
||||
|
||||
diag("Go back to Billing Profiles page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Billing', 'link_text')->click();
|
||||
|
||||
diag("Clone Billing Profile");
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $billingname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile was found');
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]//tr[1]//td//a[contains(text(), "Duplicate")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
|
||||
diag("Fill in clone details");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Duplicate Billing Profile")]'), 'Edit window has been opened');
|
||||
my $clonename = ("billing" . int(rand(100000)) . "test");
|
||||
$d->fill_element('//*[@id="handle"]', 'xpath', $clonename);
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $clonename);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search cloned Billing Profile");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing profile successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $clonename);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $clonename . '")]'), 'Billing Profile was found');
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]//tr[1]//td//a[contains(text(), "Fees")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
|
||||
diag("Check if Fees got cloned properly");
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), ".*")]'), 'Source pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), ".+")]'), 'Destination pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "Regular expression - longest pattern")]'), 'Match Mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "in")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "' . $zonedetailname . '")]'), 'Zone detail is correct');
|
||||
|
||||
diag("Check if Billing Zones got cloned properly");
|
||||
$d->find_element('Edit Zones', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_zone_table"]//tr[1]/td[contains(text(), "' . $zonename . '")]'), 'Billing Zone name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_zone_table"]//tr[1]/td[contains(text(), "' . $zonedetailname . '")]'), 'Billing Zone detail is correct');
|
||||
|
||||
diag("Delete cloned Billing Profile");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Billing', 'link_text')->click();
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $clonename);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $clonename . '")]'), 'Billing Profile was found');
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]//tr[1]//td//a[contains(text(), "Terminate")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if clone profile has been deleted");
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $clonename);
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Cloned Billing Profile has been deleted');
|
||||
|
||||
diag("Go back to Billing Fees");
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $billingname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile was found');
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]/tbody/tr[1]//td//a[contains(text(), "Fees")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
|
||||
diag("Try to NOT delete Billing Fee");
|
||||
$d->move_and_click('//*[@id="billing_fee_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="billing_fee_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Billing Fee is still here");
|
||||
$d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_fee_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', $zonedetailname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_fee_table"]//tr[1]/td[contains(text(), "' . $zonedetailname . '")]'), 'Billing Fee entry is still here');
|
||||
|
||||
diag("Try to delete Billing Fee");
|
||||
$d->move_and_click('//*[@id="billing_fee_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="billing_fee_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing fee successfully deleted!', 'Correct Alert was shown');
|
||||
|
||||
diag("Check if Billing Fee has been deleted");
|
||||
$d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', $zonedetailname);
|
||||
ok($d->find_element_by_css('#billing_fee_table tr > td.dataTables_empty'), 'Billing Fee entry has been deleted');
|
||||
|
||||
diag("Go To Billing Zones");
|
||||
$d->find_element('Edit Zones', 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete Billing Zone");
|
||||
$d->move_and_click('//*[@id="billing_zone_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="billing_zone_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Billing Zone is still here");
|
||||
$d->fill_element('//*[@id="billing_zone_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_zone_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_zone_table_filter"]/label/input', 'xpath', $zonename);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_zone_table"]//tr[1]/td[contains(text(), "' . $zonename . '")]'), 'Billing Zone entry is still here');
|
||||
|
||||
diag("Try to delete Billing Zone");
|
||||
$d->move_and_click('//*[@id="billing_zone_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="billing_zone_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing zone successfully deleted', 'Correct Alert was shown');
|
||||
|
||||
diag("Check if Billing Zone has been deleted");
|
||||
$d->fill_element('//*[@id="billing_zone_table_filter"]/label/input', 'xpath', $zonename);
|
||||
ok($d->find_element_by_css('#billing_zone_table tr > td.dataTables_empty'), 'Billing Zone entry has been deleted');
|
||||
|
||||
diag("Go back to Billing Profile page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Billing', 'link_text')->click();
|
||||
|
||||
diag("Open 'Edit Peak Times' page");
|
||||
$d->fill_element('#billing_profile_table_filter label input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('#billing_profile_table_filter label input', 'css', $billingname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile was found');
|
||||
$d->move_and_click('//*[@id="billing_profile_table"]//tr[1]//td//div//a[contains(text(), "Off-Peaktimes")]', 'xpath', '//*[@id="billing_profile_table_filter"]//input');
|
||||
|
||||
diag("Edit Wednesday");
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "Off-peak-times")]'), 'We are on the correct page');
|
||||
$d->refresh();
|
||||
$d->move_and_click('//*[@id="content"]//table//tr[3]/td//a[text()[contains(., "Edit")]]', 'xpath', '//*[@id="masthead"]//div//h2[contains(text(), "Off-peak-times")]');
|
||||
|
||||
diag("Fill in invalid values");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Wednesday")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#start', 'css', "invalid");
|
||||
$d->fill_element('#end', 'css', "value");
|
||||
$d->find_element('#add', 'css')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "wrong format - must be HH:MM:SS or HH:MM")]'));
|
||||
|
||||
diag("Add a Time Definition to Wednesday");
|
||||
$d->fill_element('#start', 'css', "04:20:00");
|
||||
$d->fill_element('#end', 'css', "13:37:00");
|
||||
$d->find_element('#add', 'css')->click();
|
||||
|
||||
diag("Add empty Time Definition");
|
||||
$d->find_element('#add', 'css')->click();
|
||||
$d->find_element('#mod_close', 'css')->click();
|
||||
|
||||
diag("Check Time Definition Details");
|
||||
ok($d->find_element_by_xpath('//*[@id="content"]/div/table//tr[3]/td[text()[contains(.,"04:20:00")]]'), 'Time Definition 1 is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="content"]/div/table//tr[3]/td[text()[contains(.,"13:37:00")]]'), 'Time Definition 2 is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="content"]/div/table//tr[3]/td[text()[contains(.,"00:00:00")]]'), 'Time Definition 3 is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="content"]/div/table//tr[3]/td[text()[contains(.,"23:59:59")]]'), 'Time Definition 4 is correct');
|
||||
|
||||
diag("Create a Date Definition");
|
||||
$d->find_element('Create Special Off-Peak Date', 'link_text')->click();
|
||||
|
||||
diag("Save without entering anything");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Date Definition")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Start Date/Time field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "End Date/Time field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid date format, must be YYYY-MM-DD hh:mm:ss")]'));
|
||||
|
||||
diag("Fill in invalid values");
|
||||
$d->fill_element('#start', 'css', "this should");
|
||||
$d->fill_element('#end', 'css', "not work");
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Could not parse DateTime input. Should be one of (Y-m-d H:M:S, Y-m-d H:M, Y-m-d).")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid date format, must be YYYY-MM-DD hh:mm:ss")]'));
|
||||
|
||||
diag("Fill in valid values");
|
||||
$d->fill_element('#start', 'css', "2008-02-28 04:20:00");
|
||||
$d->fill_element('#end', 'css', "2008-02-28 13:37:00");
|
||||
$d->find_element('#save', 'css')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully created', 'Correct Alert was shown');
|
||||
|
||||
diag("Check if Date Definition is correct");
|
||||
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#date_definition_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', '2008-02-28 04:20:00');
|
||||
ok($d->find_element_by_xpath('//*[@id="date_definition_table"]//tr[1]/td[contains(text(), "2008-02-28 04:20:00")]'), 'Start Date Definition is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="date_definition_table"]//tr[1]/td[contains(text(), "2008-02-28 13:37:00")]'), 'End Date Definition is correct');
|
||||
|
||||
diag("Edit Date Definition");
|
||||
$d->move_and_click('//*[@id="date_definition_table"]/tbody/tr/td[4]/div/a[1]', 'xpath', '//div[contains(@class, "dataTables_filter")]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Date Definition")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#start', 'css', "2018-01-01 00:00:00");
|
||||
$d->fill_element('#end', 'css', "2019-01-01 23:59:59");
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if Date Definition is correct");
|
||||
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#date_definition_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', '2018-01-01 00:00:00');
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="date_definition_table"]//tr[1]/td[contains(text(), "2018-01-01 00:00:00")]'), 'Start Date Definition is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="date_definition_table"]//tr[1]/td[contains(text(), "2019-01-01 23:59:59")]'), 'End Date Definition is correct');
|
||||
|
||||
diag("Delete Date Definition");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="date_definition_table_filter"]/label/input'));
|
||||
$d->move_and_click('//*[@id="date_definition_table"]/tbody//tr//td//div//a[contains(text(),"Delete")]', 'xpath', '//div[contains(@class, "dataTables_filter")]//input');
|
||||
$d->find_element('#dataConfirmOK', 'css')->click();
|
||||
|
||||
diag("Check if Date Definition has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully deleted', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#date_definition_table tr > td.dataTables_empty'), 'Date Definition has been deleted');
|
||||
|
||||
diag("Try to NOT delete Billing Profile");
|
||||
$c->delete_billing_profile($billingname, 1);
|
||||
|
||||
diag("Check if Billing Profile is still here");
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="billing_profile_table_filter"]//input', 'xpath', $billingname);
|
||||
ok($d->find_element_by_xpath('//*[@id="billing_profile_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile is still here');
|
||||
|
||||
diag("Try to delete Billing Profile");
|
||||
$c->delete_billing_profile($billingname);
|
||||
|
||||
diag("Check if Billing Profile has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing profile successfully terminated', 'Correct Alert was shown');
|
||||
$d->fill_element('#billing_profile_table_filter label input', 'css', $billingname);
|
||||
ok($d->find_element_by_css('#billing_profile_table tr > td.dataTables_empty', 'css'), 'Billing Profile has been deleted');
|
||||
|
||||
diag("Go to 'Billing Networks' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Billing Networks', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Billing Network");
|
||||
$d->find_element('Create Billing Network', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Billing Network")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Billing Network Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Blocks field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller was found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $billingnetwork);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Very nice description');
|
||||
|
||||
diag("Fill in invalid IP and subnet mask");
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', 'invalid');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', 'ip');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Ip is no valid IPv4 or IPv6 address.")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid IP address")]'));
|
||||
|
||||
diag("Fill in valid IP and subnet mask");
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', '127.0.0.1');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', '8');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Billing Network");
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#networks_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', $billingnetwork);
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Network successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "' . $billingnetwork . '")]'), 'Billing Network name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "127.0.0.1/8")]'), 'Network block is correct');
|
||||
|
||||
diag("Edit Billing Network");
|
||||
$billingnetwork = ("billing" . int(rand(100000)) . "network");
|
||||
$d->move_and_click('//*[@id="networks_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="networks_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Billing Network")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $billingnetwork);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'also good description');
|
||||
|
||||
diag("Add new network block");
|
||||
$d->find_element('//*[@id="blocks_add"]')->click();
|
||||
$d->fill_element('//*[@id="blocks.1.row.ip"]', 'xpath', '10.0.0.138');
|
||||
$d->fill_element('//*[@id="blocks.1.row.mask"]', 'xpath', '16');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Billing Network");
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#networks_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', $billingnetwork);
|
||||
|
||||
diag("Check Details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing network successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "' . $billingnetwork . '")]'), 'Billing Network name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "127.0.0.1/8")]'), 'Network block (IP 1) is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "10.0.0.138/16")]'), 'Network block (IP 2) is correct');
|
||||
|
||||
diag("Try to NOT delete Billing Network");
|
||||
$d->move_and_click('//*[@id="networks_table"]//tr[1]//td//a[contains(text(), "Terminate")]', 'xpath', '//*[@id="networks_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Billing Network is still here");
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#networks_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', $billingnetwork);
|
||||
ok($d->find_element_by_xpath('//*[@id="networks_table"]//tr[1]/td[contains(text(), "' . $billingnetwork . '")]'), 'Billing Network is still here');
|
||||
|
||||
diag("Try to delete Billing Network");
|
||||
$d->move_and_click('//*[@id="networks_table"]//tr[1]//td//a[contains(text(), "Terminate")]', 'xpath', '//*[@id="networks_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Billing Network has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing network successfully terminated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', $billingnetwork);
|
||||
ok($d->find_element_by_css('#networks_table tr > td.dataTables_empty', 'css'), 'Billing network has been deleted');
|
||||
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_billing.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,373 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
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");
|
||||
my $run_ok = 0;
|
||||
my $custnum;
|
||||
my $compstring;
|
||||
|
||||
if(!$pbx){
|
||||
print "---PBX check is DISABLED---\n";
|
||||
$pbx = 0;
|
||||
} else {
|
||||
print "---PBX check is ENABLED---\n";
|
||||
};
|
||||
|
||||
$c->login_ok();
|
||||
$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');
|
||||
|
||||
|
||||
diag("Try to create an empty Customer");
|
||||
$d->find_element('Create Customer', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Customer")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//table[@id="contactidtable"]/tbody/tr[1]/td//input[@type="checkbox"]'));
|
||||
$d->unselect_if_selected('//table[@id="contactidtable"]/tbody/tr[1]/td//input[@type="checkbox"]');
|
||||
$d->scroll_to_element($d->find_element('//table[@id="billing_profileidtable"]/tbody/tr[1]/td//input[@type="checkbox"]'));
|
||||
$d->unselect_if_selected('//table[@id="billing_profileidtable"]/tbody/tr[1]/td//input[@type="checkbox"]');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if error messages appear");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Contact field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid \'billing_profile_id\', not defined.")]'));
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Search Customer");
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test was not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
|
||||
diag("Check Customer details");
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer ID is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Contact Email is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "locked")]'), 'Status is correct');
|
||||
$custnum = $d->get_text('//*[@id="Customer_table"]//tr[1]//td[1]');
|
||||
|
||||
diag("Check if Customer is locked");
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
$d->find_element_by_xpath('//div/h2[contains(text(), "Customer Details")]');
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Customer is locked', 'Correct Alert was shown');
|
||||
|
||||
diag("Go back and edit Customer");
|
||||
$d->find_element('Back', 'link_text')->click();
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer ID is correct');
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
|
||||
diag("Set status to 'active'");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Customer")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="status"]'));
|
||||
$d->find_element('//*[@id="status"]/option[contains(text(), "active")]')->click();
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Search Customer");
|
||||
$compstring = "Customer #" . $custnum . " successfully updated";
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, 'Correct Alert was shown');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
|
||||
diag("Check customer details");
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer ID is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Contact Email is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "active")]'), 'Status is correct');
|
||||
$compstring = "Customer #" . $custnum . " successfully updated";
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, 'Correct Alert was shown');
|
||||
|
||||
diag("Open Customer details");
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
|
||||
diag("Edit Contact");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contact Details")]'));
|
||||
$d->find_element('//div[contains(@class,"accordion-body")]//*[contains(@class,"btn-primary") and contains(text(),"Edit Contact")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Contact")]'), 'Edit window has been opened');
|
||||
$d->fill_element('div.modal #firstname', 'css', "Alice");
|
||||
$d->fill_element('#company', 'css', 'Sipwise');
|
||||
ok($d, 'Inserting name works');
|
||||
$d->fill_element('#street', 'css', 'Frunze Square');
|
||||
$d->fill_element('#postcode', 'css', '03141');
|
||||
$d->fill_element('#city', 'css', 'Kiew');
|
||||
$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"]');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Contact details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), '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->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $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');
|
||||
}
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contact Details")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Email")]/../td[2][contains(text(), "' . $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');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Address")]/../td[text()[contains(.,"Kiew")]]'), 'City is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Address")]/../td[text()[contains(.,"Frunze Square")]]'), 'Street is correct');
|
||||
|
||||
diag("Edit Fraud Limits");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]'));
|
||||
$d->move_and_click('//*[@id="collapse_fraud"]//table//tr//td[text()[contains(.,"Monthly Settings")]]/../td//a[text()[contains(.,"Edit")]]', 'xpath', '//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]');
|
||||
|
||||
diag("Fill in invalid values");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#fraud_interval_limit', 'css', "invalid");
|
||||
$d->fill_element('#fraud_interval_notify', 'css', 'stuff');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "stuff is no valid email address")]'));
|
||||
|
||||
diag("Fill in valid values");
|
||||
$d->fill_element('#fraud_interval_limit', 'css', "100");
|
||||
$d->fill_element('#fraud_interval_notify', 'css', 'mymail@example.org');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Fraud Limit details");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Fraud settings successfully changed!', 'Correct Alert was shown');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_fraud"]//table//tr//td[contains(text(), "Monthly Settings")]/../td[contains(text(), "100")]'), 'Limit is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_fraud"]//table//tr//td[contains(text(), "Monthly Settings")]/../td[4][contains(text(), "' . 'mymail@example.org' . '")]'), 'Mail is correct');
|
||||
|
||||
diag("Go to 'Contract Balance'");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]'));
|
||||
|
||||
diag("Set Cash Balance without entering anything");
|
||||
$d->find_element('//*[@id="collapse_balance"]//div//span//a[contains(text(), "Set Cash Balance")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="cash_balance"]', 'xpath', ' ');
|
||||
$d->fill_element('//*[@id="free_time_balance"]', 'xpath', ' ');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Cash Balance field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Free-Time Balance field is required")]'));
|
||||
|
||||
diag("Set invalid Cash Balance");
|
||||
$d->fill_element('//*[@id="cash_balance"]', 'xpath', 'asdf');
|
||||
$d->fill_element('//*[@id="free_time_balance"]', 'xpath', 'asdf');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
|
||||
diag("Set valid Cash Balance");
|
||||
$d->fill_element('//*[@id="cash_balance"]', 'xpath', '200');
|
||||
$d->fill_element('//*[@id="free_time_balance"]', 'xpath', '300');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Cash Balance was set correctly");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Account balance successfully changed!', 'Correct Alert was shown');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//table//tr//td//b[contains(text(), "200.00")]'), 'Cash Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//table//tr//td//b[contains(text(), "300")]'), 'Free-Time Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="balance_intervals_table"]//tr//td[contains(text(), "200.00")]'), 'Cash Balance in Balance intervals table is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="balance_intervals_table"]//tr//td[contains(text(), "300")]'), 'Free-Time Balance in Balance intervals table is correct');
|
||||
|
||||
diag("Top-up Cash Balance");
|
||||
$d->find_element('//*[@id="collapse_balance"]//div//span//a[contains(text(), "Top-up Cash")]')->click();
|
||||
|
||||
diag("Perform Top-up without entering anything");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Amount field is required")]'));
|
||||
|
||||
diag("Top-up Cash");
|
||||
$d->fill_element('//*[@id="amount"]', 'xpath', '200');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Top-up was successful");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Top-up using cash performed successfully!', 'Correct Alert was shown');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//table//tr//td//b[contains(text(), "400.00")]'), "Cash Balance is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//table//tr//td//b[contains(text(), "300")]'), "Free-Time Balance is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="topup_logs_table"]//tr//td[contains(text(), "200")]'), "Top-Up in Top-Up logs table is correct");
|
||||
|
||||
diag("Create a new empty Phonebook entry");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]'));
|
||||
$d->find_element('Create Phonebook Entry', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Phonebook")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Number field is required")]'));
|
||||
|
||||
diag("Enter Information");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'Tester');
|
||||
$d->fill_element('//*[@id="number"]', 'xpath', '0123456789');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Phonebook entry");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]/label/input', 'xpath', 'Tester');
|
||||
|
||||
diag("Check Phonebook entry details");
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "Tester")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "0123456789")]'), 'Number is correct');
|
||||
|
||||
diag("Edit Phonebook entry");
|
||||
$d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="customer_details"]//div//a[contains(text(), "Phonebook")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Phonebook")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'TesterTester');
|
||||
$d->fill_element('//*[@id="number"]', 'xpath', '987654321');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Phonebook entry details");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully updated', 'Correct Alert was shown');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "TesterTester")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "987654321")]'), 'Number is correct');
|
||||
|
||||
diag("Create a new empty Location");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Locations")]'));
|
||||
$d->find_element('Create Location', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Location")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Location Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Blocks field is required")]'));
|
||||
|
||||
diag("Fill in invalid IP address");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'Test Location');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'This is a Test Location');
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', 'invalid');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', 'ip');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Ip is no valid IPv4 or IPv6 address")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid IP address")]'));
|
||||
|
||||
diag("Fill in another invalid IP address");
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', '10.0.0.256');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', '16');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Ip is no valid IPv4 or IPv6 address")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid IP address")]'));
|
||||
|
||||
diag("Fill in invalid subnet mask");
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', '127.0.0.1');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', '33');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid mask")]'));
|
||||
|
||||
diag("Fill in valid IP address");
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', '127.0.0.1');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', '16');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Location");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Location successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="locations_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#locations_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="locations_table_filter"]/label/input', 'xpath', 'Test Location');
|
||||
|
||||
diag("Check Location details");
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "Test Location")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "This is a Test Location")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "127.0.0.1/16")]'), 'Network block is correct');
|
||||
|
||||
diag("Edit Location and add another Location block");
|
||||
$d->move_and_click('//*[@id="locations_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="customer_details"]//div//a[contains(text(), "Locations")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'This is a very Test Location');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'TestTest Location');
|
||||
$d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', '10.0.0.138');
|
||||
$d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', '16');
|
||||
$d->find_element('//*[@id="blocks_add"]')->click();
|
||||
$d->fill_element('//*[@id="blocks.1.row.ip"]', 'xpath', '127.0.0.1');
|
||||
$d->fill_element('//*[@id="blocks.1.row.mask"]', 'xpath', '16');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Location successfully updated', 'Correct Alert was shown');
|
||||
|
||||
diag("Check Location details");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();#
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Location successfully updated', 'Correct Alert was shown');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//div//a[contains(text(),"Locations")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "TestTest Location")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "This is a very Test Location")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "10.0.0.138/16")]'), 'Network block is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="locations_table"]//tr[1]/td[contains(text(), "127.0.0.1/16")]'), 'Network block 2 is correct');
|
||||
|
||||
diag("Try to NOT delete Customer");
|
||||
$c->delete_customer($customerid, 1);
|
||||
|
||||
diag("Check if Customer is still here");
|
||||
$d->fill_element('//*[@id="Customer_table_filter"]/label/input', 'xpath', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr/td[2][contains(text(), "' . $customerid . '")]'), 'Customer is still here');
|
||||
|
||||
diag("Try to delete Customer");
|
||||
$c->delete_customer($customerid, 0);
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Customer successfully terminated', 'Correct Alert was shown');
|
||||
|
||||
diag("Check if Customer has been deleted");
|
||||
$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 has been deleted');
|
||||
|
||||
$c->delete_contact($contactmail);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
$c->delete_billing_profile($billingname);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_customer.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,188 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag like)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_domain($domainstring);
|
||||
|
||||
diag("Try to create an empty Domain");
|
||||
$d->find_element('Create Domain', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Domain")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "SIP Domain field is required")]'));
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Search Domain");
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Domain_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
|
||||
diag("Check Domain details");
|
||||
ok($d->find_element_by_xpath('//*[@id="Domain_table"]//tr[1]/td[contains(text(), "default")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Domain_table"]//tr[1]/td[contains(text(), "' . $domainstring .'")]', $domainstring), 'Domain name is correct');
|
||||
|
||||
diag("Open Domain preferences");
|
||||
$d->move_and_click('//*[@id="Domain_table"]//tr[1]//td//a[contains(text(), "Preferences")]', 'xpath', '//*[@id="Domain_table_filter"]/label/input');
|
||||
|
||||
diag("Go to 'Access Restrictions'");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element("Access Restrictions", 'link_text'));
|
||||
|
||||
diag("Edit preference 'concurrent_max'");
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "concurrent_max")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "reject_emergency")]');
|
||||
|
||||
diag("Enter invalid value");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#concurrent_max', 'css', 'thisisnonumber');
|
||||
$d->find_element("#save", 'css')->click();
|
||||
|
||||
diag("Check error message");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
|
||||
diag("Enter valid value");
|
||||
$d->fill_element('#concurrent_max', 'css', '789');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if value has been applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference concurrent_max successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Access Restrictions', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "concurrent_max")]/../td[contains(text(), "789")]'), 'Value has been applied');
|
||||
|
||||
diag("Edit preference 'allowed_ips'");
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "allowed_ips")]/../td/div/a[contains(text(), "Edit")]', 'xpath', '//table/tbody/tr/td[contains(text(), "man_allowed_ips")]/../td/div/a[contains(text(), "Edit")]');
|
||||
|
||||
diag("Enter an IP address");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//div//span[contains(text(), "Invalid IPv4 or IPv6 address")]'), 'Invalid IP address detected');
|
||||
$d->fill_element('//*[@id="allowed_ips"]', 'xpath', '127.0.0.0.0');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//div//span[contains(text(), "Invalid IPv4 or IPv6 address")]'), 'Invalid IP address detected');
|
||||
$d->fill_element('//*[@id="allowed_ips"]', 'xpath', 'thisisnonumber');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//div//span[contains(text(), "Invalid IPv4 or IPv6 address")]'), 'Invalid IP address detected');
|
||||
$d->fill_element('//*[@id="allowed_ips"]', 'xpath', '127.0.0.1');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Check if IP address has been added");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Access Restrictions', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "allowed_ips")]/../td[contains(text(), "127.0.0.1")]'), 'IP address has beeen found');
|
||||
|
||||
diag("Add another IP address");
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "allowed_ips")]/../td/div/a[contains(text(), "Edit")]', 'xpath', '//table/tbody/tr/td[contains(text(), "man_allowed_ips")]/../td/div/a[contains(text(), "Edit")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="allowed_ips"]', 'xpath', '10.0.0.138');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Check if IP address has been added");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Access Restrictions', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "allowed_ips")]/../td[contains(text(), "10.0.0.138")]'), 'IP address has beeen found');
|
||||
|
||||
diag("Delete the first IP address");
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "allowed_ips")]/../td/div/a[contains(text(), "Edit")]', 'xpath', '//table/tbody/tr/td[contains(text(), "man_allowed_ips")]/../td/div/a[contains(text(), "Edit")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="mod_edit"]/div[2]/div[2]/a')->click();
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Check if IP addresses have been changed");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element("Access Restrictions", 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "allowed_ips")]/../td[contains(text(), "10.0.0.138")]'), 'IP address has beeen found');
|
||||
|
||||
diag("Enable Opus Mono");
|
||||
$d->scroll_to_element($d->find_element('//table//tr/td[contains(text(), "transcode_opus_mono")]'));
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "transcode_opus_mono")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "transcode_opus_stereo")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="transcode_opus_mono"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Opus Mono was enabled");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference transcode_opus_mono successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "transcode_opus_mono")]/../td//input[@checked="checked"]'), 'Opus Mono was enabled');
|
||||
|
||||
diag("Change Opus Mono Bitrate to 32 kbit/s");
|
||||
$d->scroll_to_element($d->find_element('//table//tr/td[contains(text(), "transcode_opus_mono")]'));
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "opus_mono_bitrate")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "opus_stereo_bitrate")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="opus_mono_bitrate"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="opus_mono_bitrate"]/option[contains(text(), "32")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Bitrate was applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference opus_mono_bitrate successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "opus_mono_bitrate")]/../td/select/option[text()[contains(., "32")]][@selected="selected"]'), 'Correct bitrate was selected');
|
||||
|
||||
diag("Enable Opus Stereo");
|
||||
$d->scroll_to_element($d->find_element('//table//tr/td[contains(text(), "transcode_opus_mono")]'));
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "transcode_opus_stereo")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "transcode_opus_mono")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="transcode_opus_stereo"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Opus Stereo was enabled");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference transcode_opus_stereo successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "transcode_opus_stereo")]/../td//input[@checked="checked"]'), 'Opus Stereo was enabled');
|
||||
|
||||
diag("Change Opus Stereo Bitrate to 32 kbit/s");
|
||||
$d->scroll_to_element($d->find_element('//table//tr/td[contains(text(), "transcode_opus_stereo")]'));
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "opus_stereo_bitrate")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "opus_mono_bitrate")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="opus_stereo_bitrate"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="opus_stereo_bitrate"]/option[contains(text(), "32")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Bitrate was applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference opus_stereo_bitrate successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "opus_stereo_bitrate")]/../td/select/option[text()[contains(., "32")]][@selected="selected"]'), 'Correct bitrate was selected');
|
||||
|
||||
diag("Try to NOT delete Domain");
|
||||
$c->delete_domain($domainstring, 1);
|
||||
|
||||
diag("Check if Domain is still here");
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="Domain_table"]//tr[1]/td[contains(text(), "' . $domainstring .'")]'), 'Domain is still here');
|
||||
|
||||
diag("Try to delete Domain");
|
||||
$c->delete_domain($domainstring, 0);
|
||||
|
||||
diag("Check if Domain has been deleted");
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Domain successfully deleted!', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#Domain_table tr > td.dataTables_empty', 'css'), 'Domain has been deleted');
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_domain.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,224 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $containername = ("emergency" . int(rand(100000)) . "container");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
|
||||
diag("Go to 'Emergency Mappings' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Emergency Mappings', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Emergency Container");
|
||||
$d->find_element('Create Emergency Container', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Emergency Container")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]//tr[1]//td//input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $containername);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Emergency Container");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Emergency mapping container successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_containers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', $containername);
|
||||
|
||||
diag("Check Emergency Container details");
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containers_table"]//tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containers_table"]//tr[1]/td[contains(text(), ' . $containername . ')]'), 'Container name is correct');
|
||||
|
||||
diag("Edit Emergency Container name");
|
||||
$containername = ("emergency" . int(rand(100000)) . "container");
|
||||
$d->move_and_click('//*[@id="emergency_containers_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="emergency_containers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Emergency Container")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $containername);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Emergency Container");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Emergency mapping container successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_containers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', $containername);
|
||||
|
||||
diag("Check Emergency Container details");
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containers_table"]//tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containers_table"]//tr[1]/td[contains(text(), ' . $containername . ')]'), 'Container name is correct');
|
||||
|
||||
diag("Try to create a empty Emergency Mapping");
|
||||
$d->find_element('Create Emergency Mapping', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Emergency Mapping")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="emergency_containeridtable"]//tr[1]//td//input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Emergency Mapping Container field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Code field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="emergency_containeridtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_containeridtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_containeridtable_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containeridtable"]//tr[1]/td[contains(text(), "' . $containername . '")]'), 'Emergency Container found');
|
||||
$d->select_if_unselected('//*[@id="emergency_containeridtable"]/tbody/tr[1]/td[4]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="code"]', 'xpath', "133");
|
||||
$d->fill_element('//*[@id="prefix"]', 'xpath', "E1_133_");
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Emergency Mapping");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Emergency mapping successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_mappings_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', $containername);
|
||||
|
||||
diag("Check Emergency Mapping details");
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), ' . $containername . ')]'), 'Container name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), "133")]'), 'Emergency Number is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), "E1_133_")]'), 'Emergency Prefix is correct');
|
||||
|
||||
diag("Edit Emergency Mapping Details");
|
||||
$d->move_and_click('//*[@id="emergency_mappings_table"]/tbody/tr[1]/td[6]/div/a[2]', 'xpath', '//*[@id="emergency_mappings_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Emergency Mapping")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="code"]', 'xpath', "144");
|
||||
$d->fill_element('//*[@id="prefix"]', 'xpath', "E2_144_");
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Emergency Mapping details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Emergency mapping successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), ' . $containername . ')]'), 'Container name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), "144")]'), 'Emergency Number is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), "E2_144_")]'), 'Emergency Prefix is correct');
|
||||
|
||||
diag("Create Domain to add Emergency Container");
|
||||
$c->create_domain($domainstring, $resellername);
|
||||
|
||||
diag("Search Domain");
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Domain_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="Domain_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), 'Domain was found');
|
||||
$d->move_and_click('//*[@id="Domain_table"]//tr[1]//td//a[contains(text(), "Preferences")]', 'xpath', '//*[@id="Domain_table_filter"]/label/input');
|
||||
|
||||
diag("Open 'Number Manipulations'");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
|
||||
diag("Edit setting 'emergency_mapping_container'");
|
||||
$d->scroll_to_element($d->find_element('//table//tr//td[contains(text(), "emergency_mapping_container")]'));
|
||||
$d->move_and_click('//table//tr//td[contains(text(), "emergency_mapping_container")]/../td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "NAT and Media Flow Control")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), "Edit window has been opened");
|
||||
$d->move_and_click('//*[@id="emergency_mapping_container"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="emergency_mapping_container"]/option[contains(text(), "' . $containername . '")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if setting 'emergency_mapping_container' was applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference emergency_mapping_container successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "emergency_mapping_container")]/../td/select/option[contains(text(), "' . $containername . '")][@selected="selected"]'), 'NCOS Level was applied');
|
||||
|
||||
diag("Edit setting 'emergency_mode_enabled'");
|
||||
$d->scroll_to_element($d->find_element('//table//tr//td[contains(text(), "emergency_mode_enabled")]'));
|
||||
$d->move_and_click('//table//tr//td[contains(text(), "emergency_mode_enabled")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr//td[contains(text(), "call_deflection")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="emergency_mode_enabled"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if setting 'emergency_mode_enabled' was enabled");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference emergency_mode_enabled successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "emergency_mode_enabled")]/../td//input[@checked="checked"]'), 'Setting was enabled');
|
||||
|
||||
diag("Go to 'Emergency Mappings' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Emergency Mappings', 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete Emergency Mapping");
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_mappings_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[2][contains(text(), "' . $containername . '")]'), 'Emergency mapping was found');
|
||||
$d->move_and_click('//*[@id="emergency_mappings_table"]/tbody/tr/td[6]/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="emergency_mappings_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Emergency Mapping is still here");
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_mappings_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_mappings_table"]//tr[1]/td[contains(text(), ' . $containername . ')]'), 'Mapping is still here');
|
||||
|
||||
diag("Try to delete Emergency Mapping");
|
||||
$d->move_and_click('//*[@id="emergency_mappings_table"]/tbody/tr/td[6]/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="emergency_mappings_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Emergency Mapping has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Emergency mapping successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="emergency_mappings_table_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_css('#emergency_mappings_table tr > td.dataTables_empty', 'css'), 'Emergency Mapping has been deleted');
|
||||
|
||||
diag("Try to NOT delete Emergency Container");
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_containers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containers_table"]//tr[1]/td[3][contains(text(), "' . $containername . '")]'), 'Emergency mapping was found');
|
||||
$d->move_and_click('//*[@id="emergency_containers_table"]/tbody/tr/td[4]/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="emergency_containers_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Emergency Container is still here");
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#emergency_containers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_xpath('//*[@id="emergency_containers_table"]//tr[1]/td[contains(text(), ' . $containername . ')]'), 'Container is still here');
|
||||
|
||||
diag("Try to delete Emergency Container");
|
||||
$d->move_and_click('//*[@id="emergency_containers_table"]/tbody/tr/td[4]/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="emergency_containers_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Emergency Container has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Emergency mapping container successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="emergency_containers_table_filter"]/label/input', 'xpath', $containername);
|
||||
ok($d->find_element_by_css('#emergency_containers_table tr > td.dataTables_empty', 'css'), 'Emergency Container has been deleted');
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
|
||||
$c->delete_domain($domainstring);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_emergency.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,340 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $rulesetname = ("rule" . int(rand(100000)) . "test");
|
||||
my $headername = ("header" . int(rand(100000)) . "manipuls");
|
||||
my $headerrule = ("header" . int(rand(100000)) . "rule");
|
||||
my $headercondition = ("header" . int(rand(100000)) . "condition");
|
||||
my $headeraction = ("header" . int(rand(100000)) . "action");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_rw_ruleset($rulesetname, $resellername);
|
||||
|
||||
diag("Go to 'Header Manipulations' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Header Manipulations', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Header Rule Set");
|
||||
$d->find_element('Create Header Rule Set', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Header Rule Set")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $headername);
|
||||
$d->fill_element('//*[@id="description"]' , 'xpath', 'This is a nice description');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Header Rule Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule set successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#header_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', $headername);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "' . $headername . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "This is a nice description")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Header Rule Set");
|
||||
$headername = ("header" . int(rand(100000)) . "manipuls");
|
||||
$d->move_and_click('//*[@id="header_rule_set_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="header_rule_set_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Header Rule Set")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $headername);
|
||||
$d->fill_element('//*[@id="description"]' , 'xpath', 'This is a very nice description');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Header Rule Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule set successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#header_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', $headername);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "' . $headername . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "This is a very nice description")]'), 'Description is correct');
|
||||
|
||||
diag("Go to 'Header Rule Set Rules' page");
|
||||
$d->move_and_click('//*[@id="header_rule_set_table"]//tr[1]//td//a[contains(text(), "Rules")]', 'xpath', '//*[@id="header_rule_set_table_filter"]/label/input');
|
||||
|
||||
diag("Try to create an empty Header Rule");
|
||||
$d->find_element('Create Header Rule', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Header Rule")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $headerrule);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'this is a nice description');+
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "100")]'), 'Priority is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "' . $headerrule . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "this is a nice description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "inbound")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "0")]'), 'Stopper is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "1")]'), 'Enabled is correct');
|
||||
|
||||
diag("Edit Header Rule");
|
||||
$headerrule = ("header" . int(rand(100000)) . "rule");
|
||||
$d->move_and_click('//*[@id="header_rules_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="header_rules_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Header Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="priority"]', 'xpath', '1');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $headerrule);
|
||||
#$d->move_and_click('//*[@id="direction"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Header Rules")]');
|
||||
#$d->find_element('//*[@id="direction"]/option[@value="outbound"]')->click();
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'this is a very nice description');
|
||||
$d->select_if_unselected('//*[@id="stopper"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "1")]'), 'Priority is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "' . $headerrule . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "this is a very nice description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "inbound")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "1")]'), 'Stopper is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "1")]'), 'Enabled is correct');
|
||||
|
||||
diag("Create a Second Header Rule");
|
||||
$d->find_element("Create Header Rule", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Header Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'second');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'this is a nice description');+
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Move new entry up");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully created', 'Correct Alert was shown');
|
||||
$d->refresh();
|
||||
$d->move_and_click('//*[@id="header_rules_table"]//tr[2]//td//a[1]', 'xpath', '//*[@id="header_rules_table_filter"]/label/input');
|
||||
|
||||
diag("Check if entry has moved up");
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]/td[contains(text(), "second")]'), "Entry has been moved");
|
||||
|
||||
diag("Try to delete second Header Rule");
|
||||
$d->fill_element('//*[@id="header_rules_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#header_rules_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="header_rules_table_filter"]//input', 'xpath', 'second');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rules_table"]//tr[1]//td[contains(text(), "second")]'), "Header Rule was found");
|
||||
$d->move_and_click('//*[@id="header_rules_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="header_rules_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Header Rule has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="header_rules_table_filter"]//input', 'xpath', 'second');
|
||||
ok($d->find_element_by_css('#header_rules_table tr > td.dataTables_empty', 'css'), 'Header Rule has been deleted');
|
||||
|
||||
diag("Go to 'Rule Conditions' page");
|
||||
$d->fill_element('//*[@id="header_rules_table_filter"]//input', 'xpath', $headerrule);
|
||||
$d->move_and_click('//*[@id="header_rules_table"]//tr[1]//td//a[contains(text(), "Conditions")]', 'xpath', '//*[@id="header_rules_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "Header Rule Conditions for ' . $headerrule . '")]'), "We are on the correct page");
|
||||
|
||||
diag("Try to create an empty Header Rule Condition");
|
||||
$d->find_element('Create Header Rule Condition', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Header Rule Condition")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="match_name"]', 'xpath', $headercondition);
|
||||
$d->find_element('//*[@id="rwr_set"]/option[contains(text(), "' . $rulesetname . '")]')->click();
|
||||
$d->find_element('//*[@id="rwr_dp"]/option[@value="caller_in_dpid"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "' . $headercondition . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "header")]'), 'Match is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "full")]'), 'Part is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "is")]'), 'Expression is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "input")]'), 'Type is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "' . $rulesetname . '")]'), 'Rewrite Rule Set is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "caller_in")]'), 'Rule Set Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "1")]'), 'Condition is enabled');
|
||||
|
||||
diag("Edit Condition");
|
||||
$headercondition = ("header" . int(rand(100000)) . "condition");
|
||||
$d->move_and_click('//*[@id="header_rule_conditions_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="header_rule_conditions_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Header Rule Condition")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="match_type"]/option[@value="avp"]')->click();
|
||||
$d->find_element('//*[@id="match_part"]/option[@value="port"]')->click();
|
||||
$d->fill_element('//*[@id="match_name"]', 'xpath', $headercondition);
|
||||
$d->find_element('//*[@id="expression"]/option[@value="matches"]')->click();
|
||||
$d->select_if_unselected('//*[@id="expression_negation"]');
|
||||
$d->find_element('//*[@id="value_type"]/option[@value="preference"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="value_add"]'));
|
||||
$d->unselect_if_selected('//*[@id="enabled"]');
|
||||
$d->find_element('//*[@id="rwr_dp"]/option[@value="callee_in_dpid"]')->click();
|
||||
$d->find_element('//*[@id="value_add"]')->click();
|
||||
$d->fill_element('//*[@id="values.0.value"]', 'xpath', 'randomvalue');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "' . $headercondition . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "avp")]'), 'Match is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "port")]'), 'Part is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "! matches")]'), 'Expression is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "preference")]'), 'Type is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "randomvalue")]'), 'Value is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "' . $rulesetname . '")]'), 'Rewrite Rule Set is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "callee_in")]'), 'Rule Set Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "0")]'), 'Condition is disabled');
|
||||
$d->refresh();
|
||||
|
||||
diag("Try to delete Header Rule Condition");
|
||||
$d->fill_element('//*[@id="header_rule_conditions_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#header_rule_conditions_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="header_rule_conditions_table_filter"]//input', 'xpath', $headercondition);
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_conditions_table"]//tr[1]//td[contains(text(), "' . $headercondition . '")]'), 'Header Rule Condition was found');
|
||||
$d->move_and_click('//*[@id="header_rule_conditions_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="header_rule_conditions_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Header Rule Condition has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully deleted', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#header_rule_conditions_table tr > td.dataTables_empty', 'css'), 'Header Rule Condition has been deleted');
|
||||
|
||||
diag("Go to 'Header Rule Actions' page");
|
||||
$d->find_element('Actions', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Header Rule Action");
|
||||
$d->find_element('Create Header Rule Action', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Header Rule Action")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Header field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="c_header"]', 'xpath', $headeraction);
|
||||
$d->find_element('//*[@id="value_part"]/option[@value="domain"]')->click();
|
||||
$d->find_element('//*[@id="rwr_set"]/option[contains(text(), "' . $rulesetname . '")]')->click();
|
||||
$d->find_element('//*[@id="rwr_dp"]/option[@value="caller_in_dpid"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "' . $headeraction . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "full")]'), 'Header Part is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "set")]'), 'Type is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "domain")]'), 'Value Part is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "' . $rulesetname . '")]'), 'Rewrite Rule set is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "caller_in")]'), 'Rule Set Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "1")]'), 'Action is Enabled');
|
||||
|
||||
diag("Edit Header Rule Action");
|
||||
$headeraction = ("header" . int(rand(100000)) . "action");
|
||||
$d->move_and_click('//*[@id="header_rule_actions_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="header_rule_actions_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Header Rule Action")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="c_header"]', 'xpath', $headeraction);
|
||||
$d->find_element('//*[@id="header_part"]/option[@value="port"]')->click();
|
||||
$d->find_element('//*[@id="action_type"]/option[@value="add"]')->click();
|
||||
$d->find_element('//*[@id="value_part"]/option[@value="username"]')->click();
|
||||
$d->fill_element('//*[@id="value"]', 'xpath', 'randomvalue');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="enabled"]'));
|
||||
$d->find_element('//*[@id="rwr_dp"]/option[@value="callee_in_dpid"]')->click();
|
||||
$d->unselect_if_selected('//*[@id="enabled"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "' . $headeraction . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "port")]'), 'Header Part is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "add")]'), 'Type is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "username")]'), 'Value Part is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "' . $rulesetname . '")]'), 'Rewrite Rule set is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "callee_in")]'), 'Rule Set Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "0")]'), 'Action is Disabled');
|
||||
|
||||
diag("Create a second Header Rule Action");
|
||||
$d->find_element('Create Header Rule Action', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Header Rule Action")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="c_header"]', 'xpath', 'second');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Move new entry up");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully created', 'Correct Alert was shown');
|
||||
$d->refresh();
|
||||
$d->move_and_click('//*[@id="header_rule_actions_table"]//tr[2]//td//a[1]', 'xpath', '//*[@id="header_rule_actions_table_filter"]//input');
|
||||
|
||||
diag("Check if Entry has moved up");
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]/td[contains(text(), "second")]'), 'Entry has been moved');
|
||||
|
||||
diag("Try to delete Header Rule Action");
|
||||
$d->fill_element('//*[@id="header_rule_actions_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#header_rule_actions_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="header_rule_actions_table_filter"]//input', 'xpath', $headeraction);
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_actions_table"]//tr[1]//td[contains(text(), "' . $headeraction . '")]'), 'Header Rule Action was found');
|
||||
$d->move_and_click('//*[@id="header_rule_actions_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="header_rule_actions_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Header Rule Action has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="header_rule_actions_table_filter"]//input', 'xpath', $headeraction);
|
||||
ok($d->find_element_by_css('#header_rule_actions_table tr > td.dataTables_empty', 'css'), 'Header Rule Condition has been deleted');
|
||||
|
||||
diag("Go back to Header Manipulations");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Header Manipulations", 'link_text')->click();
|
||||
|
||||
diag("Try to delete Header Rule Set");
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#header_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', $headername);
|
||||
ok($d->find_element_by_xpath('//*[@id="header_rule_set_table"]//tr[1]//td[contains(text(), "' . $headername . '")]'), 'Header Rule Set was found');
|
||||
$d->move_and_click('//*[@id="header_rule_set_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="header_rule_set_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Header Rule Set has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule set successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="header_rule_set_table_filter"]/label/input', 'xpath', $headername);
|
||||
ok($d->find_element_by_css('#header_rule_set_table tr > td.dataTables_empty', 'css'), 'Header Rule Set has been deleted');
|
||||
|
||||
$c->delete_rw_ruleset($rulesetname);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_header.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,217 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $templatename = ("invoice" . int(rand(100000)) . "tem");
|
||||
my $contactmail = ("contact" . int(rand(100000)) . '@test.org');
|
||||
my $billingname = ("billing" . int(rand(100000)) . "test");
|
||||
my $customerid = ("id" . int(rand(100000)) . "ok");
|
||||
my $compstring;
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$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("Go to 'Invoice Templates' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Invoice Templates', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Invoice Template");
|
||||
$d->find_element('Create Invoice Template', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Invoice Template")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $templatename);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Template");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Invoice template successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#InvoiceTemplate_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', $templatename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "svg")]'), 'Type is correct');
|
||||
|
||||
diag("Edit Invoice Template");
|
||||
$templatename = ("invoice" . int(rand(100000)) . "tem");
|
||||
$d->move_and_click('//*[@id="InvoiceTemplate_table"]//tr[1]//td//a[contains(text(), "Edit Meta")]', 'xpath', '//*[@id="InvoiceTemplate_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Invoice Template")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $templatename);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Template");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Invoice template successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#InvoiceTemplate_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', $templatename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "svg")]'), 'Type is correct');
|
||||
|
||||
diag("Go to 'Customers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Customers', 'link_text')->click();
|
||||
|
||||
diag("Search Customer");
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer found');
|
||||
my $custnum = $d->find_element('//*[@id="Customer_table"]/tbody/tr/td[1]')->get_text();
|
||||
|
||||
diag("Add Invoice Template to Customer");
|
||||
$d->move_and_click('//*[@id="Customer_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="Customer_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Customer")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="invoice_templateidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#invoice_templateidtable tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('//*[@id="invoice_templateidtable_filter"]/label/input', 'xpath', $templatename);
|
||||
ok($d->find_element_by_xpath('//*[@id="invoice_templateidtable"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Invoice Template was found');
|
||||
$d->find_element('//*[@id="invoice_templateidtable"]//tr[1]/td[4]/input')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Invoice Template was applied");
|
||||
$compstring = "Customer #" . $custnum . " successfully updated";
|
||||
is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), $compstring, 'Correct Alert was shown');
|
||||
$d->move_and_click('//*[@id="Customer_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="Customer_table_filter"]/label/input');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="Customer_table_filter"]/label/input'));
|
||||
ok($d->find_element_by_xpath('//*[@id="invoice_templateidtable"]//tr[1]/td[contains(text(), "'. $templatename .'")]/../td[4]/input[@checked="checked"]'), 'Invoice Template was selected');
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Go to 'Invoices' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Invoices', 'link_text')->click();
|
||||
|
||||
diag("Try to create a empty Invoice");
|
||||
$d->find_element('Create Invoice', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Invoice")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="templateidtable"]/tbody/tr[1]/td[4]/input');
|
||||
$d->unselect_if_selected('//*[@id="contractidtable"]/tbody/tr[1]/td[6]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Customer field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invoice Period field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="templateidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#templateidtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="templateidtable_filter"]/label/input', 'xpath', $templatename);
|
||||
ok($d->find_element_by_xpath('//*[@id="templateidtable"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Template was found');
|
||||
$d->select_if_unselected('//*[@id="templateidtable"]/tbody/tr[1]/td[4]/input');
|
||||
$d->fill_element('#contractidtable_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contractidtable tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#contractidtable_filter input', 'css', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="contractidtable"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer found');
|
||||
$d->select_if_unselected('//*[@id="contractidtable"]/tbody/tr[1]/td[6]/input');
|
||||
$d->find_element('//*[@id="period_datepicker"]')->click();
|
||||
$d->find_element('//*[@id="ui-datepicker-div"]//button[contains(text(), "Today")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Invoice");
|
||||
$d->fill_element('//*[@id="Invoice_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Invoice_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Invoice_table_filter"]/label/input', 'xpath', $contactmail);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="Invoice_table"]//tr[1]/td[contains(text(), "' . $custnum . '")]'), 'Customer# is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Invoice_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Customer Email is correct');
|
||||
my $invnum = $d->get_text('//*[@id="Invoice_table"]/tbody/tr/td[1]');
|
||||
$compstring = "Invoice #" . $invnum . " successfully created";
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, 'Correct Alert was shown');
|
||||
|
||||
diag("Try to NOT delete Invoice");
|
||||
$d->move_and_click('//*[@id="Invoice_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="Invoice_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Invoice is still here");
|
||||
$d->fill_element('//*[@id="Invoice_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Invoice_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Invoice_table_filter"]/label/input', 'xpath', $contactmail);
|
||||
ok($d->find_element_by_xpath('//*[@id="Invoice_table"]//tr[1]/td[contains(text(), "' . $custnum . '")]'), 'Invoice is still here');
|
||||
ok($d->find_element_by_xpath('//*[@id="Invoice_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Invoice is still here');
|
||||
|
||||
diag("Try to delete Invoice");
|
||||
$d->move_and_click('//*[@id="Invoice_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="Invoice_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Invoice has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Invoice successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="Invoice_table_filter"]/label/input', 'xpath', $contactmail);
|
||||
ok($d->find_element_by_css('#Invoice_table tr > td.dataTables_empty', 'css'), 'Invoice has been deleted');
|
||||
|
||||
diag("Go to 'Invoice Templates' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Invoice Templates", 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete Invoice Template");
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#InvoiceTemplate_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', $templatename);
|
||||
$d->move_and_click('//*[@id="InvoiceTemplate_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="InvoiceTemplate_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Invoice Template is still here");
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#InvoiceTemplate_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', $templatename);
|
||||
ok($d->find_element_by_xpath('//*[@id="InvoiceTemplate_table"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Template is still here');
|
||||
|
||||
diag("Try to delete Invoice Template");
|
||||
$d->move_and_click('//*[@id="InvoiceTemplate_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="InvoiceTemplate_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Invoice Template has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Invoice template successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="InvoiceTemplate_table_filter"]/label/input', 'xpath', $templatename);
|
||||
ok($d->find_element_by_css('#InvoiceTemplate_table tr > td.dataTables_empty', 'css'), 'Invoice Template has been deleted');
|
||||
|
||||
$c->delete_customer($customerid);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
$c->delete_contact($contactmail);
|
||||
$c->delete_billing_profile($billingname);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_invoice.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,311 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
use TryCatch;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $ncosname = ("ncos" . int(rand(100000)) . "level");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $lnpcarrier = ("lnp" . int(rand(100000)) . "carrier");
|
||||
my $prefix = ("prefix" . int(rand(100000)) . "stuff");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_ncos($resellername, $ncosname);
|
||||
|
||||
diag("Go to 'Number Porting' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Number Porting', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty LNP Carrier");
|
||||
$d->find_element('Create LNP Carrier', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create LNP Carrier")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Prefix field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $lnpcarrier);
|
||||
$d->fill_element('//*[@id="prefix"]', 'xpath', $prefix);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search LNP Carrier");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'LNP carrier successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $prefix . '")]'), 'Prefix is correct');
|
||||
|
||||
diag("Edit LNP Carrier");
|
||||
$d->move_and_click('//*[@id="lnp_carriers_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="lnp_carriers_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit LNP Carrier")]'), 'Edit window has been opened');
|
||||
$lnpcarrier = ("lnp" . int(rand(100000)) . "carrier");
|
||||
$prefix = ("prefix" . int(rand(100000)) . "stuff");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $lnpcarrier);
|
||||
$d->fill_element('//*[@id="prefix"]', 'xpath', $prefix);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search LNP Carrier");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'LNP carrier successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $prefix . '")]'), 'Prefix is correct');
|
||||
|
||||
diag("Go to 'NCOS Levels' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("NCOS Levels", 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty NCOS Level");
|
||||
$d->find_element("Create NCOS Level", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create NCOS Level")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Level Name field is required")]'));
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Search NCOS Level");
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
|
||||
|
||||
diag("Check NCOS Level details");
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), ' . $ncosname . ')]'), 'NCOS name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), "blacklist")]'), 'NCOS mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), "This is a simple description")]'), 'NCOS description is correct');
|
||||
|
||||
diag("Edit NCOS Level");
|
||||
$ncosname = ("ncos" . int(rand(100000)) . "level");
|
||||
$d->move_and_click('//*[@id="ncos_level_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="ncos_level_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit NCOS Level")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="level"]', 'xpath', $ncosname);
|
||||
$d->find_element('//*[@id="mode"]/option[@value="whitelist"]')->click();
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'This is a very simple description');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search NCOS Level");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS level successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
|
||||
|
||||
diag("Check NCOS Level details");
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), ' . $resellername . ')]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), ' . $ncosname . ')]'), 'NCOS name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), "whitelist")]'), "NCOS mode is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), "This is a very simple description")]'), 'NCOS description is correct');
|
||||
|
||||
diag("Enter NCOS Patterns");
|
||||
$d->move_and_click('//*[@id="ncos_level_table"]/tbody/tr[1]/td/div/a[contains(text(), "Patterns")]', 'xpath', '//*[@id="ncos_level_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "NCOS details")]'), "We are on the correct page");
|
||||
sleep 1;
|
||||
|
||||
diag("Create a new empty Pattern");
|
||||
$d->find_element('Create Pattern Entry', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Number Pattern")]'), "Edit window has been opened");
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Pattern field is required")]'));
|
||||
|
||||
diag("Enter Pattern details");
|
||||
$d->fill_element('//*[@id="pattern"]', 'xpath', '^439');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Austrian Premium Numbers');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Pattern details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS pattern successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]//tr[1]/td[contains(text(), "^439")]'), 'Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]//tr[1]/td[contains(text(), "Austrian Premium Numbers")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Pattern");
|
||||
$d->move_and_click('//*[@id="number_pattern_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="number_pattern_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Number Pattern")]'), "Edit window has been opened");
|
||||
$d->fill_element('//*[@id="pattern"]', 'xpath', '^491');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'German Premium Numbers');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Pattern details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS pattern successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]//tr[1]/td[contains(text(), "^491")]'), 'Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]//tr[1]/td[contains(text(), "German Premium Numbers")]'), 'Description is correct');
|
||||
|
||||
diag("Create LNP entry");
|
||||
$d->find_element("Create LNP Entry", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create LNP Carrier")]'), 'Edit window has been opened');
|
||||
|
||||
diag("Enter LNP details");
|
||||
$d->fill_element('//*[@id="lnp_provideridtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#lnp_provideridtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="lnp_provideridtable_filter"]/label/input', 'xpath', $lnpcarrier);
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_provideridtable"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'LNP Carrier was found');
|
||||
$d->select_if_unselected('//*[@id="lnp_provideridtable"]/tbody/tr[1]/td[4]/input[@type="checkbox"]');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Rule for LNP Carrier 1');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check LNP details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS lnp entry successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'LNP Carrier is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "Rule for LNP Carrier 1")]'), 'Description is correct');
|
||||
|
||||
diag("Edit LNP entry");
|
||||
$d->move_and_click('//*[@id="lnp_carriers_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="lnp_carriers_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit LNP Carrier")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Rule for LNP Carrier 2');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check LNP details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS lnp entry successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'LNP Carrier is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "Rule for LNP Carrier 2")]'), 'Description is correct');
|
||||
|
||||
diag("Edit NCOS settings");
|
||||
$d->find_element('//*[@id="number_patterns_extra"]//div//a')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Number Pattern")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="local_ac"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if NCOS settings have been applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS level setting successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="local_ac"][@checked="checked"]'), 'Setting "Include local area code" was applied');
|
||||
|
||||
diag("Creating Domain to add NCOS Level");
|
||||
$c->create_domain($domainstring, $resellername);
|
||||
|
||||
diag("Searching Domain");
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Domain_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="Domain_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), 'Domain was found');
|
||||
$d->move_and_click('//*[@id="Domain_table"]//tr[1]//td//a[contains(text(), "Preferences")]', 'xpath', '//*[@id="Domain_table_filter"]/label/input');
|
||||
|
||||
diag("Open 'Call Blockings'");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="preference_groups"]//div//a[contains(text(),"Call Blockings")]'));
|
||||
|
||||
diag("Edit setting 'NCOS'");
|
||||
$d->move_and_click('//table//tr//td[contains(text(), "ncos")]/../td//a[contains(text(), "Edit")]', 'xpath', '//table//tr//td[contains(text(), "adm_cf_ncos")]/../td//a[contains(text(), "Edit")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="ncos"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="ncos"]/option[contains(text(), "' . $ncosname . '")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if NCOS Level was applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference ncos successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "ncos")]/../td/select/option[contains(text(), "' . $ncosname . '")][@selected="selected"]'), 'NCOS Level was applied');
|
||||
|
||||
diag("Go back to 'NCOS Levels' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("NCOS Levels", 'link_text')->click();
|
||||
|
||||
diag("Search NCOS Level");
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), "' . $ncosname . '")]'), 'NCOS was found');
|
||||
|
||||
diag("Go to 'NCOS Patterns' page");
|
||||
$d->move_and_click('//*[@id="ncos_level_table"]/tbody/tr[1]/td/div/a[contains(text(), "Patterns")]', 'xpath', '//*[@id="ncos_level_table_filter"]/label/input');
|
||||
|
||||
diag("Delete NCOS Number pattern");
|
||||
$d->move_and_click('//*[@id="number_pattern_table"]//tr//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="number_pattern_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if NCOS Number pattern has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS pattern successfully deleted', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#number_pattern_table tr > td.dataTables_empty', 'css'), 'NCOS Number pattern has been deleted');
|
||||
|
||||
diag("Delete LNP Entry");
|
||||
$d->move_and_click('//*[@id="lnp_carriers_table"]//tr//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="lnp_carriers_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if LNP Entry has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'NCOS lnp entry successfully deleted', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'LNP Entry has been deleted');
|
||||
|
||||
diag("Try to NOT delete NCOS");
|
||||
$c->delete_ncos($ncosname, 1);
|
||||
|
||||
diag("Check if NCOS is still here");
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
|
||||
ok($d->find_element_by_xpath('//*[@id="ncos_level_table"]//tr[1]/td[contains(text(), "' . $ncosname . '")]'), 'NCOS still here');
|
||||
|
||||
diag("Try to delete NCOS");
|
||||
$c->delete_ncos($ncosname);
|
||||
|
||||
diag("Check if NCOS has been deleted");
|
||||
$d->fill_element('//*[@id="ncos_level_table_filter"]/label/input', 'xpath', $ncosname);
|
||||
ok($d->find_element_by_css('#ncos_level_table tr > td.dataTables_empty', 'css'), 'NCOS has been deleted');
|
||||
|
||||
diag("Go to 'Number Porting' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Number Porting", 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete LNP Carrier");
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'LNP Carrier found');
|
||||
$d->move_and_click('//*[@id="lnp_carriers_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="lnp_carriers_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if LNP Carrier is still here");
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
|
||||
ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]//tr[1]/td[contains(text(), "' . $lnpcarrier . '")]'), 'LNP Carrier is still here');
|
||||
|
||||
diag("Try to delete LNP Carrier");
|
||||
$d->move_and_click('//*[@id="lnp_carriers_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="lnp_carriers_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if LNP Carrier has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "LNP carrier successfully deleted", 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="lnp_carriers_table_filter"]/label/input', 'xpath', $lnpcarrier);
|
||||
$d->move_and_click('//*[@id="lnp_numbers_table_filter"]//label//input', 'xpath', '//*[@id="content"]/div/h3[contains(text(), "LNP Numbers")]');
|
||||
ok($d->find_element_by_css('#lnp_carriers_table tr > td.dataTables_empty', 'css'), 'LNP Carrier has been deleted');
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
|
||||
$c->delete_domain($domainstring);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_ncos.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,365 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $soundsetname = ("sound" . int(rand(100000)) . "set");
|
||||
my $phonebookname = ("phone" . int(rand(100000)) . "book");
|
||||
my $contactmail = ("contact" . int(rand(100000)) . '@test.org');
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_domain($domainstring);
|
||||
|
||||
diag("Go to 'Call List Suppressions' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Call List Suppressions', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Call List Suppression");
|
||||
$d->find_element('Create call list suppression', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Call List Suppression")]'), "Edit window has been opened");
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Pattern field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Label field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="domain"]', 'xpath', $domainstring);
|
||||
$d->fill_element('//*[@id="pattern"]', 'xpath', 'test');
|
||||
$d->fill_element('//*[@id="label"]', 'xpath', 'label');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Call List Suppression");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Call list suppression successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#call_list_suppression_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), "Domain is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "outgoing")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "test")]'), 'Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "filter")]'), 'Mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "label")]'), 'Label is correct');
|
||||
|
||||
diag("Edit Call List Suppression");
|
||||
$d->move_and_click('//*[@id="call_list_suppression_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="call_list_suppression_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Call List Suppression")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="domain"]')->click();
|
||||
sleep 1;
|
||||
$d->fill_element('//*[@id="domain"]', 'xpath', $domainstring);
|
||||
$d->find_element('//*[@id="direction"]/option[@value="incoming"]')->click();
|
||||
$d->fill_element('//*[@id="pattern"]', 'xpath', 'testing');
|
||||
$d->find_element('//*[@id="mode"]/option[@value="obfuscate"]')->click();
|
||||
$d->fill_element('//*[@id="label"]', 'xpath', 'text');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Call list suppression successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), "Domain is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "incoming")]'), 'Direction is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "testing")]'), 'Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "obfuscate")]'), 'Mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "text")]'), 'Label is correct');
|
||||
|
||||
diag("Try to NOT delete Call List Suppression");
|
||||
$d->move_and_click('//*[@id="call_list_suppression_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="call_list_suppression_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Call List Suppression is still here");
|
||||
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#call_list_suppression_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="call_list_suppression_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), 'Call List Suppression is still here');
|
||||
|
||||
diag("Try to delete Call List Suppression");
|
||||
$d->move_and_click('//*[@id="call_list_suppression_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="call_list_suppression_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Call List Suppression has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Call list suppression successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="call_list_suppression_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_css('#call_list_suppression_table tr > td.dataTables_empty', 'css'), 'Call List Suppression has been deleted');
|
||||
|
||||
diag("Go to 'Phonebook' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Phonebook', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Phonebook entry");
|
||||
$d->find_element('Create Phonebook Entry', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Phonebook")]'), "Edit window has been opened");
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]//tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Number field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $phonebookname);
|
||||
$d->fill_element('//*[@id="number"]', 'xpath', '0123456789');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Phonebook entry");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "' . $phonebookname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "0123456789")]'), 'Number is correct');
|
||||
|
||||
diag("Edit Phonebook entry");
|
||||
$phonebookname = ("phone" . int(rand(100000)) . "book");
|
||||
$d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="phonebook_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Phonebook")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $phonebookname);
|
||||
$d->fill_element('//*[@id="number"]', 'xpath', '9876543210');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Phonebook entry");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "' . $phonebookname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "9876543210")]'), 'Number is correct');
|
||||
|
||||
diag("Try to NOT delete Phonebook entry");
|
||||
$d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="phonebook_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
$d->refresh();
|
||||
|
||||
diag("Check if Phonebook entry is still here");
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "' . $phonebookname . '")]'), 'Phonebook entry is still here');
|
||||
|
||||
diag("Try to delete Phonebook entry");
|
||||
$d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="phonebook_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Phonebook entry has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]//input', 'xpath', $phonebookname);
|
||||
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Phonebook entry has been deleted');
|
||||
|
||||
diag("Go to 'Contacts' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Contacts', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Contact");
|
||||
$d->find_element('Create Contact', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Contact")]'), "Edit window has been opened");
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]//tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Email field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="firstname"]', 'xpath', 'Test');
|
||||
$d->fill_element('//*[@id="lastname"]', 'xpath', 'User');
|
||||
$d->fill_element('//*[@id="company"]', 'xpath', 'SIPWISE');
|
||||
$d->fill_element('//*[@id="email"]', 'xpath', $contactmail);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Contact");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contact successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "Test")]'), 'First Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "User")]'), 'Last Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "SIPWISE")]'), 'Company is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Email is correct');
|
||||
|
||||
diag("Edit Contact");
|
||||
$contactmail = ("contact" . int(rand(100000)) . '@test.org');
|
||||
$d->move_and_click('//*[@id="contact_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="contact_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Contact")]'), "Edit window has been opened");
|
||||
$d->fill_element('//*[@id="firstname"]', 'xpath', 'Tester');
|
||||
$d->fill_element('//*[@id="lastname"]', 'xpath', 'Using');
|
||||
$d->fill_element('//*[@id="company"]', 'xpath', 'sip');
|
||||
$d->fill_element('//*[@id="email"]', 'xpath', $contactmail);
|
||||
$d->fill_element('#company', 'css', 'sip');
|
||||
$d->fill_element('#street', 'css', 'Europaring');
|
||||
$d->fill_element('#postcode', 'css', '2345');
|
||||
$d->fill_element('#city', 'css', 'Brunn/Gebirge');
|
||||
$d->fill_element('#countryidtable_filter input', 'css', 'thisshouldnotexist');
|
||||
$d->find_element('#countryidtable tr > td.dataTables_empty', 'css');
|
||||
$d->fill_element('#countryidtable_filter input', 'css', 'Austria');
|
||||
$d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains(text(),"Austria")]/..//input[@type="checkbox"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Contact");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contact successfully changed', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "Tester")]'), 'First Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "Using")]'), 'Last Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "sip")]'), 'Company is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Email is correct');
|
||||
|
||||
diag("Try to NOT delete Contact");
|
||||
$d->move_and_click('//*[@id="contact_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="contact_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
$d->refresh();
|
||||
|
||||
diag("Check if Contact is still here");
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), "Contact is still here");
|
||||
|
||||
diag("Try to delete Contact");
|
||||
$d->move_and_click('//*[@id="contact_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="contact_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Contact has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contact successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $resellername);
|
||||
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Contact has been deleted');
|
||||
|
||||
diag("Go to 'Security Bans' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Security Bans', 'link_text')->click();
|
||||
|
||||
diag("Try to refresh Banned IPs");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->find_element('Refresh banned IPs data', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="banned_ips_table_processing"][@style="display: none;"]'), "Processing is done");
|
||||
|
||||
diag("Try to refresh banned users");
|
||||
$d->find_element('Refresh banned users data', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="banned_users_table_processing"][@style="display: none;"]'), "Processing is done");
|
||||
|
||||
diag("Go to homepage");
|
||||
$d->find_element('//*[@id="main-nav"]/li[1]/a')->click();
|
||||
|
||||
diag("Change language to German");
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]/a')->click();
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]//a[@href="?lang=de"]')->click();
|
||||
|
||||
diag("Check if language was applied");
|
||||
#is($d->get_text_safe('//*[@id="masthead"]/div/div/div/h2'), 'Übersicht', "language");
|
||||
is($d->get_text_safe('//*[@id="admin_billing_overview_lazy_items_header"]/div[1]'), 'Verrechnung', 'was');
|
||||
is($d->get_text_safe('//*[@id="admin_peering_overview_lazy_items_header"]/div[1]'), 'Peerings', 'changed');
|
||||
is($d->get_text_safe('//*[@id="admin_reseller_overview_lazy_items_header"]/div[1]'), 'Reseller', 'successfully');
|
||||
|
||||
diag("Change language to French");
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]/a')->click();
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]//a[@href="?lang=fr"]')->click();
|
||||
|
||||
diag("Check if language was applied");
|
||||
is($d->get_text_safe('//*[@id="masthead"]/div/div/div/h2'), 'Tableau de bord', "language");
|
||||
is($d->get_text_safe('//*[@id="admin_billing_overview_lazy_items_header"]/div[1]'), 'Facturation', 'was');
|
||||
#is($d->get_text_safe('//*[@id="admin_peering_overview_lazy_items_header"]/div[1]'), 'Opérateurs', 'changed');
|
||||
is($d->get_text_safe('//*[@id="admin_reseller_overview_lazy_items_header"]/div[1]'), 'Revendeurs', 'successfully');
|
||||
|
||||
diag("Change language to Italian");
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]/a')->click();
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]//a[@href="?lang=it"]')->click();
|
||||
|
||||
diag("Check if language was applied");
|
||||
is($d->get_text_safe('//*[@id="masthead"]/div/div/div/h2'), 'Dashboard', "language");
|
||||
is($d->get_text_safe('//*[@id="admin_billing_overview_lazy_items_header"]/div[1]'), 'Fatturazione', 'was');
|
||||
is($d->get_text_safe('//*[@id="admin_peering_overview_lazy_items_header"]/div[1]'), 'Peers', 'changed');
|
||||
is($d->get_text_safe('//*[@id="admin_reseller_overview_lazy_items_header"]/div[1]'), 'Rivenditori', 'successfully');
|
||||
|
||||
diag("Change language to Spanish");
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]/a')->click();
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]//a[@href="?lang=es"]')->click();
|
||||
|
||||
diag("Check if language was applied");
|
||||
#is($d->get_text_safe('//*[@id="masthead"]/div/div/div/h2'), 'Tablón', "language");
|
||||
#is($d->get_text_safe('//*[@id="admin_billing_overview_lazy_items_header"]/div[1]'), 'Facturación', 'was');
|
||||
is($d->get_text_safe('//*[@id="admin_peering_overview_lazy_items_header"]/div[1]'), 'Peerings', 'changed');
|
||||
is($d->get_text_safe('//*[@id="admin_reseller_overview_lazy_items_header"]/div[1]'), 'Resellers', 'successfully');
|
||||
|
||||
=pod
|
||||
diag("Change language to Russian");
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]/a')->click();
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]//a[@href="?lang=ru"]')->click();
|
||||
|
||||
diag("Check if language was applied");
|
||||
is($d->get_text_safe('//*[@id="masthead"]/div/div/div/h2'), 'Главная', "language");
|
||||
is($d->get_text_safe('//*[@id="admin_billing_overview_lazy_items_header"]/div[1]'), 'Биллинг', 'was');
|
||||
is($d->get_text_safe('//*[@id="admin_peering_overview_lazy_items_header"]/div[1]'), 'SIP Транк', 'changed');
|
||||
is($d->get_text_safe('//*[@id="admin_reseller_overview_lazy_items_header"]/div[1]'), 'Реселлеры', 'successfully');
|
||||
=cut
|
||||
|
||||
diag("Change language Back to English");
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]/a')->click();
|
||||
$d->find_element('//*[@id="top-nav"]/ul/li[3]//a[@href="?lang=en"]')->click();
|
||||
|
||||
$c->delete_domain($domainstring);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("Test the Handbook");
|
||||
$d->find_element('//*[@id="main-nav"]/li[2]/a')->click();
|
||||
$d->find_element('//*[@id="main-nav"]//li//a[contains(text(), "Handbook")]')->click();
|
||||
|
||||
diag("Check if we start at the right page");
|
||||
ok($d->find_element_by_xpath('/html/body/header/nav/div[1]/a[contains(., "The Sipwise NGCP Handbook")]'), "We are on the right page");
|
||||
|
||||
diag("Change page");
|
||||
sleep 1; #else the element will get blocked by... itself? (<html>)
|
||||
|
||||
$d->find_element('/html/body/div/div/aside/div/div[1]/nav/ul/li[2]/ul/li/a')->click();
|
||||
|
||||
diag("Check if page was successfully changed");
|
||||
ok($d->find_element_by_xpath('/html/body/div/main/div[2]/article/h1[contains(., "Architecture")]'), "We are on the right page");
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_other.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,384 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $groupname = ("group" . int(rand(100000)) . "test");
|
||||
my $servername = ("peering" . int(rand(100000)) . "server");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
|
||||
diag("Go to 'Peerings' page");
|
||||
$d->find_element('//*[@id="content"]//div[contains(text(), "Peerings")]/../../div/a')->click();
|
||||
|
||||
diag("Try to create an empty Peering Group");
|
||||
$d->find_element('//*[@id="masthead"]//h2[contains(text(),"SIP Peering Groups")]');
|
||||
my $peerings_uri = $d->get_current_url();
|
||||
$d->find_element('Create Peering Group', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create SIP Peering Group")]'), "Edit window has been opened");
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Contract field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Create a new Contract");
|
||||
$d->find_element('//input[@type="button" and @value="Create Contract"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Contract")]'), "Edit window has been opened");
|
||||
$d->fill_element('//*[@id="contactidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contactidtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contactidtable_filter"]/label/input', 'xpath', 'default-system@default.invalid');
|
||||
ok($d->find_element_by_xpath('//*[@id="contactidtable"]//tr[1]/td[contains(text(), "default-system@default.invalid")]'), 'Default Contact was found');
|
||||
$d->select_if_unselected('//table[@id="contactidtable"]/tbody/tr[1]//input[@type="checkbox"]');
|
||||
$d->scroll_to_element($d->find_element('//table[@id="billing_profileidtable"]'));
|
||||
$d->select_if_unselected('//table[@id="billing_profileidtable"]/tbody/tr[1]//input[@type="checkbox"]');
|
||||
$d->find_element('//*[@id="status"]')->click();
|
||||
$d->find_element('//*[@id="status"]/option[@value="active"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Continue creating a Peering Group");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create SIP Peering Group")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $groupname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'A group created for testing purposes');
|
||||
$d->find_element('//*[@id="priority"]')->click();
|
||||
$d->find_element('//*[@id="priority"]/option[@value="3"]')->click();
|
||||
$d->select_if_unselected('//table[@id="contractidtable"]/tbody/tr[1]//input[@type="checkbox"]');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Search Peering Group");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering group successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sip_peering_group_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
|
||||
diag("Check Peering Group details");
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "default-system@default.invalid")]'), 'Contact is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "3")]', 'Priority is correct'));
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "A group created for testing purposes")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Peering Group");
|
||||
$groupname = ("group" . int(rand(100000)) . "test");
|
||||
$d->move_and_click('//*[@id="sip_peering_group_table"]/tbody/tr[1]//td//div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="sip_peering_group_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit SIP Peering Group")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#name', 'css', $groupname);
|
||||
$d->fill_element('#description', 'css', 'A group created for very testing purposes');
|
||||
$d->find_element('//*[@id="priority"]')->click();
|
||||
$d->find_element('//*[@id="priority"]/option[@value="1"]')->click();
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Search Peering Group");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering group successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sip_peering_group_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
|
||||
diag("Check Peering Group details");
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "default-system@default.invalid")]'), 'Contact is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "1")]'), 'Priority is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "A group created for very testing purposes")]'), 'Description is correct');
|
||||
|
||||
diag("Go to 'Peering Group Details' page");
|
||||
$d->move_and_click('//*[@id="sip_peering_group_table"]/tbody/tr[1]//td//div//a[contains(text(), "Details")]', 'xpath', '//*[@id="sip_peering_group_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "SIP Peering Group")]'), 'We are on the correct Page');
|
||||
sleep 1;
|
||||
|
||||
diag("Create an empty Outbound Peering Rule");
|
||||
$d->find_element('//a[contains(text(),"Create Outbound Peering Rule")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Outbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if Outbound Peering Rule was created");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering rule successfully created', 'Correct Alert was shown');
|
||||
|
||||
diag("Delete empty Outbound Peering Rule");
|
||||
ok($d->move_and_click('//*[@id="PeeringRules_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="PeeringRules_table_filter"]//input'));
|
||||
$d->find_element('#dataConfirmOK', 'css')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering rule successfully deleted', 'Correct Alert was shown');
|
||||
|
||||
diag("Create Outbound Peering Rule");
|
||||
$d->find_element('//a[contains(text(),"Create Outbound Peering Rule")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Outbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#callee_prefix', 'css', '43');
|
||||
$d->fill_element('#callee_pattern', 'css', '^sip');
|
||||
$d->fill_element('#caller_pattern', 'css', '999');
|
||||
$d->fill_element('#description', 'css', 'for testing purposes');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Outbound Peering Rule details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering rule successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "43")]'), 'Prefix is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "^sip")]'), 'Callee Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "999")]'), 'Caller Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "for testing purposes")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Outbound Peering Rule");
|
||||
$d->move_and_click('//*[@id="PeeringRules_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="PeeringRules_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Outbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#callee_prefix', 'css', '49');
|
||||
$d->fill_element('#callee_pattern', 'css', '^sup');
|
||||
$d->fill_element('#caller_pattern', 'css', '888');
|
||||
$d->fill_element('#description', 'css', 'for very testing purposes');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Outbound Peering Rule details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering rule successfully changed', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "49")]'), 'Prefix is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "^sup")]'), 'Callee Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "888")]'), 'Caller Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "for very testing purposes")]'), 'Description is correct');
|
||||
|
||||
diag("Try to create an empty Inbound Peering Rule");
|
||||
$d->find_element('//a[contains(text(),"Create Inbound Peering Rule")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Inbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if creation failed");
|
||||
ok($d->find_element_by_css('#InboundPeeringRules_table tr > td.dataTables_empty', 'css'), 'Inbound Peering Rule was not created');
|
||||
|
||||
diag("Create Inbound Peering Rule");
|
||||
$d->find_element('//a[contains(text(),"Create Inbound Peering Rule")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Inbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="pattern"]', 'xpath', '^sip');
|
||||
$d->fill_element('//*[@id="reject_code"]', 'xpath', '403');
|
||||
$d->fill_element('//*[@id="reject_reason"]', 'xpath', 'forbidden');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Inbound Peering Rule details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Inbound peering rule successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]//tr[1]/td[contains(text(), "^sip")]'), 'Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]//tr[1]/td[contains(text(), "403")]'), 'Reject Code is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]//tr[1]/td[contains(text(), "forbidden")]'), 'Reject Reason is correct');
|
||||
|
||||
diag("Edit Inbound Peering Rule");
|
||||
$d->scroll_to_element($d->find_element('//a[contains(text(),"Create Inbound Peering Rule")]'));
|
||||
$d->move_and_click('//*[@id="InboundPeeringRules_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="InboundPeeringRules_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Inbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="pattern"]', 'xpath', '^sup');
|
||||
$d->fill_element('//*[@id="reject_code"]', 'xpath', '404');
|
||||
$d->fill_element('//*[@id="reject_reason"]', 'xpath', 'not found');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Inbound Peering Rule details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Inbound peering rule successfully changed', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]//tr[1]/td[contains(text(), "^sup")]'), 'Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]//tr[1]/td[contains(text(), "404")]'), 'Reject Code is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]//tr[1]/td[contains(text(), "not found")]'), 'Reject Reason is correct');
|
||||
|
||||
diag("Create an empty Peering Server");
|
||||
$d->find_element('//a[contains(text(),"Create Peering Server")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Peering Server")]'), 'Edit window has been opened');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "IP Address field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('#name', 'css', $servername);
|
||||
$d->fill_element('#ip', 'css', '10.0.0.100');
|
||||
$d->fill_element('#host', 'css', 'sipwise.com');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Peering Server details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering server successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]//tr[1]/td[contains(text(), "' . $servername . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]//tr[1]/td[contains(text(), "10.0.0.100")]'), 'IP is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]//tr[1]/td[contains(text(), "sipwise.com")]'), 'Host is correct');
|
||||
|
||||
diag("Edit Peering Server");
|
||||
$servername = ("peering" . int(rand(100000)) . "server");
|
||||
$d->move_and_click('//*[@id="peering_servers_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="peering_servers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Peering Server")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#name', 'css', $servername);
|
||||
$d->fill_element('#ip', 'css', '10.0.1.101');
|
||||
$d->fill_element('#host', 'css', 'google.at');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Peering Server details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering server successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]//tr[1]/td[contains(text(), "' . $servername . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]//tr[1]/td[contains(text(), "10.0.1.101")]'), "IP is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]//tr[1]/td[contains(text(), "google.at")]'), "Host is correct");
|
||||
|
||||
diag("Delete Inbound Peering Rule");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="InboundPeeringRules_table_filter"]/label/input'));
|
||||
$d->move_and_click('//*[@id="InboundPeeringRules_table"]/tbody/tr[1]//td//div//a[contains(text(), "Delete")]', 'xpath', '//*[@id="InboundPeeringRules_table_filter"]//input');
|
||||
$d->find_element('#dataConfirmOK', 'css')->click();
|
||||
|
||||
diag("Check if Inbound Peering Rule has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Inbound peering rule successfully deleted', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#InboundPeeringRules_table tr > td.dataTables_empty', 'css'), 'Inbound Peering Rule has been deleted');
|
||||
|
||||
diag("Go to 'Peering Server Preferences' page");
|
||||
$d->move_and_click('//*[@id="peering_servers_table"]/tbody/tr[1]//td//div//a[contains(text(), "Preferences")]', 'xpath', '//*[@id="peering_servers_table_filter"]//input');
|
||||
|
||||
diag("Go to 'Number Manipulations'");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Number Manipulations', 'link_text'));
|
||||
|
||||
diag("Edit preference 'inbound_upn'");
|
||||
$d->move_and_click('//table//td[contains(text(), "inbound_upn")]/..//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Number Manipulation")]');
|
||||
|
||||
diag("Change to 'P-Asserted-Identity'");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="inbound_upn"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="inbound_upn"]/option[@value="pai_user"]')->click();
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if value has been applied");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Number Manipulations', 'link_text'));
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference inbound_upn successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//table//td[contains(text(), "inbound_upn")]/../td/select/option[@selected="selected"][contains(text(), "P-Asserted-Identity")]'), "Value has been applied");
|
||||
|
||||
diag("Go to 'Remote Authentication'");
|
||||
$d->scroll_to_element($d->find_element('Remote Authentication', 'link_text'));
|
||||
|
||||
diag("Edit setting 'peer_auth_user'");
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "peer_auth_user")]/../td/div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Remote Authentication")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="peer_auth_user"]', 'xpath', 'peeruser1');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if 'peer_auth_user' value has been set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference peer_auth_user successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Remote Authentication', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "peer_auth_user")]/../td[4][contains(text(), "peeruser1")]'), 'peer_auth_user value has been set');
|
||||
|
||||
diag("Edit setting 'peer_auth_pass'");
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "peer_auth_pass")]/../td/div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Remote Authentication")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="peer_auth_pass"]', 'xpath', 'peerpass1');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if 'peer_auth_pass' value has been set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference peer_auth_pass successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Remote Authentication', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "peer_auth_pass")]/../td[4][contains(text(), "peerpass1")]'), 'peer_auth_pass value has been set');
|
||||
|
||||
diag("Edit setting 'peer_auth_realm'");
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "peer_auth_realm")]/../td/div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Remote Authentication")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="peer_auth_realm"]', 'xpath', 'testpeering.com');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if 'peer_auth_realm' value has been set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference peer_auth_realm successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Remote Authentication', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "peer_auth_realm")]/../td[4][contains(text(), "testpeering.com")]'), 'peer_auth_realm value has been set');
|
||||
|
||||
diag("Go to 'Peering Overview' page");
|
||||
$d->scroll_to_element($d->find_element('//*[@id="main-nav"]'));
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Tools")]')->click();
|
||||
$d->find_element('Peering Overview', 'link_text')->click();
|
||||
|
||||
diag("Search Peering Rule");
|
||||
$d->fill_element('//*[@id="PeeringOverview_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#PeeringOverview_table tr > td.dataTables_empty', 'css'), 'Inbound Peering Rule was not created');
|
||||
$d->fill_element('//*[@id="PeeringOverview_table_filter"]/label/input', 'xpath', $groupname);
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringOverview_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Peering Rule was found');
|
||||
|
||||
diag("Edit Peering Rule");
|
||||
$d->move_and_click('//*[@id="PeeringOverview_table"]//tr[1]//td//a[contains(text(), "Rule")]', 'xpath', '//*[@id="PeeringOverview_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Outbound Peering Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('#caller_pattern', 'css', '999');
|
||||
$d->fill_element('#description', 'css', 'see if stuff changes');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if Peering rule was edited");
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringOverview_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Peering Rule was found');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringOverview_table"]//tr[1]/td[contains(text(), "see if stuff changes")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Peering Group");
|
||||
$d->move_and_click('//*[@id="PeeringOverview_table"]//tr[1]//td//a[contains(text(), "Group")]', 'xpath', '//*[@id="PeeringOverview_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit SIP Peering Group")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'see if stuff changes');
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Go back to 'Peerings' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Peerings', 'link_text')->click();
|
||||
|
||||
diag("Search Peering Group");
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sip_peering_group_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Group was found');
|
||||
|
||||
diag("Check if description was changed");
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "see if stuff changes")]'), 'Description is correct');
|
||||
|
||||
diag("Delete Peering Server");
|
||||
$d->move_and_click('//*[@id="sip_peering_group_table"]/tbody/tr[1]//td//div//a[contains(text(), "Details")]', 'xpath', '//*[@id="sip_peering_group_table_filter"]//input');
|
||||
$d->move_and_click('//*[@id="peering_servers_table"]/tbody/tr[1]//td//div//a[contains(text(), "Delete")]', 'xpath', '//*[@id="peering_servers_table_filter"]//input');
|
||||
$d->find_element('#dataConfirmOK', 'css')->click();
|
||||
|
||||
diag("Check if Peering Server has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering server successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="peering_servers_table_filter"]/label/input', 'xpath', $servername);
|
||||
ok($d->find_element_by_css('#peering_servers_table tr > td.dataTables_empty', 'css'), 'Peering Server has been deleted');
|
||||
|
||||
diag("Check Outbound Peering Rule details");
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "49")]'), 'Prefix is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "^sup")]'), 'Callee Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "999")]'), 'Caller Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]//tr[1]/td[contains(text(), "see if stuff changes")]'), 'Description is correct');
|
||||
|
||||
diag("Delete Outbound Peering Rule");
|
||||
$d->move_and_click('//*[@id="PeeringRules_table"]/tbody/tr[1]//td//div//a[contains(text(), "Delete")]', 'xpath', '//*[@id="PeeringRules_table_filter"]//input');
|
||||
$d->find_element('#dataConfirmOK', 'css')->click();
|
||||
|
||||
diag("Check if Outbound Peering Rule has been deleted");
|
||||
#is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering rule successfully deleted', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_css('#PeeringRules_table tr > td.dataTables_empty', 'css'), 'Outbound peering rule has been deleted');
|
||||
|
||||
diag("Go back to 'SIP Peering Groups'");
|
||||
$d->get($peerings_uri);
|
||||
|
||||
diag("Try to NOT delete Peering Group");
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sip_peering_group_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Peering Group was found');
|
||||
$d->move_and_click('//*[@id="sip_peering_group_table"]/tbody/tr[1]//td//div//a[contains(text(), "Delete")]', 'xpath', '//*[@id="sip_peering_group_table_filter"]//input');
|
||||
$d->find_element('#dataConfirmCancel', 'css')->click();
|
||||
|
||||
diag('Check if Peering Group is still here');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]'), 'Peering Group is still here');
|
||||
|
||||
diag('Try to delete Peering Group');
|
||||
$d->move_and_click('//*[@id="sip_peering_group_table"]/tbody/tr[1]//td//div//a[contains(text(), "Delete")]', 'xpath', '//*[@id="sip_peering_group_table_filter"]//input');
|
||||
$d->find_element('#dataConfirmOK', 'css')->click();
|
||||
|
||||
diag('Check if Peering Group has been deleted');
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering Group successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
ok($d->find_element_by_css('#sip_peering_group_table tr > td.dataTables_empty', 'css'), 'Peering Group has been deleted');
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_peering.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,224 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $billingname = ("billing" . int(rand(100000)) . "test");
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $profilename = ("profile" . int(rand(100000)) . "package");
|
||||
my $contactmail = ("contact" . int(rand(100000)) . '@test.org');
|
||||
my $customerid = ("id" . int(rand(100000)) . "ok");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_billing_profile($billingname, $resellername);
|
||||
$c->create_contact($contactmail, $resellername);
|
||||
|
||||
diag("Go to 'Profile Packages' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Profile Packages', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Profile Package");
|
||||
$d->find_element('Create Profile Package', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Profile Package")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "An initial billing profile mapping with no billing network is required.")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Balance interval definition required.")]'));
|
||||
|
||||
diag("Fill in invalid values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $profilename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'nice desc');
|
||||
$d->fill_element('//*[@id="initial_profiles0rowprofile_idtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#initial_profiles0rowprofile_idtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="initial_profiles0rowprofile_idtable_filter"]/label/input', 'xpath', $billingname);
|
||||
ok($d->find_element_by_xpath('//*[@id="initial_profiles0rowprofile_idtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Billing Profile found');
|
||||
$d->select_if_unselected('//*[@id="initial_profiles0rowprofile_idtable"]/tbody/tr[1]/td[4]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="balance_interval.value"]', 'xpath', 'asdf');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be an integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be a positive integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Balance interval has to be greater than 0 interval units.")]'));
|
||||
|
||||
diag("Fill in antoher invalid value");
|
||||
$d->fill_element('//*[@id="balance_interval.value"]', 'xpath', '-1');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Value must be a positive integer")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Balance interval has to be greater than 0 interval units.")]'));
|
||||
|
||||
diag("Fill in valid value");
|
||||
$d->fill_element('//*[@id="balance_interval.value"]', 'xpath', '300');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Profile Package");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Profile package successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="packages_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]', $resellername), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="packages_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
|
||||
|
||||
diag("Edit Profile Package");
|
||||
$profilename = ("profile" . int(rand(100000)) . "package");
|
||||
$d->move_and_click('//*[@id="packages_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="packages_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Profile Package")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $profilename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'nice desc');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Profile Package");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Profile package successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="packages_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]', $resellername), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="packages_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
|
||||
|
||||
diag("Create a Customer");
|
||||
$c->create_customer($customerid, $contactmail, $billingname);
|
||||
|
||||
diag("Search Customer");
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer was found');
|
||||
|
||||
diag("Go to 'Customer details' page");
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
|
||||
diag("Go to 'Contract Balance'");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
|
||||
|
||||
diag("Try to set Cash Balance without entering anything");
|
||||
$d->find_element("Set Cash Balance", "link_text")->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check values");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Account balance successfully changed!', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "0.00")]'), 'Cash Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "0")]'), 'Free-Time Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td[contains(text(), "'. $billingname .'")]'), 'Billing Profile is correct');
|
||||
|
||||
diag("Set Cash Balance with proper values now");
|
||||
$d->find_element("Set Cash Balance", "link_text")->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="cash_balance"]', 'xpath', '300');
|
||||
$d->fill_element('//*[@id="free_time_balance"]', 'xpath', '50');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check values");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Account balance successfully changed!', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "300.00")]'), 'Cash Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "50")]'), 'Free-Time Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td[contains(text(), "'. $billingname .'")]'), 'Billing Profile is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="balance_intervals_table"]//tr//td[contains(text(), "300.00")]'), 'Cash Balance in Balance intervals table is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="balance_intervals_table"]//tr//td[contains(text(), "50")]'), 'Free-Time Balance in Balance intervals table is correct');
|
||||
|
||||
diag("Try to Top-up Cash without entering anything");
|
||||
$d->find_element('Top-up Cash', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Settings")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Amount field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="amount"]', 'xpath', '200');
|
||||
$d->fill_element('//*[@id="packageidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#packageidtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="packageidtable_filter"]/label/input', 'xpath', $profilename);
|
||||
ok($d->find_element_by_xpath('//*[@id="packageidtable"]//tr[1]/td[contains(text(), "' . $profilename . '")]'), 'Name is correct');
|
||||
$d->find_element('//*[@id="packageidtable"]/tbody/tr[1]/td[4]/input')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Top-up using cash performed successfully!', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "500.00")]'), 'Cash Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td//b[contains(text(), "50")]'), 'Free-Time Balance is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_balance"]//div//table//tr//td[contains(text(), "'. $billingname .'")]'), 'Billing Profile is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="topup_logs_table"]//tr//td[contains(text(), "200")]'), 'Top-Up in Top-Up logs table is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="topup_logs_table"]//tr//td[contains(text(), "'. $profilename .'")]'), 'Profile Package in Top-Up logs table is correct');
|
||||
|
||||
diag("Delete Customer");
|
||||
$c->delete_customer($customerid);
|
||||
|
||||
diag("Go to 'Profile Packages' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Profile Packages', 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete Profile Package");
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
|
||||
ok($d->find_element_by_xpath('//*[@id="packages_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]'), 'Profile Package was found');
|
||||
$d->move_and_click('//*[@id="packages_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="packages_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Profile Package is still here");
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
|
||||
ok($d->find_element_by_xpath('//*[@id="packages_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]'), 'Profile Package is still here');
|
||||
|
||||
diag("Delete Profile Package");
|
||||
$d->move_and_click('//*[@id="packages_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="packages_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Profile Package has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Profile package successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="packages_table_filter"]/label/input', 'xpath', $profilename);
|
||||
ok($d->find_element_by_css('#packages_table tr > td.dataTables_empty', 'css'), 'Profile Package has been deleted');
|
||||
|
||||
$c->delete_contact($contactmail);
|
||||
$c->delete_billing_profile($billingname);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_profilepackage.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,270 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
use Selenium::Remote::WDKeys;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $setname = ("test" . int(rand(10000)) . "set");
|
||||
my $clonedsetname = ("test" . int(rand(10000)) . "set");
|
||||
my $profilename = ("test" . int(rand(10000)) . "profile");
|
||||
my $cloneprofilename = ("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 $ncosname = ("ncos" . int(rand(100000)) . "level");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_ncos($resellername, $ncosname);
|
||||
|
||||
diag("Go to 'Subscriber Profiles' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Subscriber Profiles", 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Subscriber Profile Set");
|
||||
$d->find_element("Create Subscriber Profile Set", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Subscriber Profile Set")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
|
||||
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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller was 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');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Subscriber Profile Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile set successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]', $setname), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "This is a description. It describes things")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $resellername .'")]'), 'Reseller is correct');
|
||||
|
||||
diag("Edit Subscriber Profile set");
|
||||
$setname = ("test" . int(rand(10000)) . "set");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Edit")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Subscriber Profile Set")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $setname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Very Good description here');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Subscriber Profile Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile set successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]', $setname), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "Very Good description here")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/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');
|
||||
|
||||
diag("Try to create an empty Subscriber Profile");
|
||||
$d->find_element('Create Subscriber Profile', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Subscriber Profile")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
|
||||
diag("Enter Profile information");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $profilename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'This is a description. It describes things');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="attribute.ncos"]'));
|
||||
$d->select_if_unselected('//*[@id="attribute.ncos"]', 'xpath');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Profile");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', $profilename);
|
||||
|
||||
diag("Check Profile details");
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "This is a description. It describes things")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]', $setname), 'Profile Set is correct');
|
||||
|
||||
diag("Edit Profile");
|
||||
$profilename = ("test" . int(rand(10000)) . "profile");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="subscriber_profile_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Subscriber Profile")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $profilename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Very very useful description');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Profile");
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', $profilename);
|
||||
|
||||
diag("Check Profile details");
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "Very very useful description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]', $setname), 'Profile Set is correct');
|
||||
|
||||
diag("Go to 'Profile Preferences' page");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_table"]//tr[1]/td//a[contains(text(), "Preferences")]', 'xpath', '//*[@id="subscriber_profile_table_filter"]/label/input');
|
||||
|
||||
diag("Add NCOS to Profile");
|
||||
$d->find_element('//*[@id="preference_groups"]//div//a[contains(text(), "Call Blockings")]')->click();
|
||||
$d->move_and_click('//table//tr//td[contains(text(), "ncos")]//..//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Call Blockings")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "' . "Edit Preference 'NCOS Level'" . '")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="ncos"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "' . "Edit Preference 'NCOS Level'" . '")]');
|
||||
$d->find_element('//*[@id="ncos"]//option[contains(text(), "'. $ncosname .'")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if NCOS was applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference ncos successfully updated", 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "ncos")]//..//td//select//option[contains(text(), "'. $ncosname .'")][@selected="selected"]'), 'NCOS was applied');
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
if($d->find_element_by_xpath('//*[@id="masthead"]//div//h2')->get_text() eq 'Subscriber Profile Sets') { #workaround for back button opening wrong page
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
}
|
||||
|
||||
diag("Clone Profile");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_table"]//tr[1]//td//a[contains(text(), "Clone")]', 'xpath', '//*[@id="subscriber_profile_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create cloned Subscriber Profile")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $cloneprofilename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'indeed a good description');
|
||||
$d->find_element('//*[@id="clone"]')->click();
|
||||
|
||||
diag("Check if settings are correct");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Subscriber profile successfully cloned", 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', $cloneprofilename);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $cloneprofilename . '")]', $cloneprofilename), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "indeed a good description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Profile Set is correct');
|
||||
|
||||
diag("Set clone Profile as default Profile");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_table"]//tr[1]/td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="subscriber_profile_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Subscriber Profile")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="set_default"]', 'xpath');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if cloned Profile is now default");
|
||||
$d->find_element_by_xpath('//*[@id="subscriber_profile_table_filter"]/label/input')->clear();
|
||||
$d->find_element_by_xpath('//*[@id="subscriber_profile_table_filter"]/label/input')->send_keys(KEYS->{'return'});
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Subscriber profile successfully updated", 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr/td[contains(text(), "' . $cloneprofilename . '")]//..//td[contains(text(), "1")]'), 'Cloned Profile is now default');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr/td[contains(text(), "' . $profilename . '")]//..//td[contains(text(), "0")]'), 'Original Profile is no longer default');
|
||||
|
||||
diag("Delete cloned Profile");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_table"]//tr//td[contains(text(), "' . $cloneprofilename . '")]//..//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="subscriber_profile_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check original Profile details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Subscriber profile successfully deleted", 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "Very very useful description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Profile Set is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "1")]'), 'Original Profile is now default');
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
|
||||
diag("Clone Subscriber Profile Set");
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Profile Set was found');
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Clone")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create cloned Subscriber Profile Set")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $clonedsetname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'indeed a very interesting description');
|
||||
$d->find_element('//*[@id="clone"]')->click();
|
||||
|
||||
diag("Check cloned Subscriber Profile Set details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Subscriber profile successfully cloned", 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $clonedsetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $clonedsetname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "indeed a very interesting description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $resellername .'")]'), 'Reseller is correct');
|
||||
|
||||
diag("Check if Profile got cloned");
|
||||
$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');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "Very very useful description")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $clonedsetname . '")]'), 'Profile Set is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "1")]'), 'Original Profile is now default');
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
|
||||
diag("Delete Cloned Subscriber Profile Set");
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $clonedsetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $clonedsetname . '")]'), 'Cloned Subscriber Profile Set found');
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if cloned Subscriber Profile Set has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile set successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $clonedsetname);
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Cloned Subscriber Profile Set has been deleted');
|
||||
|
||||
diag("Try to NOT Delete Subscriber Profile Set");
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Subscriber Profile Set was found');
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Subscriber Profile Set is still here");
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Subscriber Profile Set is still here');
|
||||
|
||||
diag("Try to Delete Subscriber Profile Set");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Subscriber Profile Set has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile set successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Subscriber Profile Set has been deleted');
|
||||
|
||||
$c->delete_ncos($ncosname);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_profileset.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,254 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $templatename = ("template" . int(rand(100000)) . "mail");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
|
||||
diag("Try to create an empty Reseller");
|
||||
$d->find_element('Create Reseller', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Reseller")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="contractidtable"]/tbody/tr/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Contract field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
$d->find_element('#mod_close', 'css')->click();
|
||||
|
||||
diag("Search Reseller");
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "active")]'), 'Status is correct');
|
||||
|
||||
diag("Edit Reseller");
|
||||
$resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
$d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Resellers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Reseller")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $resellername);
|
||||
$d->find_element('//*[@id="status"]/option[@value="locked"]')->click();
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Search Reseller");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "locked")]'), 'Status is correct');
|
||||
|
||||
diag("Go to Customer details and check if 'Reseller is locked' message appears");
|
||||
$d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Resellers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "Reseller Details")]'), 'We are on the correct Page');
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller is locked', '"Reseller is locked" message appears');
|
||||
$d->find_element('Back', 'link_text')->click();
|
||||
|
||||
diag("Unlock Reseller");
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller was found');
|
||||
$d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Resellers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Reseller")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="status"]'));
|
||||
$d->find_element('//*[@id="status"]/option[@value="active"]')->click();
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check Reseller details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "active")]'), 'Status is correct');
|
||||
|
||||
diag("Go to 'Reseller Details' page");
|
||||
$d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Resellers_table_filter"]//input');
|
||||
|
||||
diag("Create an empty Phonebook entry");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]'));
|
||||
$d->find_element("Create Phonebook Entry", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Phonebook")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Number field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'testname');
|
||||
$d->fill_element('//*[@id="number"]', 'xpath', '0123456789');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Phonebook entry");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully created', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#phonebook_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="phonebook_table_filter"]/label/input', 'xpath', 'testname');
|
||||
|
||||
diag("Checking Phonebook entry details");
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "testname")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "0123456789")]'), 'Number is correct');
|
||||
|
||||
diag("Edit Phonebook entry");
|
||||
$d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="phonebook_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Phonebook")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', 'newtestname');
|
||||
$d->fill_element('//*[@id="number"]', 'xpath', '0987654321');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Checking Phonebook entry details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "newtestname")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="phonebook_table"]//tr[1]/td[contains(text(), "0987654321")]'), 'Number is correct');
|
||||
|
||||
diag("Go to 'Email Templates' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Email Templates', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Email Template");
|
||||
$d->find_element('Create Email Template', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Email Template")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]//tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "From Email Address field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Subject field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), "Reseller found");
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $templatename);
|
||||
$d->fill_element('//*[@id="from_email"]', 'xpath', 'default@mail.test');
|
||||
$d->fill_element('//*[@id="subject"]', 'xpath', 'Testing Stuff');
|
||||
$d->fill_element('//*[@id="body"]', 'xpath', 'Howdy Buddy, this is just a test text =)');
|
||||
$d->fill_element('//*[@id="attachment_name"]', 'xpath', 'Random Character');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Email Template");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Email template successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#email_template_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', $templatename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "default@mail.test")]'), 'From Email is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "Testing Stuff")]'), 'Subject is correct');
|
||||
|
||||
diag("Edit Email Template");
|
||||
$templatename = ("template" . int(rand(100000)) . "mail");
|
||||
$d->move_and_click('//*[@id="email_template_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="email_template_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Email Template")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $templatename);
|
||||
$d->fill_element('//*[@id="from_email"]', 'xpath', 'standard@mail.test');
|
||||
$d->fill_element('//*[@id="subject"]', 'xpath', 'testing much stuff');
|
||||
$d->fill_element('//*[@id="body"]', 'xpath', 'No seriously, this is just for testing');
|
||||
$d->fill_element('//*[@id="attachment_name"]', 'xpath', '=)');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Email Template");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Email template successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#email_template_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', $templatename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "standard@mail.test")]'), 'From Email is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "testing much stuff")]'), 'Subject is correct');
|
||||
|
||||
diag("Try to NOT delete Email Template");
|
||||
$d->move_and_click('//*[@id="email_template_table"]//tr[1]/td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="email_template_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Email Template is still here");
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#email_template_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', $templatename);
|
||||
ok($d->find_element_by_xpath('//*[@id="email_template_table"]//tr[1]/td[contains(text(), "' . $templatename . '")]'), 'Email Template is still here');
|
||||
|
||||
diag("Delete Email Template");
|
||||
$d->move_and_click('//*[@id="email_template_table"]//tr[1]/td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="email_template_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Email Template has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Email template successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="email_template_table_filter"]/label/input', 'xpath', $templatename);
|
||||
ok($d->find_element_by_css('#email_template_table tr > td.dataTables_empty', 'css'), 'Email Template has been deleted');
|
||||
|
||||
diag("Try to NOT delete Reseller Contract");
|
||||
$c->delete_reseller_contract($contractid, 1);
|
||||
|
||||
diag("Check if Reseller Contract is still here");
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contract_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', $contractid);
|
||||
ok($d->find_element_by_xpath('//*[@id="contract_table"]//tr[1]/td[contains(text(), "' . $contractid . '")]'), 'Reseller contract is still here');
|
||||
|
||||
diag("Try to delete Reseller Contract");
|
||||
$c->delete_reseller_contract($contractid, 0);
|
||||
|
||||
diag("Check if Reseller Contract has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contract successfully terminated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', $contractid);
|
||||
ok($d->find_element_by_css('#contract_table tr > td.dataTables_empty'), 'Reseller contract has been deleted');
|
||||
|
||||
diag("Try to NOT delete Reseller");
|
||||
$c->delete_reseller($resellername, 1);
|
||||
|
||||
diag("Check if Reseller is still here");
|
||||
$d->fill_element('//*[@id="Resellers_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Resellers_table_filter"]/label/input', 'xpath', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is still here');
|
||||
|
||||
diag("Try to delete Reseller");
|
||||
$c->delete_reseller($resellername, 0);
|
||||
|
||||
diag("Check if Reseller has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Successfully terminated reseller', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="Resellers_table_filter"]/label/input', 'xpath', $resellername);
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty'), 'Reseller has been deleted');
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_reseller.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,263 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $rulesetname = ("rule" . int(rand(100000)) . "test");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_rw_ruleset($rulesetname, $resellername);
|
||||
|
||||
diag("Try to create an empty Rewrite Rule Set");
|
||||
$d->find_element('Create Rewrite Rule Set', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Rewrite Rule Set")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
$d->find_element('#mod_close', 'css')->click();
|
||||
|
||||
diag("Search Rewrite Rule Set");
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);
|
||||
|
||||
diag("Check Rewrite Rule Set details");
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $rulesetname . '")]'), 'Ruleset Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "For testing purposes")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Rewrite Rule Set");
|
||||
$rulesetname = ("rule" . int(rand(100000)) . "test");
|
||||
$d->move_and_click('//*[@id="rewrite_rule_set_table"]/tbody/tr[1]//td//div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="rewrite_rule_set_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Rewrite Rule Set")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $rulesetname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'For very testing purposes');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Rewrite Rule Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule set successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);
|
||||
|
||||
diag("Check Rewrite Rule Set details");
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $rulesetname . '")]'), 'Ruleset Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "For very testing purposes")]'), 'Description is correct');
|
||||
|
||||
diag("Go to 'Rewrite Rules' page");
|
||||
$d->move_and_click('//*[@id="rewrite_rule_set_table"]/tbody/tr[1]//td//div//a[contains(text(), "Rules")]', 'xpath', '//*[@id="rewrite_rule_set_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "Rewrite Rules")]'), 'We are on the correct Page');
|
||||
sleep 1;
|
||||
|
||||
diag("Create a new empty Rule for Caller");
|
||||
$d->find_element('Create Rewrite Rule', 'link_text')->click;
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Rule")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Match pattern field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Replacement Pattern field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Description field is required")]'));
|
||||
|
||||
diag("Fill in invalid info");
|
||||
$d->fill_element('//*[@id="match_pattern"]', 'xpath', '^(21|\+)([4-9][0-9]+)$');
|
||||
$d->fill_element('//*[@id="replace_pattern"]', 'xpath', '\4');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Match pattern and Replace Pattern do not work together")]'));
|
||||
|
||||
diag("Fill in valid Values");
|
||||
$d->fill_element('//*[@id="match_pattern"]', 'xpath', '^(00|\+)([1-9][0-9]+)$');
|
||||
$d->fill_element('//*[@id="replace_pattern"]', 'xpath', '\2');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Not International to E.164');
|
||||
$d->find_element('//*[@id="field"]/option[@value="caller"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Rule has been created");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule successfully created', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), 'Match Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]//td[contains(text(), "\2")]'), 'Replacement Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]//td[contains(text(), "Not International to E.164")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Rule for Caller");
|
||||
$d->move_and_click('//*[@id="collapse_icaller"]//table//tr[1]//td//a[text()[contains(., "Edit")]]', 'xpath', '//*[@id="masthead"]//div/h2');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'International to E.164');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Rule has been edited");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), 'Match Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]//td[contains(text(), "\2")]'), 'Replacement Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]//td[contains(text(), "International to E.164")]'), 'Description is correct');
|
||||
|
||||
diag("Create a new Rule for Callee");
|
||||
$d->find_element('Create Rewrite Rule', 'link_text')->click;
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="match_pattern"]', 'xpath', '^(00|\+)([1-9][0-9]+)$');
|
||||
$d->fill_element('//*[@id="replace_pattern"]', 'xpath', '\2');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Not International to E.164');
|
||||
$d->find_element('//*[@id="field"]/option[@value="callee"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Rule has been created");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule successfully created', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table//tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), "Match Pattern is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table//tr[1]//td[contains(text(), "\2")]'), "Replacement Pattern is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table//tr[1]//td[contains(text(), "Not International to E.164")]'), "Description is correct");
|
||||
|
||||
diag("Edit Rule for Callee");
|
||||
$d->move_and_click('//*[@id="collapse_icallee"]//table//tr[1]//td//a[text()[contains(., "Edit")]]', 'xpath', '//*[@id="masthead"]//div/h2');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'International to E.164');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Rule has been edited");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table//tr[1]//td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), "Match Pattern is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table//tr[1]//td[contains(text(), "\2")]'), "Replacement Pattern is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table//tr[1]//td[contains(text(), "International to E.164")]'), "Description is correct");
|
||||
|
||||
diag("Testing if rules can be reordered");
|
||||
diag("Create a new Rule for Caller");
|
||||
$d->find_element('Create Rewrite Rule', 'link_text')->click;
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="match_pattern"]', 'xpath', '^(00|\+)([1-9][0-9]+)$');
|
||||
$d->fill_element('//*[@id="replace_pattern"]', 'xpath', '\1');
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'International to E.164');
|
||||
$d->find_element('//*[@id="field"]/option[@value="caller"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Test if new entry moves up if up arrow is clicked");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->find_element('//*[@id="collapse_icaller"]/div/table/tbody/tr/td[contains(text(), "\1")]/../td//a//i[@class="icon-arrow-up"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table//tr[1]/td[contains(text(), "\1")]'), "Replacement Pattern is correct");
|
||||
|
||||
diag("Delete Rule");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->move_and_click('//*[@id="collapse_icaller"]//table//tr[2]//td//a[text()[contains(., "Delete")]]', 'xpath', '//*[@id="masthead"]//div/h2');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully deleted", 'Correct Alert was shown');
|
||||
|
||||
diag("Go Back to the Rewrite Rule Set page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Rewrite Rule Sets', 'link_text')->click();
|
||||
|
||||
diag("Try to clone a Ruleset");
|
||||
my $rulesetclonename = ("rule" . int(rand(100000)) . "test");
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $rulesetname . '")]'), 'Ruleset was found');
|
||||
$d->move_and_click('//*[@id="rewrite_rule_set_table"]/tbody/tr[1]//td//div//a[contains(text(), "Clone")]', 'xpath', '//*[@id="rewrite_rule_set_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create cloned Rewrite Rule")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $rulesetclonename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'Im a clone, beep boop');
|
||||
$d->find_element('//*[@id="clone"]')->click();
|
||||
|
||||
diag("Search cloned Rewrite Rule Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule set successfully cloned', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetclonename);
|
||||
|
||||
diag("Check Rewrite Rule Set details");
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $rulesetclonename . '")]'), 'Ruleset Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "Im a clone, beep boop")]'), 'Description is correct');
|
||||
$d->move_and_click('//*[@id="rewrite_rule_set_table"]/tbody/tr[1]//td//div//a[contains(text(), "Rules")]', 'xpath', '//*[@id="rewrite_rule_set_table_filter"]/label/input');
|
||||
|
||||
diag("Check if Caller got properly cloned");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]/td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), 'Match Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]/td[contains(text(), "\1")]'), 'Replacement Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]/td[contains(text(), "International to E.164")]'), 'Description is correct');
|
||||
|
||||
diag("Check if Callee got properly cloned");
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]/td[contains(text(), "^(00|\+)([1-9][0-9]+)$")]'), 'Match Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]/td[contains(text(), "\2")]'), 'Replacement Pattern is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="collapse_icallee"]/div/table/tbody/tr[1]/td[contains(text(), "International to E.164")]'), 'Description is correct');
|
||||
|
||||
diag("Try to add Ruleset to a Domain");
|
||||
$c->create_domain($domainstring, $resellername);
|
||||
|
||||
diag("Enter Domain preferences");
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Domain_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="Domain_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), 'Entry was found');
|
||||
$d->move_and_click('//*[@id="Domain_table"]/tbody/tr[1]//td//div//a[contains(text(),"Preferences")]', 'xpath', '//*[@id="Domain_table_filter"]/label/input');
|
||||
|
||||
diag("Add Ruleset to Domain");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Number Manipulations', 'link_text'));
|
||||
$d->move_and_click('//table/tbody/tr/td[contains(text(), "rewrite_rule_set")]/../td/div//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Number Manipulations")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="rewrite_rule_set"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="rewrite_rule_set"]/option[contains(text(), "' . $rulesetname . '")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if correct Ruleset has been selected");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference rewrite_rule_set successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table/tbody/tr/td[contains(text(), "rewrite_rule_set")]/../td[4]/select/option[contains(text(), "' . $rulesetname . '")][@selected="selected"]'), 'rewrite_rule_set value has been set');
|
||||
|
||||
diag("Delete Domain");
|
||||
$c->delete_domain($domainstring);
|
||||
|
||||
diag("Try to NOT delete Rewrite Rule Set");
|
||||
$c->delete_rw_ruleset($rulesetname, 1);
|
||||
|
||||
diag("Check if Rewrite Rule Set is still here");
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]/td[contains(text(), "' . $rulesetname . '")]'), 'Rewrite Rule Set is still here');
|
||||
|
||||
diag("Try to delete Rewrite Rule Set");
|
||||
$c->delete_rw_ruleset($rulesetname, 0);
|
||||
|
||||
diag("Check if Rewrite Rule Set has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Rewrite rule set successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="rewrite_rule_set_table_filter"]/label/input', 'xpath', $rulesetname);
|
||||
ok($d->find_element_by_css('#rewrite_rule_set_table tr > td.dataTables_empty', 'css'), 'Rewrite Rule Set has been deleted');
|
||||
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_rw_ruleset.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,172 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $soundsetname = ("sound" . int(rand(100000)) . "set");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
|
||||
diag("Go to 'Sound Sets' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Sound Sets', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Sound Set");
|
||||
$d->find_element('Create Sound Set', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Sound Set")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]//tr[1]//td//input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller was found');
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $soundsetname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'nice desc');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Sound Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound set successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sound_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', $soundsetname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "' . $soundsetname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "nice desc")]'), 'Description is correct');
|
||||
|
||||
diag("Edit Sound Set");
|
||||
$soundsetname = ("sound" . int(rand(100000)) . "set");
|
||||
$d->move_and_click('//*[@id="sound_set_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="sound_set_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Sound Set")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $soundsetname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'very nice desc');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Sound Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound set successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sound_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', $soundsetname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "' . $soundsetname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "very nice desc")]'), 'Description is correct');
|
||||
|
||||
diag("Go to 'Sound Set Files' page");
|
||||
$d->move_and_click('//*[@id="sound_set_table"]//tr[1]//td//a[contains(text(), "Files")]', 'xpath', '//*[@id="sound_set_table_filter"]//input');
|
||||
|
||||
diag("Edit loop setting for 'conference_first'");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->move_and_click('//table//tr//td[contains(text(), "conference_first")]/..//td//a[contains(text(), "Upload")]', 'xpath', '//*[@id="sound_groups"]//div/a[contains(text(), "conference")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit conference_first")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="loopplay"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if loop setting was enabled");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound handle successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td//input[@checked="checked"]'), 'loop for conference_first was activated');
|
||||
|
||||
diag("Load default Files");
|
||||
$d->find_element('Load Default Files', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Default Files")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check in 'conference' if settings are correct");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound set successfully loaded with default files.', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td//input[@checked="checked"]'), 'loop for conference_first is still activated');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td[not(contains(text(), "conference_first.wav"))]'), 'conference_first.wav was not loaded');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_greeting")]/..//td//input[not(@checked="checked")]'), 'loop for conference_greeting is not activated');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_greeting")]/..//td[contains(text(), "conference_greeting.wav")]'), 'conference_greeting.wav was loaded');
|
||||
|
||||
diag("Load default Files again and override everything");
|
||||
$d->find_element('Load Default Files', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Default Files")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="replace_existing"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check in 'conference' if settings are correct");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound set successfully loaded with default files.', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td//input[not(@checked="checked")]'), 'loop for conference_first is not activated');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td[contains(text(), "conference_first.wav")]'), 'conference_first.wav was loaded');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_greeting")]/..//td//input[not(@checked="checked")]'), 'loop for conference_greeting is not activated');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_greeting")]/..//td[contains(text(), "conference_greeting.wav")]'), 'conference_greeting.wav was loaded');
|
||||
|
||||
diag("Load default Files again and loop them");
|
||||
$d->find_element('Load Default Files', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Default Files")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="loopplay"]');
|
||||
$d->select_if_unselected('//*[@id="replace_existing"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check in 'conference' if settings are correct");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound set successfully loaded with default files.', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td//input[@checked="checked"]'), 'loop for conference_first was activated');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_first")]/..//td[contains(text(), "conference_first.wav")]'), 'conference_first.wav was loaded');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_greeting")]/..//td//input[@checked="checked"]'), 'loop for conference_greeting was activated');
|
||||
ok($d->find_element_by_xpath('//table//tr//td[contains(text(), "conference_greeting")]/..//td[contains(text(), "conference_greeting.wav")]'), 'conference_greeting.wav was loaded');
|
||||
|
||||
diag("Try to NOT delete Sound Set");
|
||||
$d->find_element('Back', 'link_text')->click();
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sound_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', $soundsetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "' . $soundsetname . '")]'), 'Sound Set was found');
|
||||
$d->move_and_click('//*[@id="sound_set_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="sound_set_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Sound Set is still here");
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sound_set_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', $soundsetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="sound_set_table"]//tr[1]/td[contains(text(), "' . $soundsetname . '")]'), 'Sound set is still here');
|
||||
|
||||
diag("Try to delete Sound Set");
|
||||
$d->move_and_click('//*[@id="sound_set_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="sound_set_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Sound Set has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Sound set successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sound_set_table_filter"]/label/input', 'xpath', $soundsetname);
|
||||
ok($d->find_element_by_css('#sound_set_table tr > td.dataTables_empty', 'css'), 'Sound Set has been deleted');
|
||||
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_soundset.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,442 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $customerid = ("id" . int(rand(100000)) . "ok");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $emailstring = ("test" . int(rand(10000)) . "\@example.org");
|
||||
my $username = ("demo" . int(rand(10000)) . "name");
|
||||
my $bsetname = ("test" . int(10000) . "bset");
|
||||
my $destinationname = ("test" . int(10000) . "dset");
|
||||
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");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_domain($domainstring, $resellername);
|
||||
$c->create_contact($contactmail, $resellername);
|
||||
$c->create_billing_profile($billingname, $resellername);
|
||||
$c->create_customer($customerid, $contactmail, $billingname);
|
||||
|
||||
diag("Open Customer details");
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer found');
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
|
||||
diag("Try to add an empty Subscriber");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]'));
|
||||
$d->find_element('Create Subscriber', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Subscriber")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="domainidtable"]/tbody/tr[1]/td[4]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Domain field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "SIP Username field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "SIP Password field is required")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="domainidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#domainidtable tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="domainidtable_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="domainidtable"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), 'Domain found');
|
||||
$d->select_if_unselected('//*[@id="domainidtable"]/tbody/tr[1]/td[4]/input');
|
||||
$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)));
|
||||
$d->find_element('//*[@id="email"]')->send_keys($emailstring);
|
||||
$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="webpassword"]/../div[@id="gen_password"]')->click();
|
||||
$d->find_element('//*[@id="username"]')->send_keys($username);
|
||||
$d->find_element('//*[@id="password"]')->send_keys('testing1234'); #workaround for misclicking on ok button
|
||||
$d->find_element('//*[@id="password"]/../div[@id="gen_password"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Subscriber");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber successfully created', '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->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $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');
|
||||
}
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->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);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr[1]/td[contains(text(), "' . $username . '")]'), 'Subscriber was found');
|
||||
|
||||
diag("Go to 'Subscriber Profiles' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Subscriber Profiles", 'link_text')->click();
|
||||
|
||||
diag("Try to create a Subscriber Profile Set");
|
||||
$d->find_element('Create Subscriber Profile Set', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Subscriber Profile Set")]'), 'Edit window has been opened');
|
||||
$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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $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');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Subscriber Profile Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile set successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "This is a description. It describes things")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/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');
|
||||
|
||||
diag("Try to create a Subscriber Profile");
|
||||
$d->find_element('Create Subscriber Profile', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Subscriber Profile")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $profilename);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'This is a description. It describes things');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="attribute.ncos"]'));
|
||||
$d->select_if_unselected('//*[@id="attribute.ncos"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Subscriber Profile");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_table_filter"]/label/input', 'xpath', $profilename);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $profilename . '")]', $profilename), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "This is a description. It describes things")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Profile Set is correct');
|
||||
|
||||
diag("Go to 'Subscribers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Subscribers", 'link_text')->click();
|
||||
|
||||
diag("Check Subscriber details");
|
||||
$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->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]', $contactmail), 'Contact Email is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $username . '")]', $username), 'Subscriber name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $domainstring . '")]', $domainstring), 'Domain name is correct');
|
||||
|
||||
diag("Go to 'Subscriber Details' page");
|
||||
$d->move_and_click('//*[@id="subscriber_table"]/tbody/tr[1]/td/div/a[contains(text(), "Details")]', 'xpath', '//*[@id="subscriber_table_filter"]//input');
|
||||
|
||||
diag("Edit master data");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]'));
|
||||
$d->find_element('Edit', 'link_text')->click();
|
||||
|
||||
diag("Add Subscriber to profile");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Subscriber Master Data")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="profile_setidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#profile_setidtable tr > td.dataTables_empty'), 'Garbage Text was not found');
|
||||
$d->fill_element('//*[@id="profile_setidtable_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_xpath('//*[@id="profile_setidtable"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Subscriber Profile was found');
|
||||
$d->select_if_unselected('//*[@id="profile_setidtable"]/tbody/tr/td[5]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Successfully updated subscriber', 'Correct Alert was shown');
|
||||
=pod
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element("Subscribers", 'link_text')->click();
|
||||
$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->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "'. $contactmail .'")]'), 'Subscriber was found');
|
||||
$d->move_and_click('//*[@id="subscriber_table"]/tbody/tr[1]/td/div/a[contains(text(), "Details")]', 'xpath', '//*[@id="subscriber_table_filter"]//input');
|
||||
=cut
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr/td[contains(text(), "Subscriber Profile Set")]/../td[contains(text(), "'. $setname .'")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr/td[contains(text(), "Subscriber Profile")]/../td[contains(text(), "'. $profilename .'")]'));
|
||||
|
||||
diag("Lock Subscriber");
|
||||
$d->find_element("Edit", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Subscriber Master Data")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="lock"]/option[contains(text(), "global")]')->click();
|
||||
$d->find_element('//*[@id="status"]/option[contains(text(), "locked")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Subscriber was locked");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Successfully updated subscriber', 'Correct Alert was shown');
|
||||
if($d->find_element_by_xpath('//*[@id="masthead"]/div/div/div/h2')->get_text() eq "Subscribers"){ #workaround for misbehaving ngcp panel randomly throwing test out of customer details
|
||||
$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->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $username . '")]'), 'Found Subscriber');
|
||||
$d->move_and_click('//*[@id="subscriber_table"]//tr[1]//td//a[contains(text(), "Details")]', 'xpath', '//*[@id="subscriber_table_filter"]/label/input');
|
||||
}
|
||||
|
||||
diag("Unlock Subscriber");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]'));
|
||||
ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr/td[contains(text(), "Status")]/../td[contains(text(), "locked")]'), 'Status is correct');
|
||||
$d->find_element("Edit", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Subscriber Master Data")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="lock"]')->click();
|
||||
$d->find_element('//*[@id="lock"]/option[contains(text(), "none")]')->click();
|
||||
$d->find_element('//*[@id="status"]')->click();
|
||||
$d->find_element('//*[@id="status"]/option[contains(text(), "active")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if subscriber was unlocked");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Successfully updated subscriber', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr/td[contains(text(), "Status")]/../td[contains(text(), "active")]'), 'Status is correct');
|
||||
|
||||
diag("Go to 'Subscriber Preferences' page");
|
||||
$d->find_element("Preferences", 'link_text')->click();
|
||||
|
||||
diag("Try to change subscriber IVR Language");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//table//tr/td[contains(text(), "language")]'));
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "language")]/..//td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "conference_pin")]/..//td//a[contains(text(), "Edit")]');
|
||||
|
||||
diag("Change Language to German");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->move_and_click('//*[@id="language"]', 'xpath', '//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]');
|
||||
$d->find_element('//*[@id="language"]/option[contains(text(), "German")]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Language has been applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference language successfully updated', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="preference_groups"]//div//a[contains(text(),"Internals")]'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "language")]/../td/select/option[contains(text(), "German") and @selected="selected"]'), '"German" has been selected');
|
||||
|
||||
diag("Try to enable Call Recording");
|
||||
$d->scroll_to_element($d->find_element('//table//tr/td[contains(text(), "record_call")]'));
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "record_call")]/..//td//a[contains(text(), "Edit")]', 'xpath', '//table//tr/td[contains(text(), "nat_sipping")]/..//td//a[contains(text(), "Edit")]');
|
||||
|
||||
diag("Enable Call Recording");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->select_if_unselected('//*[@id="record_call"]');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Call Recording was enabled");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference record_call successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "record_call")]/../td//input[@checked="checked"]'), 'Call recording was enabled');
|
||||
|
||||
diag("Try to add a Call Forward");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Call Forwards', 'link_text'));
|
||||
$d->move_and_click('//*[@id="preferences_table_cf"]/tbody/tr/td[contains(text(), "Unconditional")]/../td/div/a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Call Forwards")]');
|
||||
$d->fill_element('//*[@id="destination.uri.destination"]', 'xpath', '43123456789');
|
||||
$d->find_element('//*[@id="cf_actions.advanced"]')->click();
|
||||
|
||||
diag("Add a new Source Set");
|
||||
$d->find_element('//*[@id="cf_actions.edit_source_sets"]')->click();
|
||||
$d->find_element('Create New', 'link_text')->click();
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $sourcename);
|
||||
$d->fill_element('//*[@id="source.0.source"]', 'xpath', '43*');
|
||||
|
||||
diag("Add another source");
|
||||
$d->find_element('//*[@id="source_add"]')->click();
|
||||
$d->fill_element('//*[@id="source.1.source"]', 'xpath', '494331337');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Source Set details");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $sourcename . '")]'), "Name is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $sourcename . '")]/../td[contains(text(), "whitelist")]'), 'Mode is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $sourcename . '")]/../td[contains(text(), "43*")]'), 'Number 1 is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $sourcename . '")]/../td[text()[contains(., "494331337")]]'),'Number 2 is correct');
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Add a new B-Number Set");
|
||||
$d->find_element('//*[@id="cf_actions.edit_bnumber_sets"]')->click();
|
||||
$d->find_element('Create New', 'link_text')->click();
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $bsetname);
|
||||
$d->fill_element('//*[@id="bnumbers.0.number"]', 'xpath', '1234567890');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check B-Number Set details");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $bsetname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $bsetname . '")]/../td[contains(text(), "1234567890")]'), 'Number is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $bsetname . '")]/../td[contains(text(), "whitelist")]'), 'Mode is correct');
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Add a new Destination Set");
|
||||
$d->find_element('//*[@id="cf_actions.edit_destination_sets"]')->click();
|
||||
$d->find_element('Create New', 'link_text')->click();
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $destinationname);
|
||||
$d->fill_element('//*[@id="destination.0.uri.destination"]', 'xpath', '1234567890');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check Destination Set details");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $destinationname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]//table//tr/td[contains(text(), "' . $destinationname . '")]/../td[contains(text(), "1234567890")]'), 'Number is correct');
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Use new Sets");
|
||||
$d->find_element('//*[@id="callforward_controls_add"]')->click();
|
||||
$d->find_element('//*[@id="active_callforward.0.source_set"]/option[contains(text(), "' . $sourcename . '")]')->click();
|
||||
ok($d->find_element_by_xpath('//select//option[contains(text(), "' . $sourcename . '")]')->click(), 'Source set has been found');
|
||||
ok($d->find_element_by_xpath('//select//option[contains(text(), "' . $destinationname . '")]')->click(), 'Destination Set has been found');
|
||||
ok($d->find_element_by_xpath('//select//option[contains(text(), "' . $bsetname . '")]')->click(), 'B-Set has been found');
|
||||
|
||||
diag("Save");
|
||||
$d->find_element('//*[@id="cf_actions.save"]')->click();
|
||||
|
||||
diag("Check if call-forward has been applied");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Successfully saved Call Forward', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="preferences_table_cf"]//tr[1]/td[contains(text(), ' . $bsetname . ')]'), 'B-Set was selected');
|
||||
ok($d->find_element_by_xpath('//*[@id="preferences_table_cf"]//tr[1]/td[contains(text(), ' . $destinationname . ')]'), 'Destination set was selected');
|
||||
|
||||
diag("Try to add Call Blockings");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Call Blockings', 'link_text'));
|
||||
|
||||
diag("Edit 'block_in_mode'");
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "block_in_mode")]/../td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Call Blockings")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="block_in_mode"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Call Blockings', 'link_text'));
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference block_in_mode successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "block_in_mode")]/../td/input[@checked="checked"]'), 'Setting is correct');
|
||||
|
||||
diag("Edit 'block_in_list'");
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "block_in_list")]/../td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Call Blockings")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="block_in_list"]', 'xpath', '1337');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
$d->fill_element('//*[@id="block_in_list"]', 'xpath', '42');
|
||||
$d->find_element('//*[@id="add"]')->click();
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Check details");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
#is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference block_in_list successfully created', 'Correct Alert was shown');
|
||||
$d->scroll_to_element($d->find_element('Call Blockings', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "block_in_list")]/../td[contains(text(), "1337")]'), 'Number 1 is correct');
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "block_in_list")]/../td[text()[contains(., "42")]]'), 'Number 2 is correct');
|
||||
|
||||
diag("Disable Entry");
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "block_in_list")]/../td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Call Blockings")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="mod_edit"]//div//input[@value="1337"]/../a[2]')->click();
|
||||
$d->find_element('//*[@id="mod_close"]')->click();
|
||||
|
||||
diag("Check if Entry has been disabled");
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('Call Blockings', 'link_text'));
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "block_in_list")]/../td/span[@class="ngcp-entry-disabled"]/../span[contains(text(), "1337")]'), 'Entry has been disabled');
|
||||
|
||||
diag("Edit 'block_in_clir'");
|
||||
$d->move_and_click('//table//tr/td[contains(text(), "block_in_clir")]/../td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="preference_groups"]//div//a[contains(text(), "Call Blockings")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Preference")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="block_in_clir"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if value was set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Preference block_in_clir successfully updated', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "block_in_clir")]/../td/input[@checked="checked"]'), 'Setting is correct');
|
||||
|
||||
diag("Go to 'Subscribers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Subscribers', 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete 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->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $username . '")]'), 'Subscriber was found');
|
||||
$d->move_and_click('//*[@id="subscriber_table"]/tbody/tr[1]/td/div/a[contains(text(), "Terminate")]', 'xpath', '//*[@id="subscriber_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Subscriber is still here");
|
||||
$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->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $username . '")]'), 'Subscriber is still here');
|
||||
|
||||
diag("Try to delete Subscriber");
|
||||
$d->move_and_click('//*[@id="subscriber_table"]/tbody/tr[1]/td/div/a[contains(text(), "Terminate")]', 'xpath', '//*[@id="subscriber_table_filter"]//input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Subscriber has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Successfully terminated subscriber', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_table_filter"]/label/input', 'xpath', $username);
|
||||
ok($d->find_element_by_css('#subscriber_table tr > td.dataTables_empty'), 'Subscriber has been deleted');
|
||||
$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click();
|
||||
|
||||
diag("Go to 'Subscriber Profiles' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Subscriber Profiles', 'link_text')->click();
|
||||
|
||||
diag("Try to NOT Delete Subscriber Profile Set");
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Profile Set was found');
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Subscriber Profile Set is still here");
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr[1]/td[contains(text(), "' . $setname . '")]'), 'Subscriber Profile Set is still here');
|
||||
|
||||
diag("Try to delete Subscriber Profile Set");
|
||||
$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Delete")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Subscriber Profile Set has been deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber profile set successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="subscriber_profile_sets_table_filter"]/label/input', 'xpath', $setname);
|
||||
ok($d->find_element_by_css('#subscriber_profile_sets_table tr > td.dataTables_empty'), 'Subscriber Profile Set has been deleted');
|
||||
|
||||
$c->delete_customer($customerid);
|
||||
$c->delete_domain($domainstring);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
$c->delete_contact($contactmail);
|
||||
$c->delete_billing_profile($billingname);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_subscriber.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,269 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
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");
|
||||
my $domainstring = ("domain" . int(rand(100000)) . ".example.org");
|
||||
my $username = ("demo" . int(rand(10000)) . "name");
|
||||
my $run_ok = 0;
|
||||
my $custnum;
|
||||
my $compstring;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
$c->create_domain($domainstring, $resellername);
|
||||
$c->create_contact($contactmail, $resellername);
|
||||
$c->create_billing_profile($billingname, $resellername);
|
||||
$c->create_customer($customerid, $contactmail, $billingname);
|
||||
|
||||
diag("Go to 'Customers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Customers', 'link_text')->click();
|
||||
|
||||
diag("Create Subscriber for Termination Test");
|
||||
$d->fill_element('#Customer_table_filter input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('#Customer_table_filter input', 'css', $customerid);
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer found');
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
$d->find_element('//*[@id="toggle-accordions"]')->click();
|
||||
$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]'));
|
||||
$d->find_element('Create Subscriber', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Subscriber")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="domainidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#domainidtable tr > td.dataTables_empty'), 'Table is empty');
|
||||
$d->fill_element('//*[@id="domainidtable_filter"]/label/input', 'xpath', $domainstring);
|
||||
ok($d->find_element_by_xpath('//*[@id="domainidtable"]//tr[1]/td[contains(text(), "' . $domainstring . '")]'), 'Domain found');
|
||||
$d->select_if_unselected('//*[@id="domainidtable"]/tbody/tr[1]/td[4]/input');
|
||||
$d->find_element('//*[@id="username"]')->send_keys($username);
|
||||
$d->find_element('//*[@id="password"]')->send_keys('testing1234');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Go to 'Subscribers' page");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Subscriber successfully created', 'Correct Alert was shown');
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Subscribers', 'link_text')->click();
|
||||
|
||||
diag("Terminate 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->find_element_by_xpath('//*[@id="subscriber_table"]//tr[1]/td[contains(text(), "' . $username . '")]'), 'Subscriber was found');
|
||||
$d->move_and_click('//*[@id="subscriber_table"]/tbody/tr[1]/td/div/a[contains(text(), "Details")]', 'xpath', '//*[@id="subscriber_table_filter"]//input');
|
||||
$d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]')->click();
|
||||
$d->find_element('//*[@id="collapse_master"]/div/a[contains(text(), "Edit")]')->click();
|
||||
$d->find_element('//*[@id="status"]/option[@value="terminated"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")][contains(text(), "Subscriber does not exist")]'), 'Correct Alert was shown');
|
||||
|
||||
diag("Check if Subscriber has been terminated");
|
||||
$d->fill_element('//*[@id="subscriber_table_filter"]/label/input', 'xpath', $username);
|
||||
ok($d->find_element_by_css('#subscriber_table tr > td.dataTables_empty'), 'Subscriber has been terminated');
|
||||
|
||||
diag("Go to 'Customers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Customers', 'link_text')->click();
|
||||
|
||||
diag("Edit Customer");
|
||||
$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->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Found customer');
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Customer_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Customer")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="status"]/option[@value="locked"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Customer was edited");
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Found customer');
|
||||
ok($d->find_element_by_xpath('//*[@id="Customer_table"]//tr[1]/td[contains(text(), "locked")]'), 'Status was changed');
|
||||
$custnum = $d->get_text('//*[@id="Customer_table"]//tr[1]//td[1]');
|
||||
$compstring = "Customer #" . $custnum . " successfully updated";
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, 'Correct Alert was shown');
|
||||
|
||||
diag("Edit Customer status to 'terminated'");
|
||||
$d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Customer_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Customer")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="status"]'));
|
||||
$d->find_element('//*[@id="status"]/option[@value="terminated"]')->click();
|
||||
$d->find_element('#save', 'css')->click();
|
||||
|
||||
diag("Check if Customer was terminated");
|
||||
$compstring = "Customer #" . $custnum . " successfully updated";
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, 'Correct Alert was shown');
|
||||
$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 terminated');
|
||||
|
||||
diag("Go to 'Contacts' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Contacts', 'link_text')->click();
|
||||
|
||||
diag("Search Contact");
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Garbage test not found');
|
||||
$d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $contactmail);
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Contact found');
|
||||
|
||||
diag("Check if Editing Contact works");
|
||||
$d->move_and_click('//*[@id="contact_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="contact_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Contact")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="firstname"]', 'xpath', 'TestFistName');
|
||||
$d->fill_element('//*[@id="lastname"]', 'xpath', 'TestLastName');
|
||||
$d->fill_element('//*[@id="company"]', 'xpath', 'TestCompany');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Contact was edited");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contact successfully changed', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "' . $contactmail . '")]'), 'Contact found');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "TestFistName")]'), 'First Name was edited');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "TestLastName")]'), 'Last Name was edited');
|
||||
ok($d->find_element_by_xpath('//*[@id="contact_table"]//tr[1]/td[contains(text(), "TestCompany")]'), 'Company was edited');
|
||||
|
||||
$c->delete_contact($contactmail);
|
||||
$c->delete_domain($domainstring);
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("Create default Reseller + Contract for termination testing");
|
||||
$d->find_element('//*[@id="content"]//div//form//button[contains(text(), "Create Reseller with default values")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "Reseller Details for")]'), 'We are on the correct page');
|
||||
|
||||
diag("Get Reseller name");
|
||||
if($d->find_element_by_xpath('//*[@id="reseller_details"]//div//a[contains(text(), "Reseller Base Information")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') {
|
||||
$d->find_element('//*[@id="reseller_details"]//div//a[contains(text(), "Reseller Base Information")]')->click();
|
||||
}
|
||||
$resellername = $d->get_text('//*[@id="Reseller_table"]/tbody/tr/td[2]');
|
||||
my $temp = substr($resellername, 8);
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller successfully created with login Default' . $temp . ' and password defaultresellerpassword, please review your settings below', 'Correct Alert was shown');
|
||||
|
||||
diag("Add unique name to Contract");
|
||||
$contractid = ("contract" . int(rand(100000)) . "term");
|
||||
sleep 1;
|
||||
$d->find_element('//*[@id="reseller_details"]//div//a[contains(text(), "Reseller Contract")]')->click();
|
||||
$d->move_and_click('//*[@id="Contract_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="masthead"]//div//h2[contains(text(), "Reseller Details")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Contract")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="external_id"]', 'xpath', $contractid);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contract successfully changed!', 'Correct Alert was shown');
|
||||
|
||||
diag("Go to 'Reseller Contracts' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Reseller and Peering Contracts', 'link_text')->click();
|
||||
|
||||
diag("Search Reseller Contract");
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contract_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', $contractid);
|
||||
ok($d->find_element_by_xpath('//*[@id="contract_table"]//tr[1]/td[contains(text(), "' . $contractid . '")]'), 'Reseller contract found');
|
||||
|
||||
diag("Terminate Reseller Contract");
|
||||
$d->move_and_click('//*[@id="contract_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="contract_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Contract")]'), 'Edit window has been opened');
|
||||
$d->scroll_to_element($d->find_element('//*[@id="status"]'));
|
||||
$d->find_element('//*[@id="status"]/option[@value="terminated"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Reseller Contract was terminated");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contract successfully changed!', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', $contractid);
|
||||
ok($d->find_element_by_css('#contract_table tr > td.dataTables_empty', 'css'), 'Reseller Contract was terminated');
|
||||
|
||||
diag("Go to 'Resellers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Resellers', 'link_text')->click();
|
||||
|
||||
diag("Search reseller");
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller Name is correct');
|
||||
|
||||
diag("Terminate Reseller");
|
||||
$d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Resellers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Reseller")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="status"]/option[@value="terminated"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Reseller has been terminated");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Reseller has been terminated');
|
||||
|
||||
diag("Create default Reseller + Contract for termination testing");
|
||||
$d->find_element('//*[@id="content"]//div//form//button[contains(text(), "Create Reseller with default values")]')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="masthead"]//div//h2[contains(text(), "Reseller Details for")]'), 'We are on the correct page');
|
||||
diag("Get Reseller name");
|
||||
if($d->find_element_by_xpath('//*[@id="reseller_details"]//div//a[contains(text(), "Reseller Base Information")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') {
|
||||
$d->find_element('//*[@id="reseller_details"]//div//a[contains(text(), "Reseller Base Information")]')->click();
|
||||
}
|
||||
$resellername = $d->get_text('//*[@id="Reseller_table"]/tbody/tr/td[2]');
|
||||
$temp = substr($resellername, 8);
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller successfully created with login Default' . $temp . ' and password defaultresellerpassword, please review your settings below', 'Correct Alert was shown');
|
||||
|
||||
diag("Add unique name to Contract");
|
||||
$contractid = ("contract" . int(rand(100000)) . "term");
|
||||
sleep 1;
|
||||
$d->find_element('//*[@id="reseller_details"]//div//a[contains(text(), "Reseller Contract")]')->click();
|
||||
$d->move_and_click('//*[@id="Contract_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="masthead"]//div//h2[contains(text(), "Reseller Details")]');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Contract")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="external_id"]', 'xpath', $contractid);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Contract successfully changed!', 'Correct Alert was shown');
|
||||
|
||||
diag("Go to 'Resellers' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Resellers', 'link_text')->click();
|
||||
|
||||
diag("Search Reseller");
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller Name is correct');
|
||||
|
||||
diag("Terminate Reseller");
|
||||
$d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Edit")]', 'xpath', '//*[@id="Resellers_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Reseller")]'), 'Edit window has been opened');
|
||||
$d->find_element('//*[@id="status"]/option[@value="terminated"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check if Reseller has been terminated");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Reseller successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('#Resellers_table_filter label input', 'css', $resellername);
|
||||
ok($d->find_element_by_css('#Resellers_table tr > td.dataTables_empty', 'css'), 'Reseller has been terminated');
|
||||
|
||||
diag("Go to 'Reseller Contracts' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Reseller and Peering Contracts', 'link_text')->click();
|
||||
|
||||
diag("Check if Reseller Contract has been terminated");
|
||||
$d->fill_element('//*[@id="contract_table_filter"]/label/input', 'xpath', $contractid);
|
||||
ok($d->find_element_by_css('#contract_table tr > td.dataTables_empty', 'css'), 'Reseller Contract has been terminated');
|
||||
|
||||
$c->delete_billing_profile($billingname);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_terminate.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -1,220 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Test::More import => [qw(done_testing is ok diag todo_skip)];
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use Selenium::Collection::Functions;
|
||||
|
||||
my ($port) = @_;
|
||||
my $d = Selenium::Collection::Functions::create_driver($port);
|
||||
my $c = Selenium::Collection::Common->new(
|
||||
driver => $d
|
||||
);
|
||||
|
||||
my $resellername = ("reseller" . int(rand(100000)) . "test");
|
||||
my $contractid = ("contract" . int(rand(100000)) . "test");
|
||||
my $timesetname = ("time" . int(rand(100000)) . "set");
|
||||
my $groupname = ("group" . int(rand(100000)) . "test");
|
||||
my $run_ok = 0;
|
||||
|
||||
$c->login_ok();
|
||||
$c->create_reseller_contract($contractid);
|
||||
$c->create_reseller($resellername, $contractid);
|
||||
|
||||
diag("Go to 'Time Sets' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Time Sets', 'link_text')->click();
|
||||
|
||||
diag("Try to create an empty Time Set");
|
||||
$d->find_element('Create Time Set Entry', 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Time Set")]'), 'Edit window has been opened');
|
||||
$d->unselect_if_selected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Reseller field is required")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Name field is required")]'));
|
||||
|
||||
diag("Enter 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', $resellername);
|
||||
ok($d->find_element_by_xpath('//*[@id="reselleridtable"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), "Reseller found");
|
||||
$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $timesetname);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Time Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Timeset entry successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#timeset_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', $timesetname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="timeset_table"]//tr[1]/td[contains(text(), "' . $timesetname . '")]'), "Name is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="timeset_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), "Reseller is correct");
|
||||
|
||||
diag("Edit Time Set");
|
||||
$timesetname = ("time" . int(rand(100000)) . "set");
|
||||
$d->move_and_click('//*[@id="timeset_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="timeset_table_filter"]/label/input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Edit Time Set")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $timesetname);
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Time Set");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Timeset entry successfully updated', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#timeset_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', $timesetname);
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="timeset_table"]//tr[1]/td[contains(text(), "' . $timesetname . '")]'), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="timeset_table"]//tr[1]/td[contains(text(), "' . $resellername . '")]'), 'Reseller is correct');
|
||||
|
||||
diag("Go to 'Events' page");
|
||||
$d->move_and_click('//*[@id="timeset_table"]//tr[1]//td//a[contains(text(), "Events")]', 'xpath', '//*[@id="timeset_table_filter"]/label/input');
|
||||
|
||||
diag("Try to create a new Event");
|
||||
$d->find_element("Create Event", 'link_text')->click();
|
||||
|
||||
diag("Fill in invalid values");
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Time Set Event")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="comment"]', 'xpath', 'testing invalid content');
|
||||
$d->fill_element('//*[@id="startdate_datetimepicker"]', 'xpath', 'invalid');
|
||||
$d->fill_element('//*[@id="starttime_datetimepicker"]', 'xpath', 'stuff');
|
||||
$d->find_element('//*[@id="repeat.freq"]/option[@value="daily"]')->click();
|
||||
$d->find_element('//*[@id="byday.label"]')->click();
|
||||
$d->fill_element('//*[@id="byday.weekdaynumber"]', 'xpath', 'invalid stuff');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Check error messages");
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid datetime, must be in format yy-mm-dd HH:mm:ss")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "Invalid time, must be in format HH:mm:ss")]'));
|
||||
ok($d->find_element_by_xpath('//form//div//span[contains(text(), "By week day number should be like (\+|-)?\d*(MO|TU|WE|TH|FR|SA|SO) (e.g. 5FR)")]'));
|
||||
|
||||
diag("Fill in values");
|
||||
$d->fill_element('//*[@id="comment"]', 'xpath', 'Hello, im a special Event =)');
|
||||
$d->fill_element('//*[@id="startdate_datetimepicker"]', 'xpath', '2019-01-01');
|
||||
$d->fill_element('//*[@id="starttime_datetimepicker"]', 'xpath', '12:00:00');
|
||||
$d->find_element('//*[@id="end.switch.label.control"]')->click();
|
||||
$d->fill_element('//*[@id="enddate_datetimepicker"]', 'xpath', '2019-06-05');
|
||||
$d->fill_element('//*[@id="endtime_datetimepicker"]', 'xpath', '12:20:00');
|
||||
$d->unselect_if_selected('//*[@id="byday.weekdays.0"]');
|
||||
$d->find_element('//*[@id="byday.weekdaynumber"]')->clear();
|
||||
$d->find_element('//*[@id="byday.label"]')->click();
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Event");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Event entry successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="event_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#event_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="event_table_filter"]/label/input', 'xpath', 'Hello, im a special Event =)');
|
||||
|
||||
diag("Check details");
|
||||
ok($d->find_element_by_xpath('//*[@id="event_table"]//tr[1]/td[contains(text(), "Hello, im a special Event =)")]'), "Description is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="event_table"]//tr[1]/td[contains(text(), "every day from 12:00:00 to 12:20:00")]'), "Date/Time is correct");
|
||||
|
||||
diag("Edit Event");
|
||||
$d->move_and_click('//*[@id="event_table"]//tr[1]//td//a[contains(text(), "Edit")]', 'xpath', '//*[@id="event_table_filter"]//input');
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create Time Set Event")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="comment"]', 'xpath', 'Very important event');
|
||||
$d->fill_element('//*[@id="startdate_datetimepicker"]', 'xpath', '2020-06-01');
|
||||
$d->fill_element('//*[@id="starttime_datetimepicker"]', 'xpath', '12:00:00');
|
||||
$d->fill_element('//*[@id="enddate_datetimepicker"]', 'xpath', '2020-07-01');
|
||||
$d->fill_element('//*[@id="endtime_datetimepicker"]', 'xpath', '13:00:00');
|
||||
$d->find_element('//*[@id="byday.label"]')->click();
|
||||
$d->unselect_if_selected('//*[@id="byday.weekdays.4"]');
|
||||
$d->fill_element('//*[@id="byday.weekdaynumber"]', 'xpath', '+2FR');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Event");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Event entry successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="event_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#event_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="event_table_filter"]/label/input', 'xpath', 'Very important event');
|
||||
|
||||
diag("Check details");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Event entry successfully created', 'Correct Alert was shown');
|
||||
ok($d->find_element_by_xpath('//*[@id="event_table"]//tr[1]/td[contains(text(), "Very important event")]'), "Description is correct");
|
||||
ok($d->find_element_by_xpath('//*[@id="event_table"]//tr[1]/td[contains(text(), "every day on the 2nd Friday from 12:00:00 to 13:00:00")]'), "Date/Time is correct");
|
||||
|
||||
diag("Go to 'Peering Groups' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Peerings', 'link_text')->click();
|
||||
|
||||
diag("Create a Peering Group and add Time Set to Peering Group");
|
||||
$d->find_element("Create Peering Group", 'link_text')->click();
|
||||
ok($d->find_element_by_xpath('//*[@id="mod_edit"]/div/h3[contains(text(), "Create SIP Peering Group")]'), 'Edit window has been opened');
|
||||
$d->fill_element('//*[@id="contractidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#contractidtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="contractidtable_filter"]/label/input', 'xpath', 'default-system@default.invalid');
|
||||
ok($d->find_element_by_xpath('//*[@id="contractidtable"]//tr[1]/td[contains(text(), "default-system@default.invalid")]'), "Contact found");
|
||||
$d->select_if_unselected('//*[@id="contractidtable"]/tbody/tr[1]/td[5]/input');
|
||||
$d->fill_element('//*[@id="name"]', 'xpath', $groupname);
|
||||
$d->fill_element('//*[@id="description"]', 'xpath', 'For Timeset Testing');
|
||||
$d->fill_element('//*[@id="time_setidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#time_setidtable tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="time_setidtable_filter"]/label/input', 'xpath', $timesetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="time_setidtable"]//tr[1]/td[contains(text(), "' . $timesetname . '")]'), 'Time Set found');
|
||||
$d->select_if_unselected('//*[@id="time_setidtable"]/tbody/tr[1]/td[4]/input');
|
||||
$d->find_element('//*[@id="save"]')->click();
|
||||
|
||||
diag("Search Peering Group");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering group successfully created', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#sip_peering_group_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="sip_peering_group_table_filter"]/label/input', 'xpath', $groupname);
|
||||
|
||||
diag("Check Peering Group details");
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "default-system@default.invalid")]'), 'Contact is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $groupname . '")]', $groupname), 'Name is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "For Timeset Testing")]'), 'Description is correct');
|
||||
ok($d->find_element_by_xpath('//*[@id="sip_peering_group_table"]//tr[1]/td[contains(text(), "' . $timesetname . '")]', $timesetname), 'Time Set is correct');
|
||||
|
||||
diag("Delete Peering Group");
|
||||
$d->move_and_click('//*[@id="sip_peering_group_table"]//tr[1]//td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="sip_peering_group_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Peering Group successfully deleted', 'Correct Alert was shown');
|
||||
|
||||
diag("Go to 'Time Sets' page");
|
||||
$d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click();
|
||||
$d->find_element('Time Sets', 'link_text')->click();
|
||||
|
||||
diag("Try to NOT delete Time Set");
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#timeset_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', $timesetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="timeset_table"]//tr[1]/td[contains(text(), "' . $timesetname . '")]'), 'Time Set was found');
|
||||
$d->move_and_click('//*[@id="timeset_table"]//tr[1]/td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="timeset_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmCancel"]')->click();
|
||||
|
||||
diag("Check if Time Set is still here");
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', 'thisshouldnotexist');
|
||||
ok($d->find_element_by_css('#timeset_table tr > td.dataTables_empty', 'css'), 'Garbage text was not found');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', $timesetname);
|
||||
ok($d->find_element_by_xpath('//*[@id="timeset_table"]//tr[1]/td[contains(text(), "' . $timesetname . '")]'), 'Time Set is still here');
|
||||
|
||||
diag("Trying to delete Time Set");
|
||||
$d->move_and_click('//*[@id="timeset_table"]//tr[1]/td//a[contains(text(), "Delete")]', 'xpath', '//*[@id="timeset_table_filter"]/label/input');
|
||||
$d->find_element('//*[@id="dataConfirmOK"]')->click();
|
||||
|
||||
diag("Check if Time Set was deleted");
|
||||
is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Timeset entry successfully deleted', 'Correct Alert was shown');
|
||||
$d->fill_element('//*[@id="timeset_table_filter"]/label/input', 'xpath', $timesetname);
|
||||
ok($d->find_element_by_css('#timeset_table tr > td.dataTables_empty', 'css'), 'Time Set was deleted');
|
||||
|
||||
$c->delete_reseller_contract($contractid);
|
||||
$c->delete_reseller($resellername);
|
||||
|
||||
diag("This test run was successful");
|
||||
$run_ok = 1;
|
||||
|
||||
END {
|
||||
if(!$run_ok) {
|
||||
$c->crash_handler("/results/crash_timeset.png");
|
||||
}
|
||||
$d->quit();
|
||||
done_testing;
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
import os
|
||||
import random
|
||||
import time
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.common.by import By
|
||||
from functions.Functions import fill_element
|
||||
from functions.Functions import scroll_to_element
|
||||
from functions.Functions import click_js
|
||||
from functions.Functions import wait_for_invisibility
|
||||
|
||||
|
||||
def login_panel(driver, username="administrator", password="administrator"):
|
||||
driver.get(os.environ['CATALYST_SERVER'] + ":1443")
|
||||
driver.find_element_by_xpath('//*[@id="login_page_v1"]/div[3]/div/b/a').click()
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@aria-label="Username"]')))
|
||||
fill_element(driver, '//*[@aria-label="Username"]', username)
|
||||
fill_element(driver, '//*[@aria-label="Password"]', password)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div/main/div/form/div[2]/button[2]').click()
|
||||
driver.implicitly_wait(2)
|
||||
if len(driver.find_elements_by_xpath('//*[@id="footer"]//div//b/a[contains(., "GO TO NEW ADMIN PANEL")]')) > 0:
|
||||
driver.find_element_by_xpath('//*[@id="footer"]//div//b/a[contains(., "GO TO NEW ADMIN PANEL")]').click()
|
||||
driver.implicitly_wait(10)
|
||||
|
||||
|
||||
def logout_panel(driver):
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/button[@aria-label="UserMenu"]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/div[1]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="login-title"]')))
|
||||
|
||||
|
||||
def create_reseller(driver, resellername, contractname):
|
||||
print("Go to 'Reseller'...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[2]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[2]').click()
|
||||
print("OK")
|
||||
print("Try to create a new Reseller...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contract")]/../div/input', contractname)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div/div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
driver.find_element_by_xpath('/html/body//div/div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Name")]/../div/input', resellername)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//div/button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
|
||||
|
||||
def delete_reseller(driver, reseller):
|
||||
print("Go to 'Reseller'...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[2]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[2]').click()
|
||||
print("OK")
|
||||
print("Try to delete Reseller...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', reseller)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr[1]/td[contains(., "' + reseller + '")]')))
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr[1]/td[7]/button')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr[1]/td[7]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
print("OK")
|
||||
|
||||
|
||||
def create_reseller_contract(driver, contractname):
|
||||
print("Go to 'Contracts'...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[4]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[4]').click()
|
||||
print("OK")
|
||||
print("Try to create a new Reseller Contract...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Add")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[2]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contact")]/../div/input', "default")
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]/div[1]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Status")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "External")]/../div/input', contractname)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Billing Profile")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div[@role="alert"][contains(., "Contract created successfully")]')))
|
||||
print("OK")
|
||||
|
||||
|
||||
def delete_reseller_contract(driver, contract):
|
||||
print("Go to 'Contracts'...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[4]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[4]').click()
|
||||
print("OK")
|
||||
print("Try to delete Reseller Contract...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contract)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr/td[contains(., "' + contract + '")]')))
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr/td[8]/button')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div[1]/div/div[1]/table/tbody/tr/td[8]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
print("OK")
|
||||
|
||||
|
||||
def create_billing_profile(driver, billingname, billingrealname, reseller):
|
||||
print("Go to 'Billing Profiles'...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[10]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[10]').click()
|
||||
print("OK")
|
||||
print("Try to create a new Billing Profile...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div/div[2]/div[1]/div[1]/a').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div/div[2]/main/form/div/div[1]/div/div[1]/div/div/div[1]/label/div[1]/div[1]/div[2]/div[1]/input', reseller)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div/div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
driver.find_element_by_xpath('/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div/div[2]/main/form/div/div[1]/div/div[2]/div/label/div/div[1]/div/input', billingname)
|
||||
fill_element(driver, '//*[@id="q-app"]/div/div[2]/main/form/div/div[1]/div/div[3]/div/label/div/div[1]/div[1]/input', billingrealname)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/div/div[2]/button').click()
|
||||
print("OK")
|
||||
|
||||
|
||||
def delete_billing_profile(driver, billingrealname):
|
||||
print("Go to 'Billing Profiles'...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[10]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[1]/aside/div/div[2]/div[2]/div/div[2]/a[10]').click()
|
||||
print("OK")
|
||||
print("Try to delete Billing Profile...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', billingrealname)
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[7]/button')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[7]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div[2]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
print("OK")
|
||||
@ -0,0 +1,64 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
|
||||
|
||||
def fill_element(driver, element, text, pathtype=By.XPATH):
|
||||
elem = driver.find_element(pathtype, element)
|
||||
elem.send_keys(Keys.CONTROL + "a")
|
||||
elem.send_keys(Keys.DELETE)
|
||||
elem.send_keys(text)
|
||||
|
||||
|
||||
def scroll_to_element(driver, element):
|
||||
if element[:1] == "/":
|
||||
webelem = driver.find_element_by_xpath(element)
|
||||
else:
|
||||
webelem = driver.find_element_by_link_text(element)
|
||||
driver.execute_script("arguments[0].scrollIntoView();", webelem)
|
||||
|
||||
|
||||
def click_js(driver, element):
|
||||
if element[:1] == "/":
|
||||
webelement = driver.find_element_by_xpath(element)
|
||||
else:
|
||||
webelement = driver.find_element_by_link_text(element)
|
||||
driver.execute_script("arguments[0].click();", webelement)
|
||||
|
||||
|
||||
def create_firefoxdriver():
|
||||
profile = webdriver.FirefoxProfile()
|
||||
profile.accept_untrusted_certs = True
|
||||
caps = DesiredCapabilities().FIREFOX
|
||||
caps["pageLoadStrategy"] = "normal"
|
||||
driver = webdriver.Firefox(
|
||||
capabilities=caps, firefox_profile=profile,
|
||||
service_log_path='/dev/null', )
|
||||
driver.implicitly_wait(10)
|
||||
return driver
|
||||
|
||||
|
||||
def create_chromedriver():
|
||||
chromeoptions = webdriver.ChromeOptions()
|
||||
chromeoptions.add_argument('--allow-insecure-localhost')
|
||||
chromeoptions.add_argument('--ignore-certificate-errors')
|
||||
chromeoptions.add_argument('--no-sandbox')
|
||||
chromeoptions.add_argument('--disable-dev-shm-usage')
|
||||
chromeoptions.add_argument("--disable-logging")
|
||||
chromeoptions.add_argument("--log-level=3")
|
||||
chromeoptions.add_argument("--output=/dev/null")
|
||||
chromeoptions.add_argument("--start-maximized")
|
||||
chromeoptions.set_capability('acceptInsecureCerts', True)
|
||||
chromeoptions.set_capability('pageLoadStrategy', 'normal')
|
||||
driver = webdriver.Chrome(options=chromeoptions)
|
||||
driver.implicitly_wait(10)
|
||||
return driver
|
||||
|
||||
|
||||
def wait_for_invisibility(driver, xpath):
|
||||
driver.implicitly_wait(2)
|
||||
WebDriverWait(driver, 10).until(EC.invisibility_of_element_located((By.XPATH, xpath)))
|
||||
driver.implicitly_wait(10)
|
||||
@ -0,0 +1,22 @@
|
||||
#this is the test configuration for running tests on jenkins.
|
||||
#the only difference between this and localtest.cfg is that this will generate a junit result file
|
||||
|
||||
[unittest]
|
||||
plugins = nose2.plugins.junitxml
|
||||
nose2.plugins.mp
|
||||
exclude-plugins = nose2.plugins.failfast
|
||||
|
||||
[junit-xml]
|
||||
always-on = True
|
||||
keep_restricted = False
|
||||
path = /results/selenium.xml
|
||||
test_fullname = True
|
||||
|
||||
[multiprocess] #change thread count here. should be the same as in testrunner
|
||||
always-on = True
|
||||
processes = 2
|
||||
|
||||
[output-buffer]
|
||||
always-on = True
|
||||
stderr = False
|
||||
stdout = True
|
||||
@ -0,0 +1,22 @@
|
||||
#this is the test configuration for running tests on your local machine.
|
||||
#the only difference between this and jenkinstest.cfg is that this wont generate a junit result file
|
||||
|
||||
[unittest]
|
||||
plugins = nose2.plugins.junitxml
|
||||
nose2.plugins.mp
|
||||
exclude-plugins = nose2.plugins.failfast
|
||||
|
||||
[junit-xml]
|
||||
always-on = False
|
||||
keep_restricted = False
|
||||
path = selenium.xml
|
||||
test_fullname = True
|
||||
|
||||
[multiprocess] #change thread count here. should be the same as in testrunner
|
||||
always-on = True
|
||||
processes = 1
|
||||
|
||||
[output-buffer]
|
||||
always-on = True
|
||||
stderr = False
|
||||
stdout = True
|
||||
@ -1,170 +0,0 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use lib 't/lib';
|
||||
use Selenium::Remote::Driver::FirefoxExtensions;
|
||||
use Selenium::Collection::Common;
|
||||
use TAP::Harness;
|
||||
|
||||
require "/code/t/selenium/admin_login.t";
|
||||
|
||||
my $jenkins = $ENV{JENKINS};
|
||||
my $testplan = $ENV{TESTFILES};
|
||||
my $dir = 't/selenium/';
|
||||
my @tests;
|
||||
my $string;
|
||||
|
||||
if(!admin_login()) {
|
||||
print "-------------------------------------\n";
|
||||
print "Test was aborted. Login failed\n";
|
||||
print $ENV{CATALYST_SERVER} . "\n";
|
||||
print "-------------------------------------\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if($testplan eq $dir . 'runner.t') {
|
||||
@tests = (
|
||||
$dir . 'controller_admin.t',
|
||||
$dir . 'controller_billing.t',
|
||||
$dir . 'controller_customer.t',
|
||||
$dir . 'controller_domain.t',
|
||||
$dir . 'controller_emergency.t',
|
||||
$dir . 'controller_header.t',
|
||||
$dir . 'controller_invoice.t',
|
||||
$dir . 'controller_ncos.t',
|
||||
$dir . 'controller_other.t',
|
||||
$dir . 'controller_peering.t',
|
||||
$dir . 'controller_profilepackage.t',
|
||||
$dir . 'controller_profileset.t',
|
||||
$dir . 'controller_reseller.t',
|
||||
$dir . 'controller_rw_ruleset.t',
|
||||
$dir . 'controller_soundset.t',
|
||||
$dir . 'controller_subscriber.t',
|
||||
$dir . 'controller_terminate.t',
|
||||
$dir . 'controller_timeset.t',
|
||||
);
|
||||
|
||||
} elsif($testplan eq 'exp') {
|
||||
@tests = (
|
||||
$dir . 'controller_admin.t',
|
||||
$dir . 'controller_billing.t',
|
||||
$dir . 'controller_customer.t',
|
||||
$dir . 'controller_domain.t',
|
||||
$dir . 'controller_emergency.t',
|
||||
$dir . 'controller_header.t',
|
||||
$dir . 'controller_invoice.t',
|
||||
$dir . 'controller_ncos.t',
|
||||
$dir . 'controller_other.t',
|
||||
$dir . 'controller_peering.t',
|
||||
$dir . 'controller_profilepackage.t',
|
||||
$dir . 'controller_profileset.t',
|
||||
$dir . 'controller_reseller.t',
|
||||
$dir . 'controller_rw_ruleset.t',
|
||||
$dir . 'controller_soundset.t',
|
||||
$dir . 'controller_subscriber.t',
|
||||
$dir . 'controller_terminate.t',
|
||||
$dir . 'controller_timeset.t',
|
||||
);
|
||||
|
||||
} else {
|
||||
if (index($testplan, $dir . 'controller_admin.t') != -1 || index($testplan, $dir . 'admin') != -1) {
|
||||
$string = $dir . 'controller_admin.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_billing.t') != -1 || index($testplan, $dir . 'billing') != -1) {
|
||||
$string = $dir . 'controller_billing.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_customer.t') != -1 || index($testplan, $dir . 'customer') != -1) {
|
||||
$string = $dir . 'controller_customer.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_domain.t') != -1 || index($testplan, $dir . 'domain') != -1) {
|
||||
$string = $dir . 'controller_domain.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_emergency.t') != -1 || index($testplan, $dir . 'emergency') != -1) {
|
||||
$string = $dir . 'controller_emergency.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_header.t') != -1 || index($testplan, $dir . 'header') != -1) {
|
||||
$string = $dir . 'controller_header.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_invoice.t') != -1 || index($testplan, $dir . 'invoice') != -1) {
|
||||
$string = $dir . 'controller_invoice.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_ncos.t') != -1 || index($testplan, $dir . 'ncos') != -1) {
|
||||
$string = $dir . 'controller_ncos.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_other.t') != -1 || index($testplan, $dir . 'other') != -1) {
|
||||
$string = $dir . 'controller_other.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_peering.t') != -1 || index($testplan, $dir . 'peering') != -1) {
|
||||
$string = $dir . 'controller_peering.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_profilepackage.t') != -1 || index($testplan, $dir . 'profilepackage') != -1) {
|
||||
$string = $dir . 'controller_profilepackage.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_profileset.t') != -1 || index($testplan, $dir . 'profileset') != -1) {
|
||||
$string = $dir . 'controller_profileset.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_reseller.t') != -1 || index($testplan, $dir . 'reseller') != -1) {
|
||||
$string = $dir . 'controller_reseller.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_rw_ruleset.t') != -1 || index($testplan, $dir . 'rw_ruleset') != -1) {
|
||||
$string = $dir . 'controller_rw_ruleset.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_soundset.t') != -1 || index($testplan, $dir . 'soundset') != -1) {
|
||||
$string = $dir . 'controller_soundset.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_subscriber.t') != -1 || index($testplan, $dir . 'subscriber') != -1) {
|
||||
$string = $dir . 'controller_subscriber.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_terminate.t') != -1 || index($testplan, $dir . 'terminate') != -1) {
|
||||
$string = $dir . 'controller_terminate.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
if (index($testplan, $dir . 'controller_timeset.t') != -1 || index($testplan, $dir . 'timeset') != -1) {
|
||||
$string = $dir . 'controller_timeset.t';
|
||||
push @tests, $string;
|
||||
};
|
||||
};
|
||||
|
||||
if($jenkins) {
|
||||
my %args = ('lib', 't/lib',
|
||||
'merge', '1',
|
||||
'comments', '1',
|
||||
'failures', '1',
|
||||
'verbosity', '0',
|
||||
'formatter_class', 'TAP::Formatter::JUnit',
|
||||
'jobs', '4',
|
||||
'timer', '1',
|
||||
);
|
||||
my $harness = TAP::Harness->new( \%args );
|
||||
$harness->runtests(@tests);
|
||||
print "\n";
|
||||
|
||||
} else {
|
||||
my %args = ('lib', 't/lib',
|
||||
'comments', '1',
|
||||
'failures', '1',
|
||||
'formatter_class', 'TAP::Formatter::Console',
|
||||
'verbosity', '0',
|
||||
'color', '1',
|
||||
'jobs', '4',
|
||||
);
|
||||
my $harness = TAP::Harness->new( \%args );
|
||||
$harness->runtests(@tests);
|
||||
print "\n";
|
||||
};
|
||||
@ -0,0 +1,807 @@
|
||||
import unittest
|
||||
import os
|
||||
import traceback
|
||||
from multiprocessing import Value
|
||||
import nose2
|
||||
import time
|
||||
|
||||
|
||||
from functions.Functions import click_js
|
||||
from functions.Functions import create_firefoxdriver
|
||||
from functions.Functions import create_chromedriver
|
||||
from functions.Functions import fill_element
|
||||
from functions.Functions import scroll_to_element
|
||||
from functions.Functions import wait_for_invisibility
|
||||
from functions.Collections import login_panel
|
||||
from functions.Collections import logout_panel
|
||||
from functions.Collections import create_reseller
|
||||
from functions.Collections import create_reseller_contract
|
||||
from functions.Collections import create_billing_profile
|
||||
from functions.Collections import delete_reseller
|
||||
from functions.Collections import delete_reseller_contract
|
||||
from functions.Collections import delete_billing_profile
|
||||
import selenium.common.exceptions
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.common.by import By
|
||||
from datetime import datetime
|
||||
import random
|
||||
|
||||
filename = 0
|
||||
browser = ""
|
||||
|
||||
|
||||
class testrun(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
if browser == "firefox":
|
||||
self.driver = create_firefoxdriver()
|
||||
elif browser == "chrome":
|
||||
self.driver = create_chromedriver()
|
||||
self.longMessage = True
|
||||
|
||||
def test_admin(self):
|
||||
global filename
|
||||
adminname = "admin" + str(random.randint(1, 99999))
|
||||
resellername = "reseller" + str(random.randint(1, 99999))
|
||||
resellercontract = "contract" + str(random.randint(1, 99999))
|
||||
email = "test" + str(random.randint(1, 99999)) + "@test.com"
|
||||
filename = "test_admin.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
create_reseller_contract(driver, resellercontract)
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
create_reseller(driver, resellername, resellercontract)
|
||||
print("Go to 'Administrators'...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Administrators")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new Administrator...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "add")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', resellername)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
driver.find_element_by_xpath('/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Login")]/../div/input', adminname)
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Email")]/../div/input', email)
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//input[@aria-label="Password"]', 'administrato')
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//input[@aria-label="Password Retype"]', 'administrato')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if Administrator was created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
|
||||
print("OK")
|
||||
print("Try to log-in with new Administrator...", end="")
|
||||
logout_panel(driver)
|
||||
login_panel(driver, adminname, 'administrato')
|
||||
print("OK")
|
||||
print("Go back to administrator login", end="")
|
||||
logout_panel(driver)
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Administrators")]').click()
|
||||
print("OK")
|
||||
print("Try to enable 'Read only' for administrator...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table//tr[1]/td[9]/div').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
print("OK")
|
||||
print("Check if 'Read-only' was enabled...", end="")
|
||||
logout_panel(driver)
|
||||
login_panel(driver, adminname, 'administrato')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Customers")]').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.implicitly_wait(1)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Contacts")]').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.implicitly_wait(1)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Domains")]').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.implicitly_wait(1)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]')) == 0, "'Add' Button is still there")
|
||||
driver.implicitly_wait(10)
|
||||
print("OK")
|
||||
print("Go back to administrator login", end="")
|
||||
logout_panel(driver)
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Administrators")]').click()
|
||||
print("OK")
|
||||
print("Try to deactivate administrator...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table//tr[1]/td[8]/div').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
print("OK")
|
||||
print("Check if admin was deactivated...", end="")
|
||||
logout_panel(driver)
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@aria-label="Username"]')))
|
||||
fill_element(driver, '//*[@aria-label="Username"]', 'invalid')
|
||||
fill_element(driver, '//*[@aria-label="Password"]', 'data')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div/form//button[contains(., "Sign In")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div[contains(., "Wrong credentials")]')) > 0, "Admin was not deactivated")
|
||||
print("OK")
|
||||
print("Try to delete administrator...", end="")
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Administrators")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + adminname + '")]')) > 0, "Administrator was not found")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[16]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', adminname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Admin was not deleted")
|
||||
print("OK")
|
||||
delete_reseller(driver, resellername)
|
||||
filename = 0
|
||||
|
||||
"""
|
||||
def test_billing_profile(self):
|
||||
global filename
|
||||
billingname = "billing" + str(random.randint(1, 99999))
|
||||
billingrealname = "name" + str(random.randint(1, 99999))
|
||||
resellername = "reseller" + str(random.randint(1, 99999))
|
||||
resellercontract = "contract" + str(random.randint(1, 99999))
|
||||
filename = "test_billing_profile.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
create_reseller_contract(driver, resellercontract)
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
create_reseller(driver, resellername, resellercontract)
|
||||
print("Go to 'Billing Profiles'...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Billing Profiles")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new Billing Profile...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "add")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', resellername)
|
||||
driver.find_element_by_xpath('/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Handle")]/../div/input', billingname)
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Name")]/../div/input', billingrealname)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if Billing Profile was created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', billingrealname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + billingrealname + '")]')) > 0, "Billing Profile was not found")
|
||||
print("OK")
|
||||
print("Try to delete Billing Profile...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[7]/button')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[7]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div[2]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
print("OK")
|
||||
print("Check if Billing Profile was deleted...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', billingrealname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Billing Profile was not deleted")
|
||||
print("OK")
|
||||
delete_reseller(driver, resellername)
|
||||
filename = 0
|
||||
"""
|
||||
|
||||
def test_contacts(self):
|
||||
global filename
|
||||
contactmail = "contact" + str(random.randint(1, 99999)) + "@test.inv"
|
||||
firstname = "first" + str(random.randint(1, 99999))
|
||||
lasttname = "last" + str(random.randint(1, 99999))
|
||||
filename = "test_contact.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
print("Go to 'Contacts'...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Contacts")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new customer contact with an invalid Email...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Add")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', "default")
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Email")]/../div/input', "invaildmail")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div/main/form//div/label//div[contains(., "Input must be")]')) > 0)
|
||||
print("OK")
|
||||
print("Try to create a new customer contact...", end="")
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Email")]/../div/input', contactmail)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if customer contact was created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contactmail)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + contactmail + '")]')) > 0, "Contact was not found")
|
||||
print("OK")
|
||||
print("Try to add first and last name to contact...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[4]/span').click()
|
||||
fill_element(driver, '/html/body//div//label//div//input[@aria-label="First Name"]', firstname)
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + firstname + '")]')) > 0, "Contact first name was not changed")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[5]/span').click()
|
||||
fill_element(driver, '/html/body//div//label//div//input[@aria-label="Last Name"]', lasttname)
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', lasttname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + lasttname + '")]')) > 0, "Contact last name was not changed")
|
||||
print("OK")
|
||||
print("Try to delete contact...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[8]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contactmail)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Contact was not deleted")
|
||||
print("OK")
|
||||
print("Try to create a new system contact with an invalid Email...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Add")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[2]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Email")]/../div/input', "invaildmail")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div/main/form//div/label//div[contains(., "Input must be")]')) > 0)
|
||||
print("OK")
|
||||
print("Try to create a new system contact...", end="")
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Email")]/../div/input', contactmail)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if system contact was created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contactmail)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + contactmail + '")]')) > 0, "Contact was not found")
|
||||
print("OK")
|
||||
print("Try to add first and last name to contact...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[4]/span').click()
|
||||
fill_element(driver, '/html/body//div//label//div//input[@aria-label="First Name"]', firstname)
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + firstname + '")]')) > 0, "Contact first name was not changed")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[5]/span').click()
|
||||
fill_element(driver, '/html/body//div//label//div//input[@aria-label="Last Name"]', lasttname)
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', lasttname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + lasttname + '")]')) > 0, "Contact last name was not changed")
|
||||
print("OK")
|
||||
print("Try to edit and reset edits to system contact...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[8]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div/a[contains(., "Edit")]')))
|
||||
driver.find_element_by_xpath('/html/body//div/a[contains(., "Edit")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]//div/main//form//div/label//div/input[@aria-label="Company"]', contactmail)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//form/div/div[1]/div/div[4]/div/label/div/div/div[2]/button').click()
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/main//form//div/label//div/input[@aria-label="Company"]').get_attribute('value') == '', 'Saved value is not correct')
|
||||
print("OK")
|
||||
filename = 0
|
||||
|
||||
def test_contracts(self):
|
||||
global filename
|
||||
contractname = "customer" + str(random.randint(1, 99999))
|
||||
filename = "test_contracts.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
print("Go to 'Contracts'...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Contracts")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new peering contract...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Add")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contact")]/../div/input', "default")
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]/div[1]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Status")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "External")]/../div/input', contractname)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Billing Profile")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if contract has been created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contractname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + contractname + '")]')) > 0, "Reseller was not found")
|
||||
print("OK")
|
||||
print("Try to edit contract status...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[7]/span').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-item__label"][contains(., "Locked")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]')
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[7]/span[contains(., "Locked")]')) > 0, "Subscriber status was not edited")
|
||||
print("OK")
|
||||
print("Try to delete contract...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[8]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contractname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Contact was not deleted")
|
||||
print("OK")
|
||||
print("Try to create a new reseller contract...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Add")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[2]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contact")]/../div/input', "default")
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]/div[1]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Status")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "External")]/../div/input', contractname)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Billing Profile")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if contract has been created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contractname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + contractname + '")]')) > 0, "Reseller was not found")
|
||||
print("OK")
|
||||
print("Try to edit contract status...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[7]/span').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-item__label"][contains(., "Locked")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]')
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[7]/span[contains(., "Locked")]')) > 0, "Subscriber status was not edited")
|
||||
print("OK")
|
||||
print("Try to delete contract...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[8]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', contractname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Contract was not deleted")
|
||||
print("OK")
|
||||
filename = 0
|
||||
|
||||
def test_customer(self):
|
||||
global filename
|
||||
customername = "customer" + str(random.randint(1, 99999))
|
||||
filename = "test_customer.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
print("Go to 'Customers'...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Customers")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new customer...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contact")]/../div/input', "default")
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div/div[2]/main/form/div/div[2]/div[1]/div[2]/div/label/div[1]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Status")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "External")]/../div/input', customername)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if customer has been created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', customername)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + customername + '")]')) > 0, "Reseller was not found")
|
||||
print("OK")
|
||||
print("Try to edit customer status...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[9]/span').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-item__label"][contains(., "Locked")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]')
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[9]/span[contains(., "Locked")]')) > 0, "Subscriber status was not edited")
|
||||
print("OK")
|
||||
print("Go to customer preferences...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[11]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div/a[contains(., "Preferences")]')))
|
||||
driver.find_element_by_xpath('/html/body//div/a[contains(., "Preferences")]').click()
|
||||
print("OK")
|
||||
print("Try to change a setting (concurrent_max)...", end="")
|
||||
fill_element(driver, '/html/body//div//main//div//label//div/input[@aria-label="Maximum number of concurrent calls"]', 100)
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/input[@aria-label="Maximum number of concurrent calls"]').get_attribute('value') == '100',
|
||||
'Saved value is not correct')
|
||||
print("OK")
|
||||
print("Try to delete setting value and restoring it...", end="")
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/button[contains(., "cancel")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Reset")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/input[@aria-label="Maximum number of concurrent calls"]').get_attribute('value') == '100',
|
||||
'Saved value is not correct')
|
||||
print("OK")
|
||||
print("Try to delete setting...", end="")
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/button[contains(., "cancel")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/input[@aria-label="Maximum number of concurrent calls"]').get_attribute('value') == '', 'Saved value is not correct')
|
||||
print("OK")
|
||||
print("Try to delete customer...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Customers")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', customername)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + customername + '")]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[11]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', customername)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Reseller was not deleted")
|
||||
print("OK")
|
||||
filename = 0
|
||||
|
||||
def test_domain(self):
|
||||
global filename
|
||||
domainname = "domain" + str(random.randint(1, 99999))
|
||||
filename = "test_domain.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
print("Go to 'Domains'...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Domains")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new domain...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "add")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Reseller")]/../div/input', 'default')
|
||||
driver.find_element_by_xpath('/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Domain")]/../div/input', domainname)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div//button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if domain was created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', domainname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main/div//table/tbody/tr[1]/td[contains(., "' + domainname + '")]')) > 0, "Billing Profile was not found")
|
||||
print("OK")
|
||||
print("Try to open the domain preferences page...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[5]/button').click()
|
||||
WebDriverWait(driver, 10.).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/a[contains(., "Preferences")]')))
|
||||
driver.find_element_by_xpath('/html/body//div/a[contains(., "Preferences")]').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]')
|
||||
print("OK")
|
||||
print("Try to change a setting (allowed_ips) with an invalid value...", end="")
|
||||
fill_element(driver, '/html/body//div//main//div//label//div/input[@aria-label="Allowed source IPs"]', 'invalid')
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Save")]')) > 0, "Incorrect value was saved")
|
||||
print("OK")
|
||||
print("Try to change a setting (allowed_ips) with a valid value...", end="")
|
||||
fill_element(driver, '/html/body//div//main//div//label//div/input[@aria-label="Allowed source IPs"]', '10.0.0.0')
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/input[@aria-label="Allowed source IPs"]').get_attribute('value') == '10.0.0.0', 'Saved value is not correct')
|
||||
print("OK")
|
||||
print("Try to delete setting value and restoring it...", end="")
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/button[contains(., "cancel")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Reset")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/input[@aria-label="Allowed source IPs"]').get_attribute('value') == '', 'Saved value is not correct')
|
||||
print("OK")
|
||||
"""
|
||||
print("Try to delete setting...", end="")
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/button[contains(., "cancel")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div//button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div//main//div//label//div/svg[@class="q-spinner q-spinner-mat"]')
|
||||
self.assertTrue(
|
||||
driver.find_element_by_xpath('/html/body//div//main//div//label//div/input[@aria-label="Allowed source IPs"]').get_attribute('value') == '', 'Saved value is not correct')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Domains")]').click()
|
||||
print("OK")
|
||||
"""
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Domains")]').click()
|
||||
print("Try to delete domain...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', domainname)
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]//div/main//div/table/tbody/tr[1]/td[5]/button')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/main//div/table/tbody/tr[1]/td[5]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
print("OK")
|
||||
print("Check if domain was deleted...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', domainname)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Billing Profile was not deleted")
|
||||
print("OK")
|
||||
filename = 0
|
||||
|
||||
def test_login_page(self):
|
||||
global filename
|
||||
filename = "test_login_page.png"
|
||||
driver = self.driver
|
||||
driver.get(os.environ['CATALYST_SERVER'] + ":1443")
|
||||
driver.find_element_by_xpath('//*[@id="login_page_v1"]/div[3]/div/b/a').click()
|
||||
print("\nTry to login with no credentials...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="q-app"]/div//main/div/form//button[contains(., "Sign In")]')))
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div/form//button[contains(., "Sign In")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div[contains(., "Wrong credentials")]')) > 0, "Credentials werent rejected")
|
||||
print("OK")
|
||||
print("Try to login with false credentials...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@aria-label="Username"]')))
|
||||
fill_element(driver, '//*[@aria-label="Username"]', 'invalid')
|
||||
fill_element(driver, '//*[@aria-label="Password"]', 'data')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div/form//button[contains(., "Sign In")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div[contains(., "Wrong credentials")]')) > 0, "Credentials werent rejected")
|
||||
print("OK")
|
||||
print("Try to login with a wrong password...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@aria-label="Username"]')))
|
||||
fill_element(driver, '//*[@aria-label="Username"]', 'administrator')
|
||||
fill_element(driver, '//*[@aria-label="Password"]', 'ubvakud')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div/form//button[contains(., "Sign In")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div[contains(., "Wrong credentials")]')) > 0, "Credentials werent rejected")
|
||||
print("OK")
|
||||
print("Try to login with correct credentials...", end="")
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@aria-label="Username"]')))
|
||||
fill_element(driver, '//*[@aria-label="Username"]', 'administrator')
|
||||
fill_element(driver, '//*[@aria-label="Password"]', 'administrator')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main/div/form//button[contains(., "Sign In")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div[contains(., "Dashboard")]')) > 0, "Credentials werent accepted")
|
||||
print("OK")
|
||||
"""
|
||||
print("Try to open the handbook...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Documentation")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Handbook")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('/html/body/header/nav/div[1]/a[contains(., "The Sipwise NGCP Handbook")]')) > 0, "Handbook wasnt opened")
|
||||
print("OK")
|
||||
print("Try to navigate around the handbook...", end="")
|
||||
driver.find_element_by_xpath('/html/body//div//aside//div//nav/ul/li[contains(., "Architecture")]')
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('/html/body//div//article/h1[contains(., "Architecture")]')) > 0, "Page 'Architecture' wasnt opened")
|
||||
"""
|
||||
print("Try to logout...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/button[@aria-label="UserMenu"]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/div[1]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="login-title"]')) > 0, "Logout wasnt successful")
|
||||
print("OK")
|
||||
filename = 0
|
||||
|
||||
def test_reseller(self):
|
||||
global filename
|
||||
resellername = "reseller" + str(random.randint(1, 99999))
|
||||
resellercontract = "contract" + str(random.randint(1, 99999))
|
||||
filename = "test_reseller.png"
|
||||
driver = self.driver
|
||||
login_panel(driver)
|
||||
print("Go to 'Reseller'...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div/div[2]//div[contains(., "Settings")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Resellers")]').click()
|
||||
print("OK")
|
||||
print("Try to create a new Reseller Contract...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div/label//button[contains(., "Create")]').click()
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-list"]/a[2]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contact")]/../div/input', "default")
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]/div[1]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Status")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main/form//div//label[contains(., "Billing Profile")]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "External")]/../div/input', resellercontract)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('/html/body//div[@role="alert"][contains(., "Contract created successfully")]')) > 0, "Message 'Contract created successfully' didnt show up")
|
||||
print("OK")
|
||||
print("Try to create a new Reseller...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div/aside/div//a[contains(., "Resellers")]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/a[contains(., "Add")]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Contract")]/../div/input', resellercontract)
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body//div/div[@class="q-virtual-scroll__content"]/div[1]')))
|
||||
driver.find_element_by_xpath('/html/body//div/div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
fill_element(driver, '//*[@id="q-app"]/div//main/form/div//label//div[contains(., "Name")]/../div/input', resellername)
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//div/button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if reseller has been created...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', resellername)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + resellername + '")]')) > 0, "Reseller was not found")
|
||||
print("OK")
|
||||
print("Try to rename reseller...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/table/tbody/tr[1]/td[4]/span').click()
|
||||
resellername = "reseller" + str(random.randint(1, 99999))
|
||||
fill_element(driver, '/html/body//div//label//div//input[@aria-label="Name"]', resellername)
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
print("OK")
|
||||
print("Check if reseller name was changed...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', resellername)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "' + resellername + '")]')) > 0, "Reseller name was not changed")
|
||||
print("OK")
|
||||
print("Try to edit reseller status...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[5]/span').click()
|
||||
driver.find_element_by_xpath('/html/body//div[contains(., "Locked")]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div[@class="q-virtual-scroll__content"]')
|
||||
driver.find_element_by_xpath('/html/body//div/button[contains(., "Save")]').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[5]/span[contains(., "Locked")]')) > 0, "Subscriber status was not edited")
|
||||
print("OK")
|
||||
print("Try to enable and disable WebRTC...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//div/table/tbody/tr[1]/td[6]/div').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div/table/tbody/tr[1]/td[6]/div[@aria-checked="true"]')) > 0, "WebRTC was not enabled")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//div/table/tbody/tr[1]/td[6]/div').click()
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div/table/tbody/tr[1]/td[6]/div[@aria-checked="false"]')) > 0, "WebRTC was not disabled")
|
||||
print("OK")
|
||||
print("Try to open the reseller edit page...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[7]/button').click()
|
||||
WebDriverWait(driver, 10.).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/a[contains(., "Edit")]')))
|
||||
driver.find_element_by_xpath('/html/body//div/a[contains(., "Edit")]').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]')
|
||||
print("OK")
|
||||
print("Try to edit reseller status...", end="")
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]//div//main//form//div//label[@label="Status"]').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div//div[@class="q-virtual-scroll__content"]/div[2]')))
|
||||
time.sleep(1)
|
||||
driver.find_element_by_xpath('/html/body//div[@class="q-virtual-scroll__content"]/div[1]').click()
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Save")]').click()
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div/button[contains(., "Close")]').click()
|
||||
print("OK")
|
||||
print("Check if reseller staus has been changed...", end="")
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body//div/main//div/label//div/input')))
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', resellername)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//table/tbody/tr[1]/td[contains(., "Active")]')) > 0, "Status was not changed")
|
||||
print("OK")
|
||||
print("Try to delete Reseller...", end="")
|
||||
wait_for_invisibility(driver, '//*[@id="q-app"]/div//main//div/table/thead/tr[2]/th/div[@role="progressbar"]')
|
||||
driver.find_element_by_xpath('//*[@id="q-app"]/div//main//div//table/tbody/tr[1]/td[7]/button').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div/div')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div/div').click()
|
||||
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div[4]/div[2]/div/div[3]/button[2]')))
|
||||
driver.find_element_by_xpath('/html/body/div[4]/div[2]/div/div[3]/button[2]').click()
|
||||
wait_for_invisibility(driver, '/html/body//div/main//div/label//div/input[contains(@class, "q-field--disabled")]')
|
||||
fill_element(driver, '/html/body//div/main//div/label//div/input', resellername)
|
||||
self.assertTrue(
|
||||
len(driver.find_elements_by_xpath('//*[@id="q-app"]//div//main//div//i')) > 0, "Reseller was not deleted")
|
||||
print("OK")
|
||||
filename = 0
|
||||
|
||||
def tearDown(self):
|
||||
global filename
|
||||
driver = self.driver
|
||||
if filename:
|
||||
print("FAIL")
|
||||
driver.save_screenshot('/results/' + filename)
|
||||
filename = 0
|
||||
driver.quit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
browser = os.environ['BROWSER']
|
||||
if browser == "all":
|
||||
print('----------------------------------------------------------------------')
|
||||
print('Running NGCP Panel tests now! (Browser: Firefox + Chrome)')
|
||||
print('----------------------------------------------------------------------')
|
||||
browser = "firefox"
|
||||
nose2.main(exit=False)
|
||||
browser = "chrome"
|
||||
nose2.main(exit=False)
|
||||
else:
|
||||
print('----------------------------------------------------------------------')
|
||||
print('Running NGCP Panel tests now! (Browser: ' + os.environ['BROWSER'].capitalize() + ')')
|
||||
print('----------------------------------------------------------------------')
|
||||
nose2.main(exit=False)
|
||||
Loading…
Reference in new issue