From 189d9ba8e8b91ada78b208d783b54a09ff492c9e Mon Sep 17 00:00:00 2001 From: Nico Schedel Date: Fri, 4 Oct 2019 11:46:27 +0200 Subject: [PATCH] TT#68016 selenium: improve handling of details tabs details tabs are quite a gamble, beeing closed even if they were supposed not to and sometimes straight up not expanding when you click on them. now all tabs will be expanded at once and scroll_to_element scrolls to the right tab, dealing with the inconsistency of tabs Change-Id: I4e41a67072fc83b7d316ee652b24e4f7ba13f5ff --- t/selenium/controller_customer.t | 45 ++++++++++---------------- t/selenium/controller_domain.t | 23 ++++++++----- t/selenium/controller_emergency.t | 9 ++---- t/selenium/controller_ncos.t | 3 +- t/selenium/controller_peering.t | 21 ++++++------ t/selenium/controller_profilepackage.t | 11 ++++--- t/selenium/controller_reseller.t | 8 ++--- t/selenium/controller_rw_ruleset.t | 22 +++++++------ t/selenium/controller_soundset.t | 6 +++- t/selenium/controller_subscriber.t | 36 ++++++++++----------- t/selenium/controller_terminate.t | 2 +- 11 files changed, 94 insertions(+), 92 deletions(-) diff --git a/t/selenium/controller_customer.t b/t/selenium/controller_customer.t index 8e56e07f07..5391e99d3e 100644 --- a/t/selenium/controller_customer.t +++ b/t/selenium/controller_customer.t @@ -114,7 +114,8 @@ diag("Open Details for our just created Customer"); $d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input'); diag("Edit our contact"); -$d->find_element('//div[contains(@class,"accordion-heading")]//a[contains(text(),"Contact Details")]')->click(); +$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(); $d->fill_element('div.modal #firstname', 'css', "Alice"); $d->fill_element('#company', 'css', 'Sipwise'); @@ -137,9 +138,8 @@ if($d->find_element_by_xpath('//*[@id="masthead"]/div/div/div/h2')->get_text() e ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[2]', $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'); } -if($d->find_element_by_xpath('//*[@id="customer_details"]//div//a[contains(text(), "Contact Details")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') { - $d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contact Details")]')->click(); -} +$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->wait_for_text('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Email")]/../td[2]', $contactmail), "Email is correct"); ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Name")]/../td[contains(text(), "Alice")]'), "Name is correct"); ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Company")]/../td[contains(text(), "Sipwise")]'), "Company is correct"); @@ -148,8 +148,6 @@ ok($d->find_element_by_xpath('//*[@id="collapse_contact"]//table//tr//td[contain 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->find_element('//div[contains(@class,"accordion-heading")]//a[contains(text(),"Contact Details")]')->click(); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]')->click(); $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")]'); @@ -169,18 +167,13 @@ $d->find_element('#save', 'css')->click(); diag("Check Fraud Limit details"); is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Fraud settings 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(),"Fraud Limits")]')); -if($d->find_element('//*[@id="collapse_fraud"]')->get_attribute('class', 1) eq 'accordion-body collapse') { - $d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]')->click(); -} 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->wait_for_text('//*[@id="collapse_fraud"]//table//tr//td[contains(text(), "Monthly Settings")]/../td[4]', 'mymail@example.org'), "Mail is correct"); diag("Go to Contract Balance"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]')->click(); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]')->click(); -$d->wait_for_attribute('//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]', 'class', 'accordion-toggle collapsed'); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]')->click(); +$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(); @@ -207,7 +200,8 @@ $d->find_element('//*[@id="save"]')->click(); is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Account balance successfully changed!', "Correct Alert was shown"); diag("Check if Cash Balance was set correctly"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]')->click(); +$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"]//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"); @@ -226,17 +220,13 @@ $d->find_element('//*[@id="save"]')->click(); is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Top-up using cash performed successfully!', "Correct Alert was shown"); diag("Check if Top-up was successful"); +$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"]//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"); -diag("Create a new Phonebook entry"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]')->click(); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Contract Balance")]')->click(); -$d->wait_for_attribute('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]', 'class', 'accordion-toggle collapsed'); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]')->click(); +diag("Create a new empty Phonebook entry"); $d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]')); - -diag("Trying to create a empty Phonebook entry"); $d->find_element("Create Phonebook Entry", 'link_text')->click(); $d->find_element('//*[@id="save"]')->click(); @@ -251,7 +241,7 @@ $d->find_element('//*[@id="save"]')->click(); diag("Search for 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="customer_details"]//div//a[contains(text(),"Phonebook")]')->click(); +$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', 'Tester'); @@ -270,14 +260,13 @@ $d->find_element('//*[@id="save"]')->click(); diag("Check if information has changed"); is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Phonebook entry successfully updated', "Correct Alert was shown"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]')->click(); +$d->find_element('//*[@id="toggle-accordions"]')->click(); +$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]')); ok($d->find_element_by_xpath('//*[@id="phonebook_table"]/tbody/tr[1]/td[contains(text(), "TesterTester")]'), "Name is correct"); ok($d->find_element_by_xpath('//*[@id="phonebook_table"]/tbody/tr[1]/td[contains(text(), "987654321")]'), "Number is correct"); diag("Create a new Location"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]')->click(); -$d->wait_for_attribute('//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]', 'class', 'accordion-toggle collapsed'); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Locations")]')->click(); +$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Locations")]')); $d->find_element("Create Location", 'link_text')->click(); diag("Trying to create a empty Location"); @@ -326,8 +315,7 @@ $d->find_element('//*[@id="save"]')->click(); diag("Search for Location"); is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Location successfully created', "Correct Alert was shown"); -$d->find_element('//*[@id="customer_details"]//div//div//a[contains(text(),"Locations")]')->click(); -$d->scroll_to_element($d->find_element('//*[@id="customer_details"]//div//div//a[contains(text(),"Locations")]')); +$d->find_element('//*[@id="toggle-accordions"]')->click(); $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'); @@ -351,6 +339,7 @@ is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Loc diag("Check location details"); $d->find_element('//*[@id="customer_details"]//div//div//a[contains(text(),"Locations")]')->click(); +$d->find_element('//*[@id="toggle-accordions"]')->click(); $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"]/tbody/tr[1]/td[contains(text(), "TestTest Location")]'), "Name is correct"); ok($d->find_element_by_xpath('//*[@id="locations_table"]/tbody/tr[1]/td[contains(text(), "This is a very Test Location")]'), "Description is correct"); diff --git a/t/selenium/controller_domain.t b/t/selenium/controller_domain.t index dc7ae6027d..d49533f727 100644 --- a/t/selenium/controller_domain.t +++ b/t/selenium/controller_domain.t @@ -40,8 +40,9 @@ ok($d->wait_for_text('//*[@id="Domain_table"]/tbody/tr[1]/td[contains(text(), "d diag("Open Preferences of first Domain"); $d->move_and_click('//*[@id="Domain_table"]//tr[1]//td//a[contains(text(), "Preferences")]', 'xpath', '//*[@id="Domain_table_filter"]/label/input'); -diag('Open the tab "Access Restrictions"'); -$d->find_element("Access Restrictions", 'link_text')->click(); +diag("Go to 'Acces Restrictions'"); +$d->find_element('//*[@id="toggle-accordions"]')->click(); +$d->scroll_to_element($d->find_element("Access Restrictions", 'link_text')); diag("Click edit for the 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")]'); @@ -59,8 +60,9 @@ $d->fill_element('#concurrent_max', 'css', '789'); $d->find_element('#save', 'css')->click(); diag('Check if value has been applied'); -$d->find_element("Access Restrictions", 'link_text')->click(); 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/tbody/tr/td[contains(text(), "concurrent_max")]/../td[contains(text(), "789")]'), "Value has been applied"); diag("Click edit for the preference allowed_ips"); @@ -81,6 +83,8 @@ $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/tbody/tr/td[contains(text(), "allowed_ips")]/../td[contains(text(), "127.0.0.1")]'), "IP address has beeen found"); diag("Add another IP address"); @@ -91,6 +95,8 @@ $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/tbody/tr/td[contains(text(), "allowed_ips")]/../td[contains(text(), "10.0.0.138")]'), "IP address has beeen found"); diag("Delete the first IP address"); @@ -100,13 +106,10 @@ $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/tbody/tr/td[contains(text(), "allowed_ips")]/../td[contains(text(), "10.0.0.138")]'), "IP address has beeen found"); -diag("Enable transcoding to Opus Mono and Stereo"); -$d->find_element("Access Restrictions", 'link_text')->click(); -$d->scroll_to_element($d->find_element('Media Codec Transcoding Options', 'link_text')); -$d->find_element('Media Codec Transcoding Options', 'link_text')->click(); - 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")]'); @@ -116,6 +119,7 @@ $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"); @@ -130,6 +134,7 @@ $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"); @@ -141,6 +146,7 @@ $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"); @@ -155,6 +161,7 @@ $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("Open delete dialog and press cancel"); diff --git a/t/selenium/controller_emergency.t b/t/selenium/controller_emergency.t index cab2dc1aaf..5f0ffe4680 100644 --- a/t/selenium/controller_emergency.t +++ b/t/selenium/controller_emergency.t @@ -131,8 +131,7 @@ ok($d->wait_for_text('//*[@id="Domain_table"]/tbody/tr[1]/td[contains(text(), "d $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("Number Manipulations", 'link_text')->click(); -$d->scroll_to_element($d->find_element('//*[@id="preference_groups"]//div//a[contains(text(),"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")]')); @@ -143,12 +142,9 @@ $d->find_element('//*[@id="save"]')->click(); diag("Check if '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("Open 'Internals'"); -$d->find_element("Internals", 'link_text')->click(); -$d->scroll_to_element($d->find_element('//*[@id="preference_groups"]//div//a[contains(text(),"Internals")]')); - 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")]'); @@ -158,6 +154,7 @@ $d->find_element('//*[@id="save"]')->click(); diag("Check if Setting 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"); diff --git a/t/selenium/controller_ncos.t b/t/selenium/controller_ncos.t index 25624e49bc..ae00b143ee 100644 --- a/t/selenium/controller_ncos.t +++ b/t/selenium/controller_ncos.t @@ -202,7 +202,7 @@ ok($d->wait_for_text('//*[@id="Domain_table"]/tbody/tr[1]/td[contains(text(), "d $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("Call Blockings", 'link_text')->click(); +$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'"); @@ -214,6 +214,7 @@ $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 interface'); diff --git a/t/selenium/controller_peering.t b/t/selenium/controller_peering.t index 324dd40b49..f0ac2d035c 100644 --- a/t/selenium/controller_peering.t +++ b/t/selenium/controller_peering.t @@ -207,8 +207,9 @@ ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]/tbody/tr/td[conta diag('Go into Peering Server Preferences'); $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('Open the tab "Number Manipulations"'); -$d->find_element("Number Manipulations", 'link_text')->click(); +diag('Go to "Number Manipulations"'); +$d->find_element('//*[@id="toggle-accordions"]')->click(); +$d->scroll_to_element($d->find_element("Number Manipulations", 'link_text')); diag("Click edit for the 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")]'); @@ -220,14 +221,13 @@ $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("Number Manipulations", 'link_text')->click(); +$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->wait_for_text('//table//td[contains(text(), "inbound_upn")]/../td/select/option[@selected="selected"]', "P-Asserted-Identity"), "Value has been applied"); -diag('Open the tab "Remote Authentication"'); -$d->find_element("Number Manipulations", 'link_text')->click(); +diag('Go to "Remote Authentication"'); $d->scroll_to_element($d->find_element("Remote Authentication", 'link_text')); -$d->find_element("Remote Authentication", 'link_text')->click(); diag('Edit 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")]'); @@ -237,7 +237,8 @@ $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("Remote Authentication", 'link_text')->click(); +$d->find_element('//*[@id="toggle-accordions"]')->click(); +$d->scroll_to_element($d->find_element("Remote Authentication", 'link_text')); ok($d->wait_for_text('//table/tbody/tr/td[contains(text(), "peer_auth_user")]/../td[4]', 'peeruser1'), 'peer_auth_user value has been set'); diag('Edit peer_auth_pass'); @@ -248,7 +249,8 @@ $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("Remote Authentication", 'link_text')->click(); +$d->find_element('//*[@id="toggle-accordions"]')->click(); +$d->scroll_to_element($d->find_element("Remote Authentication", 'link_text')); ok($d->wait_for_text('//table/tbody/tr/td[contains(text(), "peer_auth_pass")]/../td[4]', 'peerpass1'), 'peer_auth_pass value has been set'); diag('Edit peer_auth_realm'); @@ -259,7 +261,8 @@ $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("Remote Authentication", 'link_text')->click(); +$d->find_element('//*[@id="toggle-accordions"]')->click(); +$d->scroll_to_element($d->find_element("Remote Authentication", 'link_text')); ok($d->wait_for_text('//table/tbody/tr/td[contains(text(), "peer_auth_realm")]/../td[4]', 'testpeering.com'), 'peer_auth_realm value has been set'); diag("Go back to Servers/Rules"); diff --git a/t/selenium/controller_profilepackage.t b/t/selenium/controller_profilepackage.t index 5cb2080e1c..ddecc5cb1e 100644 --- a/t/selenium/controller_profilepackage.t +++ b/t/selenium/controller_profilepackage.t @@ -114,8 +114,9 @@ ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains( diag('Go to 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('Open up "Contract Balance"'); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click(); +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('Enter "Set Cash Balance"'); $d->find_element("Set Cash Balance", "link_text")->click(); @@ -125,7 +126,7 @@ $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="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click(); +$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"); @@ -139,7 +140,7 @@ $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="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click(); +$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"); @@ -165,7 +166,7 @@ $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="customer_details"]//div//a[contains(text(),"Contract Balance")]')->click(); +$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"); diff --git a/t/selenium/controller_reseller.t b/t/selenium/controller_reseller.t index 80a23f0916..8d5de60d33 100644 --- a/t/selenium/controller_reseller.t +++ b/t/selenium/controller_reseller.t @@ -95,9 +95,8 @@ diag("Go to Reseller Details"); $d->move_and_click('//*[@id="Resellers_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Resellers_table_filter"]//input'); diag("Create a 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('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]')->click(); -$d->scroll_to_element($d->find_element("Create Phonebook Entry", 'link_text')); $d->find_element("Create Phonebook Entry", 'link_text')->click(); $d->find_element('//*[@id="save"]')->click(); @@ -112,8 +111,7 @@ $d->find_element('//*[@id="save"]')->click(); diag("Searching Phonebook entry"); is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Phonebook entry successfully created", "Correct Alert was shown"); -$d->scroll_to_element($d->find_element('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]')); -$d->find_element('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]')->click(); +$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'); @@ -130,8 +128,8 @@ $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")]')); -$d->find_element('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]')->click(); ok($d->wait_for_text('//*[@id="phonebook_table"]/tbody/tr/td[2]', 'newtestname'), 'Name is correct'); ok($d->wait_for_text('//*[@id="phonebook_table"]/tbody/tr/td[3]', '0987654321'), 'Number is correct'); diff --git a/t/selenium/controller_rw_ruleset.t b/t/selenium/controller_rw_ruleset.t index 969cdb66c4..3651057faf 100644 --- a/t/selenium/controller_rw_ruleset.t +++ b/t/selenium/controller_rw_ruleset.t @@ -99,8 +99,8 @@ $d->find_element('//*[@id="field"]/option[@value="caller"]')->click(); $d->find_element('//*[@id="save"]')->click(); diag('Check if Rule has been created'); -$d->find_element('Inbound Rewrite Rules for Caller', 'link_text')->click(); 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/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(), "\2")]'), "Replacement Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]//td[contains(text(), "Not International to E.164")]'), "Description is correct"); @@ -111,8 +111,8 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'International to E.164'); $d->find_element('//*[@id="save"]')->click(); diag('Check if Rule has been edited'); -$d->find_element('Inbound Rewrite Rules for Caller', 'link_text')->click(); 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/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(), "\2")]'), "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"); @@ -126,8 +126,8 @@ $d->find_element('//*[@id="field"]/option[@value="callee"]')->click(); $d->find_element('//*[@id="save"]')->click(); diag('Check if Rule has been created'); -$d->find_element('Inbound Rewrite Rules for Callee', 'link_text')->click(); 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/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(), "Not International to E.164")]'), "Description is correct"); @@ -138,8 +138,8 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'International to E.164'); $d->find_element('//*[@id="save"]')->click(); diag('Check if Rule has been edited'); -$d->find_element('Inbound Rewrite Rules for Callee', 'link_text')->click(); 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/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"); @@ -154,12 +154,14 @@ $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'); -$d->find_element('Inbound Rewrite Rules for Caller', 'link_text')->click(); +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/tbody/tr[1]/td[contains(text(), "\1")]'), "Replacement Pattern is correct"); =pod diag('Delete Rule'); -$d->move_and_click('//*[@id="collapse_icaller"]//table//tr[1]//td//a[text()[contains(., "Delete")]]', 'xpath', '//*[@id="masthead"]//div/h2'); +$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"); =cut @@ -191,13 +193,12 @@ ok($d->find_element_by_xpath('//*[@id="rewrite_rule_set_table"]//tr[1]//td[conta $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('Inbound Rewrite Rules for Caller', 'link_text')->click(); +$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'); -$d->find_element('Inbound Rewrite Rules for Callee', 'link_text')->click(); 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"); @@ -213,15 +214,16 @@ ok($d->wait_for_text('//*[@id="Domain_table"]/tbody/tr/td[3]', $domainstring), ' $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 a domain'); -$d->find_element('Number Manipulations', 'link_text')->click(); +$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->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'); -$d->find_element('Number Manipulations', 'link_text')->click; 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->wait_for_text('//table/tbody/tr/td[contains(text(), "rewrite_rule_set")]/../td[4]/select/option[@selected="selected"]', $rulesetname), 'rewrite_rule_set value has been set'); diag('Delete Domain'); diff --git a/t/selenium/controller_soundset.t b/t/selenium/controller_soundset.t index 8bd1343c41..30aee9c261 100644 --- a/t/selenium/controller_soundset.t +++ b/t/selenium/controller_soundset.t @@ -78,13 +78,14 @@ diag('Go to Sound Set files'); $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="sound_groups"]//div/a[contains(text(), "conference")]')->click(); +$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")]'); $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 the default files'); @@ -93,6 +94,7 @@ $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'); @@ -105,6 +107,7 @@ $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'); @@ -118,6 +121,7 @@ $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'); diff --git a/t/selenium/controller_subscriber.t b/t/selenium/controller_subscriber.t index 70530cdc4a..188f86fcaf 100644 --- a/t/selenium/controller_subscriber.t +++ b/t/selenium/controller_subscriber.t @@ -44,7 +44,7 @@ ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[2]', $customerid) $d->move_and_click('//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]', 'xpath', '//*[@id="Customer_table_filter"]//input'); diag("Trying to add a empty Subscriber"); -$d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]')->click(); +$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(); $d->unselect_if_selected('//*[@id="domainidtable"]/tbody/tr[1]/td[4]/input'); @@ -81,9 +81,7 @@ if($d->find_element_by_xpath('//*[@id="masthead"]/div/div/div/h2')->get_text() e ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[2]', $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'); } -if($d->find_element_by_xpath('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') { - $d->find_element('//*[@id="customer_details"]//div//a[contains(text(), "Subscribers")]')->click(); -} +$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); @@ -153,7 +151,8 @@ diag('Go to Subscriber details'); $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="subscriber_data"]//div//a[contains(text(), "Master Data")]')->click(); +$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'); @@ -166,6 +165,7 @@ $d->find_element('//*[@id="save"]')->click(); diag('Check if change was applied'); 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'); @@ -173,7 +173,9 @@ ok($d->find_element_by_css('#subscriber_table tr > td.dataTables_empty'), 'Table $d->fill_element('//*[@id="subscriber_table_filter"]/label/input', 'xpath', $username); ok($d->wait_for_text('//*[@id="subscriber_table"]/tbody/tr/td[3]', $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'); -$d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]')->click(); +=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 .'")]')); @@ -192,14 +194,11 @@ if($d->find_element_by_xpath('//*[@id="masthead"]/div/div/div/h2')->get_text() e ok($d->wait_for_text('//*[@id="subscriber_table"]/tbody/tr/td[4]', $username), 'Found Subscriber'); $d->move_and_click('//*[@id="subscriber_table"]//tr[1]//td//a[contains(text(), "Details")]', 'xpath', '//*[@id="subscriber_table_filter"]/label/input'); } -if($d->find_element_by_xpath('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]/../../../div')->get_attribute('class', 1) eq 'accordion-group') { - $d->find_element('//*[@id="subscriber_data"]//div//a[contains(text(), "Master Data")]')->click(); -} -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(); -$d->scroll_to_element($d->find_element("Edit", 'link_text')); +$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(); $d->find_element('//*[@id="lock"]')->click(); $d->find_element('//*[@id="lock"]/option[contains(text(), "none")]')->click(); @@ -215,8 +214,7 @@ diag('Go to Subscriber preferences'); $d->find_element("Preferences", 'link_text')->click(); diag('Trying to change subscriber IVR language'); -$d->scroll_to_element($d->find_element("Internals", 'link_text')); -$d->find_element("Internals", 'link_text')->click(); +$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")]'); @@ -226,12 +224,11 @@ $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('Trying to enable call recording'); -$d->scroll_to_element($d->find_element("NAT and Media Flow Control", 'link_text')); -$d->find_element("NAT and Media Flow Control", 'link_text')->click(); $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")]'); @@ -244,8 +241,8 @@ is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Pre ok($d->find_element_by_xpath('//table//tr/td[contains(text(), "record_call")]/../td//input[@checked="checked"]'), "Call recording was enabled"); diag('Trying to add a simple call forward'); +$d->find_element('//*[@id="toggle-accordions"]')->click(); $d->scroll_to_element($d->find_element("Call Forwards", 'link_text')); -$d->find_element("Call Forwards", 'link_text')->click(); $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(); @@ -309,7 +306,7 @@ ok($d->find_element_by_xpath('//*[@id="preferences_table_cf"]/tbody/tr[1]/td[con ok($d->find_element_by_xpath('//*[@id="preferences_table_cf"]/tbody/tr[1]/td[contains(text(), ' . $destinationname . ')]'), 'Destination set was selected'); diag('Trying to add call blockings'); -$d->find_element("Call Blockings", 'link_text')->click(); +$d->find_element('//*[@id="toggle-accordions"]')->click(); $d->scroll_to_element($d->find_element("Call Blockings", 'link_text')); diag('Edit block_in_mode'); @@ -318,6 +315,7 @@ $d->find_element('//*[@id="block_in_mode"]')->click(); $d->find_element('//*[@id="save"]')->click(); diag('Check if value was set'); +$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"); @@ -331,6 +329,7 @@ $d->find_element('//*[@id="add"]')->click(); $d->find_element('//*[@id="mod_close"]')->click(); diag('Check if value was set'); +$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[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"); @@ -341,6 +340,7 @@ $d->find_element('//*[@id="mod_edit"]//div//input[@value="1337"]/../a[2]')->clic $d->find_element('//*[@id="mod_close"]')->click(); diag('Check if Entry was 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 was disabled"); diff --git a/t/selenium/controller_terminate.t b/t/selenium/controller_terminate.t index 0faed64a6b..cb6c51712f 100644 --- a/t/selenium/controller_terminate.t +++ b/t/selenium/controller_terminate.t @@ -42,7 +42,7 @@ ok($d->find_element_by_css('#Customer_table tr > td.dataTables_empty', 'css'), ' $d->fill_element('#Customer_table_filter input', 'css', $customerid); ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[2]', $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="customer_details"]//div//a[contains(text(), "Subscribers")]')->click(); +$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(); $d->fill_element('//*[@id="domainidtable_filter"]/label/input', 'xpath', 'thisshouldnotexist');