diff --git a/t/selenium/controller_profile.t b/t/selenium/controller_profilepackage.t similarity index 99% rename from t/selenium/controller_profile.t rename to t/selenium/controller_profilepackage.t index e17a2257ee..5cb2080e1c 100644 --- a/t/selenium/controller_profile.t +++ b/t/selenium/controller_profilepackage.t @@ -211,7 +211,7 @@ $run_ok = 1; END { if(!$run_ok) { - $c->crash_handler("/results/crash_profile.png"); + $c->crash_handler("/results/crash_profilepackage.png"); } $d->quit(); done_testing; diff --git a/t/selenium/controller_profileset.t b/t/selenium/controller_profileset.t new file mode 100644 index 0000000000..384b1f3665 --- /dev/null +++ b/t/selenium/controller_profileset.t @@ -0,0 +1,255 @@ +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 $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('Trying to create a empty Subscriber profile set'); +$d->find_element("Create Subscriber Profile Set", 'link_text')->click(); +$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->wait_for_text('//*[@id="reselleridtable"]/tbody/tr[1]/td[2]', $resellername), "Reseller found"); +$d->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input', 'xpath'); +$d->fill_element('//*[@id="name"]', 'xpath', $setname); +$d->fill_element('//*[@id="description"]', 'xpath', 'This is a description. It describes things'); +$d->find_element('//*[@id="save"]')->click(); + +diag('Trying to find 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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $setname), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[4]', 'This is a description. It describes things'), 'Description is correct'); +ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//td[contains(text(), "' . $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'); +$d->fill_element('//*[@id="name"]', 'xpath', $setname); +$d->fill_element('//*[@id="description"]', 'xpath', 'Very Good description here'); +$d->find_element('//*[@id="save"]')->click(); + +diag('Trying to find 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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $setname), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[4]', 'Very Good description here'), 'Description is correct'); +ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//td[contains(text(), "' . $resellername .'")]'), 'Reseller is correct'); + +diag('Enter "Profiles" menu'); +$d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Profiles")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input'); + +diag('Trying to create a empty Subscriber Profile'); +$d->find_element("Create Subscriber Profile", 'link_text')->click(); +$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 for 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->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $profilename), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'This is a description. It describes things'), 'Description is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $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'); +$d->fill_element('//*[@id="name"]', 'xpath', $profilename); +$d->fill_element('//*[@id="description"]', 'xpath', 'Very very useful description'); +$d->find_element('//*[@id="save"]')->click(); + +diag('Check profile details'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $profilename), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'Very very useful description'), 'Description is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $setname), 'Profile Set is correct'); + +diag('Go to Profile Preferences'); +$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")]'); +$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'); +$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->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $cloneprofilename), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'indeed a good description'), 'Description is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $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'); +$d->select_if_unselected('//*[@id="set_default"]', 'xpath'); +$d->find_element('//*[@id="save"]')->click(); + +diag('Check if Cloned Profile is now Default'); +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->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $profilename), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'Very very useful description'), 'Description is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $setname), 'Profile Set is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[5]', '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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $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'); +$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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $clonedsetname), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[4]', 'indeed a very interesting description'), 'Description is correct'); +ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//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->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $profilename), 'Name is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'Very very useful description'), 'Description is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $clonedsetname), 'Profile Set is correct'); +ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[5]', '1'), 'Original Profile is now default'); +$d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click(); + +diag('Delete Cloned 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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $clonedsetname), 'Cloned 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 Profile Set got 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 Profile set was deleted'); + +diag('Trying 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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $setname), 'Profile Set is still here'); + +diag('Trying 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 successfull"); +$run_ok = 1; + +END { + if(!$run_ok) { + $c->crash_handler("/results/crash_profileset.png"); + } + $d->quit(); + done_testing; +} \ No newline at end of file diff --git a/t/selenium/controller_subscriber.t b/t/selenium/controller_subscriber.t index cb037a97bc..fd920b624c 100644 --- a/t/selenium/controller_subscriber.t +++ b/t/selenium/controller_subscriber.t @@ -93,17 +93,8 @@ 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('Trying to create a empty Subscriber profile set'); +diag('Trying to create a Subscriber profile set'); $d->find_element("Create Subscriber Profile Set", 'link_text')->click(); -$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); @@ -124,36 +115,11 @@ ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[4]', 'This is a description. It describes things'), 'Description is correct'); ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//td[contains(text(), "' . $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'); -$d->fill_element('//*[@id="name"]', 'xpath', $setname); -$d->fill_element('//*[@id="description"]', 'xpath', 'Very Good description here'); -$d->find_element('//*[@id="save"]')->click(); - -diag('Trying to find 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->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $setname), 'Name is correct'); -ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[4]', 'Very Good description here'), 'Description is correct'); -ok($d->find_element_by_xpath('//*[@id="subscriber_profile_sets_table"]//tr//td[contains(text(), "' . $resellername .'")]'), 'Reseller is correct'); - diag('Enter "Profiles" menu'); $d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/a[contains(text(), "Profiles")]', 'xpath', '//*[@id="subscriber_profile_sets_table_filter"]/label/input'); -diag('Trying to create a empty Subscriber Profile'); +diag('Trying to create a Subscriber Profile'); $d->find_element("Create Subscriber Profile", 'link_text')->click(); -$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"]')); @@ -171,24 +137,6 @@ ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $prof ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'This is a description. It describes things'), 'Description is correct'); ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $setname), 'Profile Set is correct'); -diag('Edit Subscriber 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'); -$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 for Profile'); -is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Subscriber profile successfully updated", "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->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[3]', $profilename), 'Name is correct'); -ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[4]', 'Very very useful description'), 'Description is correct'); -ok($d->wait_for_text('//*[@id="subscriber_profile_table"]/tbody/tr/td[2]', $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(); @@ -240,7 +188,6 @@ is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Suc #ok($d->find_element_by_xpath('//div[text()[contains(., "Subscriber status is locked")]]'), 'Message "Subscriber status is locked" was shown'); #ok($d->find_element_by_xpath('//div[text()[contains(., "Subscriber is locked for global")]]'), 'Message "Subscriber is locked for global" was shown'); ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr//td[contains(text(), "Status")]/../td[contains(text(), "locked")]'), "Status is correct"); -ok($d->find_element_by_xpath('//*[@id="subscribers_table"]//tr//td[contains(text(), "Status")]/../td[contains(text(), "locked")]'), "Status is correct"); diag('Unlock Subscriber'); $d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]')->click(); @@ -435,7 +382,7 @@ ok($d->wait_for_text('//*[@id="subscriber_profile_sets_table"]/tbody/tr/td[3]', $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 Sethas been deleted'); +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); diff --git a/t/selenium/runner.t b/t/selenium/runner.t index 87b83b526d..5652465a6e 100644 --- a/t/selenium/runner.t +++ b/t/selenium/runner.t @@ -24,7 +24,6 @@ if(!admin_login()) { if($testplan eq $dir . 'runner.t') { @tests = ( - $dir . 'controller_subscriber.t', $dir . 'controller_admin.t', $dir . 'controller_billing.t', $dir . 'controller_customer.t', @@ -35,16 +34,16 @@ if($testplan eq $dir . 'runner.t') { $dir . 'controller_ncos.t', $dir . 'controller_other.t', $dir . 'controller_peering.t', - $dir . 'controller_profile.t', + $dir . 'controller_profilepackage.t', $dir . 'controller_reseller.t', $dir . 'controller_rw_ruleset.t', $dir . 'controller_soundset.t', + $dir . 'controller_subscriber.t', $dir . 'controller_timeset.t', ); } elsif($testplan eq 'exp') { @tests = ( - $dir . 'controller_subscriber.t', $dir . 'controller_admin.t', $dir . 'controller_billing.t', $dir . 'controller_customer.t', @@ -55,10 +54,12 @@ if($testplan eq $dir . 'runner.t') { $dir . 'controller_ncos.t', $dir . 'controller_other.t', $dir . 'controller_peering.t', - $dir . 'controller_profile.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_timeset.t', ); @@ -103,10 +104,14 @@ if($testplan eq $dir . 'runner.t') { $string = $dir . 'controller_peering.t'; push @tests, $string; }; - if (index($testplan, $dir . 'controller_profile.t') != -1) { + if (index($testplan, $dir . 'controller_profilepackage.t') != -1) { $string = $dir . 'controller_profile.t'; push @tests, $string; }; + if (index($testplan, $dir . 'controller_profileset.t') != -1) { + $string = $dir . 'controller_subprofile.t'; + push @tests, $string; + }; if (index($testplan, $dir . 'controller_reseller.t') != -1) { $string = $dir . 'controller_reseller.t'; push @tests, $string;