diff --git a/t/lib/Selenium/Collection/Common.pm b/t/lib/Selenium/Collection/Common.pm index 4ec94195e5..0cb5a858d4 100644 --- a/t/lib/Selenium/Collection/Common.pm +++ b/t/lib/Selenium/Collection/Common.pm @@ -51,7 +51,7 @@ sub create_domain { $self->driver->select_if_unselected('//*[@id="reselleridtable"]/tbody/tr[1]/td[5]/input'); $self->driver->fill_element('//*[@id="domain"]', 'xpath', $name); $self->driver->find_element('//*[@id="save"]')->click(); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Domain successfully created", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Domain successfully created", "Correct Alert was shown"); } sub delete_domain { @@ -73,7 +73,7 @@ sub delete_domain { popup_confirm_cancel($self, 'We are NOT going to delete this domain'); } else { popup_confirm_ok($self, 'We are going to delete this domain'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Domain successfully deleted!", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Domain successfully deleted!", "Correct Alert was shown"); }; } @@ -95,7 +95,7 @@ sub create_reseller { $self->driver->select_if_unselected('//*[@id="contractidtable"]/tbody/tr/td[5]/input'); $self->driver->fill_element('//*[@id="name"]', 'xpath', $name); $self->driver->find_element('//*[@id="save"]')->click(); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully created.", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully created.", "Correct Alert was shown"); } sub create_reseller_contract { @@ -145,7 +145,7 @@ sub delete_reseller { popup_confirm_cancel($self, 'We are NOT going to delete this reseller'); } else { popup_confirm_ok($self, 'We are going to delete this reseller'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Successfully terminated reseller", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Successfully terminated reseller", "Correct Alert was shown"); }; } @@ -168,7 +168,7 @@ sub delete_reseller_contract { popup_confirm_cancel($self, 'We are NOT going to delete this reseller contract'); } else { popup_confirm_ok($self, 'We are going to delete this reseller contract'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contract successfully terminated", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Contract successfully terminated", "Correct Alert was shown"); }; } @@ -191,7 +191,7 @@ sub create_rw_ruleset { $self->driver->fill_element('//*[@id="name"]', 'xpath', $rulesetname); $self->driver->fill_element('//*[@id="description"]', 'xpath', 'For testing purposes'); $self->driver->find_element('//*[@id="save"]')->click(); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully created", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully created", "Correct Alert was shown"); } sub delete_rw_ruleset { @@ -213,7 +213,7 @@ sub delete_rw_ruleset { popup_confirm_cancel($self, 'We are NOT going to delete this ruleset'); } else { popup_confirm_ok($self, 'We are going to delete this ruleset'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully deleted", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully deleted", "Correct Alert was shown"); }; } @@ -271,7 +271,7 @@ sub delete_customer { popup_confirm_cancel($self, 'We are NOT going to terminate this customer'); } else { popup_confirm_ok($self, 'We are going to terminate this customer'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Customer successfully terminated", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Customer successfully terminated", "Correct Alert was shown"); }; } @@ -296,7 +296,7 @@ sub create_contact { $self->driver->fill_element('//*[@id="email"]', 'xpath', $contactmail); $self->driver->fill_element('//*[@id="company"]', 'xpath', 'SIPWISE'); $self->driver->find_element('//*[@id="save"]')->click(); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully created", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully created", "Correct Alert was shown"); } sub delete_contact { @@ -318,7 +318,7 @@ sub delete_contact { popup_confirm_cancel($self, 'We are NOT going to terminate this contact'); } else { popup_confirm_ok($self, 'We are going to terminate this contact'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully terminated", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully terminated", "Correct Alert was shown"); }; } @@ -342,7 +342,7 @@ sub create_billing_profile { $self->driver->fill_element('[name=handle]', 'css', $billingname); $self->driver->find_element('//select[@id="fraud_interval_lock"]/option[contains(text(),"foreign calls")]')->click(); $self->driver->find_element('//div[contains(@class,"modal")]//input[@type="submit"]')->click(); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Billing profile successfully created", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Billing profile successfully created", "Correct Alert was shown"); } sub delete_billing_profile { @@ -364,7 +364,7 @@ sub delete_billing_profile { popup_confirm_cancel($self, 'We are NOT going to terminate this billing profile'); } else { popup_confirm_ok($self, 'We are going to terminate this billing profile'); - is($self->driver->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Billing profile successfully terminated", "Correct Alert was shown"); + is($self->driver->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Billing profile successfully terminated", "Correct Alert was shown"); }; } diff --git a/t/lib/Selenium/Remote/Driver/FirefoxExtensions.pm b/t/lib/Selenium/Remote/Driver/FirefoxExtensions.pm index 0516db0764..f090f9a98d 100644 --- a/t/lib/Selenium/Remote/Driver/FirefoxExtensions.pm +++ b/t/lib/Selenium/Remote/Driver/FirefoxExtensions.pm @@ -159,4 +159,26 @@ sub wait_for_attribute { } return 0; } + +sub get_text_safe { + my ($self, $path, $type) = @_; + $type = "xpath" unless $type; + if($type eq "css"){ + try { + my $element = $self->find_element_by_css($path); + return $element->get_text(); + } catch { + return 0; + }; + } elsif($type eq "xpath"){ + try { + my $element = $self->find_element_by_xpath($path); + return $element->get_text(); + } catch { + return 0; + }; + } else { + return "Unknown Element Type: " . $type; + } +} 1; diff --git a/t/selenium/controller_admin.t b/t/selenium/controller_admin.t index 8a6c10a1af..f8cd867160 100644 --- a/t/selenium/controller_admin.t +++ b/t/selenium/controller_admin.t @@ -50,7 +50,7 @@ $d->fill_element('//*[@id="password"]', 'xpath', $adminpwd); $d->find_element('//*[@id="save"]')->click(); diag('Search for our new admin'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully created', "Correct Alert was shown"); +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); @@ -69,7 +69,7 @@ $d->select_if_unselected('//*[@id="read_only"]'); $d->find_element('//*[@id="save"]')->click(); diag('Check Admin details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully updated', "Correct Alert was shown"); +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); @@ -132,7 +132,7 @@ $d->move_and_click('//*[@id="administrator_table"]/tbody/tr[1]/td//a[contains(te $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if admin is deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Administrator successfully deleted', "Correct Alert was shown"); +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'), 'Admin was deleted'); diff --git a/t/selenium/controller_billing.t b/t/selenium/controller_billing.t index b592e05be0..8b497fa005 100644 --- a/t/selenium/controller_billing.t +++ b/t/selenium/controller_billing.t @@ -54,7 +54,7 @@ $d->fill_element('#interval_charge', 'css', '3.2'); $d->find_element('#save', 'css')->click(); diag("Check if values are correct"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing profile successfully updated', "Correct Alert was shown"); +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); @@ -81,7 +81,7 @@ 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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Zone successfully created', "Correct Alert was shown"); +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'); @@ -135,7 +135,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Fee successfully created!', "Correct Alert was shown"); +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'); @@ -151,7 +151,7 @@ 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->find_element('//*[@id="direction"]/option[@value="in"]')->click(); $d->find_element('//*[@id="save"]')->click(); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing fee successfully changed!', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing fee successfully changed!', "Correct Alert was shown"); diag('Check Billing Fee Details'); $d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', 'thisshouldnotexist'); @@ -176,7 +176,7 @@ ok($d->wait_for_text('//*[@id="billing_fee_table"]/tbody/tr/td[6]', $zonedetailn diag('Trying 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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing fee successfully deleted!', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing fee successfully deleted!', "Correct Alert was shown"); diag('Check if Billing Fee was deleted'); $d->fill_element('//*[@id="billing_fee_table_filter"]/label/input', 'xpath', $zonedetailname); @@ -198,7 +198,7 @@ ok($d->wait_for_text('//*[@id="billing_zone_table"]/tbody/tr/td[2]', $zonename), diag('Trying 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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing zone successfully deleted', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing zone successfully deleted', "Correct Alert was shown"); diag('Check if Billing Zone was deleted'); $d->fill_element('//*[@id="billing_zone_table_filter"]/label/input', 'xpath', $zonename); @@ -268,7 +268,7 @@ 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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully created', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully created', "Correct Alert was shown"); diag("Check if created date definition is correct"); $d->fill_element('//div[contains(@class, "dataTables_filter")]//input', 'xpath', 'thisshouldnotexist'); @@ -287,7 +287,7 @@ diag("Check if created 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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully updated', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully updated', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="date_definition_table"]/tbody/tr/td[2]', '2018-01-01 00:00:00'), 'Start Date definition is correct'); ok($d->wait_for_text('//*[@id="date_definition_table"]/tbody/tr/td[3]', '2019-01-01 23:59:59'), 'End Date definition is correct'); @@ -297,7 +297,7 @@ ok($d->find_text("Are you sure?"), 'Delete dialog appears'); $d->find_element('#dataConfirmOK', 'css')->click(); diag("Check if created date definition was deleted"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Special offpeak entry successfully deleted', "Correct Alert was shown"); +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'), 'Table is empty'); diag("Open delete dialog and press cancel"); @@ -313,7 +313,7 @@ diag("Open delete dialog and press ok"); $c->delete_billing_profile($billingname); diag("Check if Billing Profile has been removed"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing profile successfully terminated', "Correct Alert was shown"); +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 removed'); @@ -360,7 +360,7 @@ ok($d->find_element_by_css('#networks_table tr > td.dataTables_empty', 'css'), ' $d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', $billingnetwork); diag('Check Details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Network successfully created', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing Network successfully created', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="networks_table"]//tr[1]/td[2]', $resellername), "Reseller is correct"); ok($d->wait_for_text('//*[@id="networks_table"]//tr[1]/td[3]', $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"); @@ -383,7 +383,7 @@ ok($d->find_element_by_css('#networks_table tr > td.dataTables_empty', 'css'), ' $d->fill_element('//*[@id="networks_table_filter"]/label/input', 'xpath', $billingnetwork); diag('Check Details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing network successfully updated', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing network successfully updated', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="networks_table"]//tr[1]/td[2]', $resellername), "Reseller is correct"); ok($d->wait_for_text('//*[@id="networks_table"]//tr[1]/td[3]', $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"); @@ -404,7 +404,7 @@ $d->move_and_click('//*[@id="networks_table"]//tr[1]//td//a[contains(text(), "Te $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Billing Network has been deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Billing network successfully terminated', "Correct Alert was shown"); +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 was deleted'); diff --git a/t/selenium/controller_customer.t b/t/selenium/controller_customer.t index fea48398c5..86df38a030 100644 --- a/t/selenium/controller_customer.t +++ b/t/selenium/controller_customer.t @@ -74,12 +74,12 @@ ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains( ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "locked")]'), 'Status is correct'); $custnum = $d->get_text('//*[@id="Customer_table"]//tr[1]//td[1]'); $compstring = "Customer #" . $custnum . " successfully created - Details"; -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), $compstring, "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, "Correct Alert was shown"); 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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Customer is locked', "Correct Alert was shown"); +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(); @@ -96,7 +96,7 @@ $d->find_element('#save', 'css')->click(); diag("Search for Customer"); $compstring = "Customer #" . $custnum . " successfully updated"; -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), $compstring, "Correct Alert was shown"); +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); @@ -108,7 +108,7 @@ ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr[1]/td[4]', $contactmail ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "' . $billingname . '")]'), 'Billing Profile is correct'); ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "active")]'), 'Status is correct'); $compstring = "Customer #" . $custnum . " successfully updated"; -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), $compstring, "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, "Correct Alert was shown"); 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'); @@ -129,7 +129,7 @@ $d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains( $d->find_element('#save', 'css')->click(); diag("Check contact details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Contact successfully changed', "Correct Alert was shown"); +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'); @@ -168,7 +168,7 @@ $d->fill_element('#fraud_interval_notify', 'css', 'mymail@example.org'); $d->find_element('#save', 'css')->click(); diag("Check Fraud Limit details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Fraud settings successfully changed!', "Correct Alert was shown"); +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")]')); 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(); @@ -197,7 +197,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '0123456789'); $d->find_element('//*[@id="save"]')->click(); diag("Search for Phonebook Entry"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Phonebook entry successfully created', "Correct Alert was shown"); +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->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'); @@ -216,7 +216,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '987654321'); $d->find_element('//*[@id="save"]')->click(); diag("Check if information has changed"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Phonebook entry successfully updated', "Correct Alert was shown"); +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->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'); @@ -275,7 +275,7 @@ $d->fill_element('//*[@id="blocks.0.row.mask"]', 'xpath', '16'); $d->find_element('//*[@id="save"]')->click(); diag("Search for Location"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Location successfully created', "Correct Alert was shown"); +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->fill_element('//*[@id="locations_table_filter"]/label/input', 'xpath', 'thisshouldnotexist'); @@ -297,7 +297,7 @@ $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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Location successfully updated', "Correct Alert was shown"); +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="customer_details"]//div//div//a[contains(text(),"Locations")]')->click(); @@ -314,7 +314,7 @@ ok($d->wait_for_text('//*[@id="Customer_table"]/tbody/tr/td[2]', $customerid), ' diag('Open delete dialog and press delete'); $c->delete_customer($customerid, 0); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Customer successfully terminated', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Customer successfully terminated', "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 deleted'); @@ -334,7 +334,7 @@ $d->fill_element('#Customer_table_filter input', 'css', $customerid); ok($d->find_element_by_xpath('//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "' . $customerid . '")]'), 'Customer found'); $custnum = $d->get_text('//*[@id="Customer_table"]//tr[1]//td[1]'); $compstring = "Customer #" . $custnum . " successfully created - Details"; -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), $compstring, "Correct Alert was shown"); +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'); @@ -344,7 +344,7 @@ $d->find_element('#save', 'css')->click(); diag('Check if customer was deleted'); $compstring = "Customer #" . $custnum . " successfully updated"; -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), $compstring, "Correct Alert was shown"); +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 deleted'); @@ -376,7 +376,7 @@ $d->move_and_click('//*[@id="contact_table"]/tbody/tr[1]//td//div//a[contains(te $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Contact has been deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully terminated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Contact successfully terminated", "Correct Alert was shown"); $d->fill_element('//*[@id="contact_table_filter"]/label/input', 'xpath', $contactmail); ok($d->find_element_by_css('#contact_table tr > td.dataTables_empty', 'css'), 'Contact has been deleted'); diff --git a/t/selenium/controller_domain.t b/t/selenium/controller_domain.t index ed4ce61bfb..901f66ed14 100644 --- a/t/selenium/controller_domain.t +++ b/t/selenium/controller_domain.t @@ -60,7 +60,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference concurrent_max successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference concurrent_max successfully updated", "Correct Alert was shown"); 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"); @@ -115,7 +115,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference transcode_opus_mono successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference transcode_opus_mono successfully updated", "Correct Alert was shown"); 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"); @@ -128,7 +128,7 @@ $d->find_element('//*[@id="opus_mono_bitrate"]/option[contains(text(), "32")]')- $d->find_element('//*[@id="save"]')->click(); diag("Check if Bitrate was applied"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference opus_mono_bitrate successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference opus_mono_bitrate successfully updated", "Correct Alert was shown"); 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"); @@ -139,7 +139,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference transcode_opus_stereo successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference transcode_opus_stereo successfully updated", "Correct Alert was shown"); 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"); @@ -152,7 +152,7 @@ $d->find_element('//*[@id="opus_stereo_bitrate"]/option[contains(text(), "32")]' $d->find_element('//*[@id="save"]')->click(); diag("Check if Bitrate was applied"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference opus_stereo_bitrate successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference opus_stereo_bitrate successfully updated", "Correct Alert was shown"); 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"); @@ -163,7 +163,7 @@ ok($d->wait_for_text('//*[@id="Domain_table"]/tbody/tr[1]/td[3]', $domainstring) diag('Open delete dialog and press delete'); $c->delete_domain($domainstring, 0); $d->fill_element('//*[@id="Domain_table_filter"]/label/input', 'xpath', $domainstring); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Domain successfully deleted!", "Correct Alert was shown"); +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 was deleted'); diag("This test run was successfull"); diff --git a/t/selenium/controller_emergency.t b/t/selenium/controller_emergency.t index 8bd13aaaa1..cab2dc1aaf 100644 --- a/t/selenium/controller_emergency.t +++ b/t/selenium/controller_emergency.t @@ -46,7 +46,7 @@ $d->fill_element('//*[@id="name"]', 'xpath', $containername); $d->find_element('//*[@id="save"]')->click(); diag("Search for our new Emergency Container"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Emergency mapping container successfully created", "Correct Alert was shown"); +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); @@ -62,7 +62,7 @@ $d->fill_element('//*[@id="name"]', 'xpath', $containername); $d->find_element('//*[@id="save"]')->click(); diag("Search for our new Emergency Container"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Emergency mapping container successfully updated", "Correct Alert was shown"); +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); @@ -91,7 +91,7 @@ $d->fill_element('//*[@id="prefix"]', 'xpath', "E1_133_"); $d->find_element('//*[@id="save"]')->click(); diag("Search for our new Emergency Mapping"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Emergency mapping successfully created", "Correct Alert was shown"); +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); @@ -109,7 +109,7 @@ $d->fill_element('//*[@id="prefix"]', 'xpath', "E2_144_"); $d->find_element('//*[@id="save"]')->click(); diag("Search for our new Emergency Mapping"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Emergency mapping successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Emergency mapping successfully updated", "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); @@ -142,7 +142,7 @@ $d->find_element('//*[@id="emergency_mapping_container"]/option[contains(text(), $d->find_element('//*[@id="save"]')->click(); diag("Check if 'emergency_mapping_container' was applied"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference emergency_mapping_container successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference emergency_mapping_container successfully updated", "Correct Alert was shown"); 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'"); @@ -157,7 +157,7 @@ $d->select_if_unselected('//*[@id="emergency_mode_enabled"]'); $d->find_element('//*[@id="save"]')->click(); diag("Check if Setting was enabled"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference emergency_mode_enabled successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference emergency_mode_enabled successfully updated", "Correct Alert was shown"); 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"); @@ -183,7 +183,7 @@ $d->move_and_click('//*[@id="emergency_mappings_table"]/tbody/tr/td[6]/div/a[con $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Emergency Mapping was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Emergency mapping successfully deleted", "Correct Alert was shown"); +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 was deleted'); @@ -206,7 +206,7 @@ $d->move_and_click('//*[@id="emergency_containers_table"]/tbody/tr/td[4]/div/a[c $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Emergency Container was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Emergency mapping container successfully deleted", "Correct Alert was shown"); +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 was deleted'); $d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click(); diff --git a/t/selenium/controller_header.t b/t/selenium/controller_header.t index 36b54d41ed..e44e4fbab6 100644 --- a/t/selenium/controller_header.t +++ b/t/selenium/controller_header.t @@ -51,7 +51,7 @@ $d->fill_element('//*[@id="description"]' , 'xpath', 'This is a nice description $d->find_element('//*[@id="save"]')->click(); diag('Search for Header Rule set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule set successfully created', "Correct Alert was shown"); +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); @@ -69,7 +69,7 @@ $d->fill_element('//*[@id="description"]' , 'xpath', 'This is a very nice descri $d->find_element('//*[@id="save"]')->click(); diag('Search for Header Rule set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule set successfully updated', "Correct Alert was shown"); +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); @@ -96,7 +96,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'this is a nice description' $d->find_element('//*[@id="save"]')->click(); diag('Check Details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully created', "Correct Alert was shown"); +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")]'), "Reseller is correct"); @@ -115,7 +115,7 @@ $d->select_if_unselected('//*[@id="stopper"]'); $d->find_element('//*[@id="save"]')->click(); diag('Check Details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully updated', "Correct Alert was shown"); +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")]'), "Reseller is correct"); @@ -130,7 +130,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully created', "Correct Alert was shown"); +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'); @@ -146,7 +146,7 @@ $d->move_and_click('//*[@id="header_rules_table"]//tr[1]//td//a[contains(text(), $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Header Rule was deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule successfully deleted', "Correct Alert was shown"); +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 was deleted'); @@ -169,7 +169,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully created', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully created', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="header_rule_conditions_table"]//tr[1]//td[4]', $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"); @@ -196,7 +196,7 @@ $d->fill_element('//*[@id="values.0.value"]', 'xpath', 'randomvalue'); $d->find_element('//*[@id="save"]')->click(); diag('Check Details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully updated', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully updated', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="header_rule_conditions_table"]//tr[1]//td[4]', $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"); @@ -217,7 +217,7 @@ $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Header Rule Condition was deleted'); ok($d->find_element_by_css('#header_rule_conditions_table tr > td.dataTables_empty', 'css'), 'Header Rule Condition was deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully deleted', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule condition successfully deleted', "Correct Alert was shown"); diag('Go to Header Rule Actions'); $d->find_element('Actions', 'link_text')->click(); @@ -237,7 +237,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully created', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully created', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="header_rule_actions_table"]/tbody/tr[1]/td[3]', $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"); @@ -260,7 +260,7 @@ $d->unselect_if_selected('//*[@id="enabled"]'); $d->find_element('//*[@id="save"]')->click(); diag('Check Details'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully updated', "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully updated', "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="header_rule_actions_table"]/tbody/tr[1]/td[3]', $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"); @@ -275,7 +275,7 @@ $d->fill_element('//*[@id="c_header"]', 'xpath', 'second'); $d->find_element('//*[@id="save"]')->click(); diag('Move new entry up'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully created', "Correct Alert was shown"); +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'); @@ -291,7 +291,7 @@ $d->move_and_click('//*[@id="header_rule_actions_table"]//tr[1]//td//a[contains( $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Header Rule Action was deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule action successfully deleted', "Correct Alert was shown"); +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 was deleted'); @@ -308,7 +308,7 @@ $d->move_and_click('//*[@id="header_rule_set_table"]//tr[1]//td//a[contains(text $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Header Rule set was deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), 'Header rule set successfully deleted', "Correct Alert was shown"); +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 was deleted'); diff --git a/t/selenium/controller_invoice.t b/t/selenium/controller_invoice.t index 202c214b11..e4bb91997a 100644 --- a/t/selenium/controller_invoice.t +++ b/t/selenium/controller_invoice.t @@ -52,7 +52,7 @@ $d->fill_element('//*[@id="name"]', 'xpath', $templatename); $d->find_element('//*[@id="save"]')->click(); diag("Search for Template"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Invoice template successfully created", "Correct Alert was shown"); +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); @@ -69,7 +69,7 @@ $d->fill_element('//*[@id="name"]', 'xpath', $templatename); $d->find_element('//*[@id="save"]')->click(); diag("Search for Template"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Invoice template successfully updated", "Correct Alert was shown"); +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); @@ -151,7 +151,7 @@ ok($d->wait_for_text('//*[@id="Invoice_table"]/tbody/tr/td[2]', $custnum), 'Cust ok($d->wait_for_text('//*[@id="Invoice_table"]/tbody/tr/td[3]', $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('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), $compstring, "Correct Alert was shown"); diag("Trying 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'); @@ -169,7 +169,7 @@ $d->move_and_click('//*[@id="Invoice_table"]//tr[1]//td//a[contains(text(), "Del $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Invoice has been deleted"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Invoice successfully deleted", "Correct Alert was shown"); +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 was deleted'); @@ -195,7 +195,7 @@ $d->move_and_click('//*[@id="InvoiceTemplate_table"]//tr[1]//td//a[contains(text $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Invoice Template was deleted"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Invoice template successfully deleted", "Correct Alert was shown"); +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 was deleted'); diff --git a/t/selenium/controller_ncos.t b/t/selenium/controller_ncos.t index 61e1d6b965..90057d495a 100644 --- a/t/selenium/controller_ncos.t +++ b/t/selenium/controller_ncos.t @@ -44,7 +44,7 @@ $d->fill_element('//*[@id="prefix"]', 'xpath', $prefix); $d->find_element('//*[@id="save"]')->click(); diag("Search for LNP carrier"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "LNP carrier successfully created", "Correct Alert was shown"); +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); @@ -62,7 +62,7 @@ $d->fill_element('//*[@id="prefix"]', 'xpath', $prefix); $d->find_element('//*[@id="save"]')->click(); diag("Search for LNP carrier"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "LNP carrier successfully updated", "Correct Alert was shown"); +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); @@ -96,7 +96,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', "This is a simple descriptio $d->find_element('//*[@id="save"]')->click(); diag('Search for our new NCOS'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS level successfully created", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS level successfully created", "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); @@ -116,7 +116,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', "This is a very simple descr $d->find_element('//*[@id="save"]')->click(); diag('Search for NCOS'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS level successfully updated", "Correct Alert was shown"); +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); @@ -148,7 +148,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Austrian Premium Numbers'); $d->find_element('//*[@id="save"]')->click(); diag("Check pattern details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS pattern successfully created", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "^439")]'), "Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]/tbody/tr/td[contains(text(), "Austrian Premium Numbers")]'), "Description is correct"); @@ -159,7 +159,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'German Premium Numbers'); $d->find_element('//*[@id="save"]')->click(); diag("Check pattern details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS pattern successfully updated", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "^491")]'), "Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="number_pattern_table"]/tbody/tr/td[contains(text(), "German Premium Numbers")]'), "Description is correct"); @@ -176,7 +176,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Rule for LNP Carrier 1'); $d->find_element('//*[@id="save"]')->click(); diag("Check LNP details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS lnp entry successfully created", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "' . $lnpcarrier . '")]'), "LNP Carrier is correct"); ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]/tbody/tr/td[contains(text(), "Rule for LNP Carrier 1")]'), "Description is correct"); @@ -186,7 +186,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Rule for LNP Carrier 2'); $d->find_element('//*[@id="save"]')->click(); diag("Check LNP details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS lnp entry successfully updated", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "' . $lnpcarrier . '")]'), "LNP Carrier is correct"); ok($d->find_element_by_xpath('//*[@id="lnp_carriers_table"]/tbody/tr/td[contains(text(), "Rule for LNP Carrier 2")]'), "Description is correct"); @@ -196,7 +196,7 @@ $d->select_if_unselected('//*[@id="local_ac"]'); $d->find_element('//*[@id="save"]')->click(); diag("Check if NCOS settings have been applied"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS level setting successfully updated", "Correct Alert was shown"); +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"); @@ -221,7 +221,7 @@ $d->find_element('//*[@id="ncos"]/option[contains(text(), "' . $ncosname . '")]' $d->find_element('//*[@id="save"]')->click(); diag("Check if NCOS Level was applied"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference ncos successfully updated", "Correct Alert was shown"); +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 Level was applied'); diag('Go back to NCOS interface'); @@ -242,7 +242,7 @@ $d->move_and_click('//*[@id="number_pattern_table"]//tr//td//a[contains(text(), $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if NCOS Number pattern was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS pattern successfully deleted", "Correct Alert was shown"); +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 was deleted'); diag("Delete LNP Entry"); @@ -250,7 +250,7 @@ $d->move_and_click('//*[@id="lnp_carriers_table"]//tr//td//a[contains(text(), "D $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if LNP Entry was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS lnp entry successfully deleted", "Correct Alert was shown"); +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 was deleted'); diag("Go back to NCOS page"); @@ -275,7 +275,7 @@ $d->move_and_click('//*[@id="ncos_level_table"]/tbody/tr[1]/td/div/a[contains(te $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Entry was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "NCOS level successfully deleted", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "NCOS level successfully deleted", "Correct Alert was shown"); $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 was deleted'); @@ -302,7 +302,7 @@ $d->move_and_click('//*[@id="lnp_carriers_table"]//tr[1]//td//a[contains(text(), $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Entry was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "LNP carrier successfully deleted", "Correct Alert was shown"); +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'), 'Entry was deleted'); diff --git a/t/selenium/controller_other.t b/t/selenium/controller_other.t index da50b63356..8b83ffc960 100644 --- a/t/selenium/controller_other.t +++ b/t/selenium/controller_other.t @@ -45,7 +45,7 @@ $d->fill_element('//*[@id="label"]', 'xpath', 'label'); $d->find_element('//*[@id="save"]')->click(); diag('Search Call list suppression'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Call list suppression successfully created", "Correct Alert was shown"); +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); @@ -71,7 +71,7 @@ $d->fill_element('//*[@id="label"]', 'xpath', 'text'); $d->find_element('//*[@id="save"]')->click(); diag('Search Call list suppression'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Call list suppression successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Call list suppression successfully updated", "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); @@ -98,7 +98,7 @@ $d->move_and_click('//*[@id="call_list_suppression_table"]//tr[1]//td//a[contain $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Call list suppression was deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Call list suppression successfully deleted", "Correct Alert was shown"); +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'); @@ -127,7 +127,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '0123456789'); $d->find_element('//*[@id="save"]')->click(); diag('Search for Phonebook entry'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Phonebook entry successfully created", "Correct Alert was shown"); +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); @@ -146,7 +146,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '9876543210'); $d->find_element('//*[@id="save"]')->click(); diag('Search for Phonebook entry'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Phonebook entry successfully updated", "Correct Alert was shown"); +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); @@ -171,7 +171,7 @@ $d->move_and_click('//*[@id="phonebook_table"]//tr[1]//td//a[contains(text(), "D $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Phonebook entry has been deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Phonebook entry successfully deleted", "Correct Alert was shown"); +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'); @@ -201,7 +201,7 @@ $d->fill_element('//*[@id="email"]', 'xpath', $contactmail); $d->find_element('//*[@id="save"]')->click(); diag('Search Contact'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully created", "Correct Alert was shown"); +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); @@ -232,7 +232,7 @@ $d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains( $d->find_element('//*[@id="save"]')->click(); diag('Search Contact'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully changed", "Correct Alert was shown"); +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); @@ -259,7 +259,7 @@ $d->move_and_click('//*[@id="contact_table"]//tr[1]//td//a[contains(text(), "Del $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Contact was deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Contact successfully deleted", "Correct Alert was shown"); +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'); diff --git a/t/selenium/controller_peering.t b/t/selenium/controller_peering.t index 9732f9534a..05587d4414 100644 --- a/t/selenium/controller_peering.t +++ b/t/selenium/controller_peering.t @@ -54,7 +54,7 @@ $d->select_if_unselected('//table[@id="contractidtable"]/tbody/tr[1]//input[@typ $d->find_element('#save', 'css')->click(); diag("Search for the newly created Peering Group"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering group successfully created", "Correct Alert was shown"); +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); @@ -74,7 +74,7 @@ $d->find_element('//*[@id="priority"]/option[@value="1"]')->click(); $d->find_element('#save', 'css')->click(); diag("Search for the newly created Peering Group"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering group successfully updated", "Correct Alert was shown"); +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); @@ -95,12 +95,12 @@ $d->find_element('//a[contains(text(),"Create Outbound Peering Rule")]')->click( $d->find_element('#save', 'css')->click(); diag("Check if it was created"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering rule successfully created", "Correct Alert was shown"); +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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering rule successfully deleted", "Correct Alert was shown"); +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(); @@ -111,7 +111,7 @@ $d->fill_element('#description', 'css', 'for testing purposes'); $d->find_element('#save', 'css')->click(); diag("Check Outbound Peering Rule Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering rule successfully created", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "43")]'), "Prefix is correct"); ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]/tbody/tr/td[contains(text(), "^sip")]'), "Callee Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]/tbody/tr/td[contains(text(), "999")]'), "Caller Pattern is correct"); @@ -126,7 +126,7 @@ $d->fill_element('#description', 'css', 'for very testing purposes'); $d->find_element('#save', 'css')->click(); diag("Check Outbound Peering Rule Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering rule successfully changed", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "49")]'), "Prefix is correct"); ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]/tbody/tr/td[contains(text(), "^sup")]'), "Callee Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="PeeringRules_table"]/tbody/tr/td[contains(text(), "888")]'), "Caller Pattern is correct"); @@ -147,7 +147,7 @@ $d->fill_element('//*[@id="reject_reason"]', 'xpath', 'forbidden'); $d->find_element('#save', 'css')->click(); diag("Check Inbound Peering Rule Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Inbound peering rule successfully created", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "^sip")]'), "Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]/tbody/tr/td[contains(text(), "403")]'), "Reject Code is correct"); ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]/tbody/tr/td[contains(text(), "forbidden")]'), "Reject Reason is correct"); @@ -161,7 +161,7 @@ $d->fill_element('//*[@id="reject_reason"]', 'xpath', 'not found'); $d->find_element('#save', 'css')->click(); diag("Check Inbound Peering Rule Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Inbound peering rule successfully changed", "Correct Alert was shown"); +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"]/tbody/tr/td[contains(text(), "^sup")]'), "Pattern is correct"); ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]/tbody/tr/td[contains(text(), "404")]'), "Reject Code is correct"); ok($d->find_element_by_xpath('//*[@id="InboundPeeringRules_table"]/tbody/tr/td[contains(text(), "not found")]'), "Reject Reason is correct"); @@ -183,7 +183,7 @@ ok($d->find_text('Peering server successfully created'), 'Text "Peering server s my $server_rules_uri = $d->get_current_url(); diag("Check Peering Server Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering server successfully created", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Peering server successfully created", "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="peering_servers_table"]/tbody/tr/td[2]', $servername), "Name is correct"); ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]/tbody/tr/td[contains(text(), "10.0.0.100")]'), "IP is correct"); ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]/tbody/tr/td[contains(text(), "sipwise.com")]'), "Host is correct"); @@ -197,7 +197,7 @@ $d->fill_element('#host', 'css', 'google.at'); $d->find_element('#save', 'css')->click(); diag("Check Peering Server Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering server successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Peering server successfully updated", "Correct Alert was shown"); ok($d->wait_for_text('//*[@id="peering_servers_table"]/tbody/tr/td[2]', $servername), "Name is correct"); ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]/tbody/tr/td[contains(text(), "10.0.1.101")]'), "IP is correct"); ok($d->find_element_by_xpath('//*[@id="peering_servers_table"]/tbody/tr/td[contains(text(), "google.at")]'), "Host is correct"); @@ -218,7 +218,7 @@ $d->find_element('#save', 'css')->click(); diag('Check if value has been applied'); $d->find_element("Number Manipulations", 'link_text')->click(); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference inbound_upn successfully updated", "Correct Alert was shown"); +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"'); @@ -233,7 +233,7 @@ $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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference peer_auth_user successfully updated", "Correct Alert was shown"); +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(); ok($d->wait_for_text('//table/tbody/tr/td[contains(text(), "peer_auth_user")]/../td[4]', 'peeruser1'), 'peer_auth_user value has been set'); @@ -244,7 +244,7 @@ $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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference peer_auth_pass successfully updated", "Correct Alert was shown"); +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(); ok($d->wait_for_text('//table/tbody/tr/td[contains(text(), "peer_auth_pass")]/../td[4]', 'peerpass1'), 'peer_auth_pass value has been set'); @@ -255,7 +255,7 @@ $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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference peer_auth_realm successfully updated", "Correct Alert was shown"); +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(); 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'); @@ -268,7 +268,7 @@ ok($d->find_text("Are you sure?"), 'Delete dialog appears'); $d->find_element('#dataConfirmOK', 'css')->click(); diag("Check if Peering server was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering server successfully deleted", "Correct Alert was shown"); +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 was deleted'); @@ -282,7 +282,7 @@ ok($d->find_text("Are you sure?"), 'Delete dialog appears'); $d->find_element('#dataConfirmOK', 'css')->click(); diag("Check if Outbound peering rule was deleted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering rule successfully deleted", "Correct Alert was shown"); +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 was deleted'); diag("Delete the Inbound Peering Rule"); @@ -295,7 +295,7 @@ ok($d->find_text("Are you sure?"), 'Delete dialog appears'); $d->find_element('#dataConfirmOK', 'css')->click(); diag("Check if Inbound peering rule was delted"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Inbound peering rule successfully deleted", "Correct Alert was shown"); +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 was deleted'); diag('Go back to "SIP Peering Groups".'); @@ -320,7 +320,7 @@ ok($d->find_text("Are you sure?"), 'Delete dialog appears'); $d->find_element('#dataConfirmOK', 'css')->click(); diag('Checking if Testing Group has been deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Peering Group successfully deleted", "Correct Alert was shown"); +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'), 'Testing Group was deleted'); diff --git a/t/selenium/controller_profile.t b/t/selenium/controller_profile.t index 1e6a53a1c7..e17a2257ee 100644 --- a/t/selenium/controller_profile.t +++ b/t/selenium/controller_profile.t @@ -76,7 +76,7 @@ $d->fill_element('//*[@id="balance_interval.value"]', 'xpath', '300'); $d->find_element('//*[@id="save"]')->click(); diag('Search for Profile Package'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Profile package successfully created', "Correct Alert was shown"); +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); @@ -93,7 +93,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'nice desc'); $d->find_element('//*[@id="save"]')->click(); diag('Search for Profile Package'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Profile package successfully updated', "Correct Alert was shown"); +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); @@ -124,7 +124,7 @@ diag('Press "Save" without entering anything'); $d->find_element('//*[@id="save"]')->click(); diag('Check Values'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Account balance successfully changed!', "Correct Alert was shown"); +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->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"); @@ -138,7 +138,7 @@ $d->fill_element('//*[@id="free_time_balance"]', 'xpath', '50'); $d->find_element('//*[@id="save"]')->click(); diag('Check Values'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Account balance successfully changed!', "Correct Alert was shown"); +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->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"); @@ -164,7 +164,7 @@ $d->find_element('//*[@id="packageidtable"]/tbody/tr[1]/td[4]/input')->click(); $d->find_element('//*[@id="save"]')->click(); diag("Check Details"); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Top-up using cash performed successfully!', "Correct Alert was shown"); +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->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"); @@ -197,7 +197,7 @@ $d->move_and_click('//*[@id="packages_table"]//tr[1]//td//a[contains(text(), "De $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Profile Package was deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), 'Profile package successfully deleted', "Correct Alert was shown"); +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 was deleted'); diff --git a/t/selenium/controller_reseller.t b/t/selenium/controller_reseller.t index f3cdb6d6f6..ad23ff0ccc 100644 --- a/t/selenium/controller_reseller.t +++ b/t/selenium/controller_reseller.t @@ -39,7 +39,7 @@ $d->find_element('#mod_close', 'css')->click(); $c->create_reseller($resellername, $contractid); diag("Search our new reseller"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully created.", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully created.", "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); @@ -58,7 +58,7 @@ $d->find_element('//*[@id="status"]/option[@value="locked"]')->click(); $d->find_element('#save', 'css')->click(); diag("Search our new reseller"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully updated", "Correct Alert was shown"); +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); @@ -70,7 +70,7 @@ ok($d->find_element_by_xpath('//*[@id="Resellers_table"]//tr//td[contains(text() diag("Go to 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('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller is locked", "'Reseller is locked' message appears"); +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"); @@ -84,7 +84,7 @@ $d->find_element('//*[@id="status"]/option[@value="active"]')->click(); $d->find_element('#save', 'css')->click(); diag("Check Reseller Details"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully updated", "Correct Alert was shown"); +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); @@ -111,7 +111,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '0123456789'); $d->find_element('//*[@id="save"]')->click(); diag("Searching Phonebook entry"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Phonebook entry successfully created", "Correct Alert was shown"); +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->fill_element('//*[@id="phonebook_table_filter"]/label/input', 'xpath', 'thisshouldnotexist'); @@ -129,7 +129,7 @@ $d->fill_element('//*[@id="number"]', 'xpath', '0987654321'); $d->find_element('//*[@id="save"]')->click(); diag("Searching Phonebook entry"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Phonebook entry successfully updated", "Correct Alert was shown"); +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="reseller_details"]//div//div//a[contains(text(),"Phonebook")]')); $d->find_element('//*[@id="reseller_details"]//div//div//a[contains(text(),"Phonebook")]')->click(); $d->fill_element('//*[@id="phonebook_table_filter"]/label/input', 'xpath', 'thisshouldnotexist'); @@ -168,7 +168,7 @@ $d->fill_element('//*[@id="attachment_name"]', 'xpath', 'Random Character'); $d->find_element('//*[@id="save"]')->click(); diag('Searching new Template'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Email template successfully created", "Correct Alert was shown"); +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); @@ -190,7 +190,7 @@ $d->fill_element('//*[@id="attachment_name"]', 'xpath', '=)'); $d->find_element('//*[@id="save"]')->click(); diag('Searching new Template'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Email template successfully updated", "Correct Alert was shown"); +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); @@ -216,7 +216,7 @@ $d->move_and_click('//*[@id="email_template_table"]//tr[1]/td//a[contains(text() $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Template Email was deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Email template successfully deleted", "Correct Alert was shown"); +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'), 'Template was deleted'); @@ -229,7 +229,7 @@ ok($d->wait_for_text('//*[@id="contract_table"]/tbody/tr[1]/td[2]', $contractid) diag('Open delete dialog and press delete'); $c->delete_reseller_contract($contractid, 0); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Contract successfully terminated", "Correct Alert was shown"); +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 was deleted'); @@ -242,7 +242,7 @@ ok($d->wait_for_text('//*[@id="Resellers_table"]/tbody/tr[1]/td[3]', $resellerna diag('Open delete dialog and press delete'); $c->delete_reseller($resellername, 0); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Successfully terminated reseller", "Correct Alert was shown"); +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 was deleted'); @@ -255,7 +255,7 @@ if($d->find_element_by_xpath('//*[@id="reseller_details"]//div//a[contains(text( } $resellername = $d->get_text('//*[@id="Reseller_table"]/tbody/tr/td[2]'); my $temp = substr($resellername, 8); -is($d->get_text('//*[@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"); +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"); $d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click(); diag('Get Contract Number'); @@ -282,7 +282,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Contract successfully changed!", "Correct Alert was shown"); +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'); @@ -302,7 +302,7 @@ $d->find_element('//*[@id="status"]/option[@value="terminated"]')->click(); $d->find_element('//*[@id="save"]')->click(); diag("Check if Reseller was terminated"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Reseller successfully updated", "Correct Alert was shown"); +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 was deleted'); diff --git a/t/selenium/controller_rw_ruleset.t b/t/selenium/controller_rw_ruleset.t index 1389065a3a..969cdb66c4 100644 --- a/t/selenium/controller_rw_ruleset.t +++ b/t/selenium/controller_rw_ruleset.t @@ -41,7 +41,7 @@ $d->find_element('#mod_close', 'css')->click(); $c->create_rw_ruleset($rulesetname, $resellername); diag('Search for our new Rewrite Rule Set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully created", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully created", "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); @@ -59,7 +59,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'For very testing purposes') $d->find_element('//*[@id="save"]')->click(); diag('Search for our new Rewrite Rule Set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully updated", "Correct Alert was shown"); +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); @@ -100,7 +100,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", "Correct Alert was shown"); 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"); @@ -112,7 +112,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully updated", "Correct Alert was shown"); 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"); @@ -127,7 +127,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully created", "Correct Alert was shown"); 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"); @@ -139,7 +139,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully updated", "Correct Alert was shown"); 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"); @@ -161,7 +161,7 @@ ok($d->find_element_by_xpath('//*[@id="collapse_icaller"]/div/table/tbody/tr[1]/ 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="dataConfirmOK"]')->click(); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully deleted", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule successfully deleted", "Correct Alert was shown"); =cut diag('Go Back to the Rewrite Rule set Page'); $d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click(); @@ -179,7 +179,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Im a clone, beep boop'); $d->find_element('//*[@id="clone"]')->click(); diag('Search for the cloned Rewrite Rule Set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully cloned", "Correct Alert was shown"); +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); @@ -221,7 +221,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference rewrite_rule_set successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference rewrite_rule_set successfully updated", "Correct Alert was shown"); 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'); @@ -236,7 +236,7 @@ ok($d->wait_for_text('//*[@id="rewrite_rule_set_table"]/tbody/tr[1]/td[3]', $rul diag('Open delete dialog and press delete'); $c->delete_rw_ruleset($rulesetname, 0); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Rewrite rule set successfully deleted", "Correct Alert was shown"); +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'), 'Ruleset was deleted'); diff --git a/t/selenium/controller_soundset.t b/t/selenium/controller_soundset.t index 09f3235ce9..8bd1343c41 100644 --- a/t/selenium/controller_soundset.t +++ b/t/selenium/controller_soundset.t @@ -46,7 +46,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'nice desc'); $d->find_element('//*[@id="save"]')->click(); diag('Search Sound Set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully created", "Correct Alert was shown"); +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); @@ -64,7 +64,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'very nice desc'); $d->find_element('//*[@id="save"]')->click(); diag('Search Sound Set'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully updated", "Correct Alert was shown"); +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); @@ -84,7 +84,7 @@ $d->select_if_unselected('//*[@id="loopplay"]'); $d->find_element('//*[@id="save"]')->click(); diag('Check if loop setting was enabled'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound handle successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound handle successfully updated", "Correct Alert was shown"); 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'); @@ -92,7 +92,7 @@ $d->find_element('Load Default Files', 'link_text')->click(); $d->find_element('//*[@id="save"]')->click(); diag('Check in "conference" if settings are correct'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully loaded with default files.", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully loaded with default files.", "Correct Alert was shown"); 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'); @@ -104,7 +104,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully loaded with default files.", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully loaded with default files.", "Correct Alert was shown"); 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'); @@ -117,7 +117,7 @@ $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('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully loaded with default files.", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully loaded with default files.", "Correct Alert was shown"); 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'); @@ -143,7 +143,7 @@ $d->move_and_click('//*[@id="sound_set_table"]//tr[1]//td//a[contains(text(), "D $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Sound Set was deleted'); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Sound set successfully deleted", "Correct Alert was shown"); +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 was deleted'); diff --git a/t/selenium/controller_subscriber.t b/t/selenium/controller_subscriber.t index 1416990ccd..cb037a97bc 100644 --- a/t/selenium/controller_subscriber.t +++ b/t/selenium/controller_subscriber.t @@ -73,7 +73,7 @@ $d->find_element('//*[@id="password"]')->send_keys('testing1234'); #using normal $d->find_element('//*[@id="save"]')->click(); diag('Trying to find Subscriber'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber successfully created", "Correct Alert was shown"); +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'); @@ -114,7 +114,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'This is a description. It d $d->find_element('//*[@id="save"]')->click(); diag('Trying to find Subscriber profile set'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber profile set successfully created", "Correct Alert was shown"); +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); @@ -132,7 +132,7 @@ $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->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber profile set successfully updated", "Correct Alert was shown"); +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); @@ -161,7 +161,7 @@ $d->select_if_unselected('//*[@id="attribute.ncos"]'); $d->find_element('//*[@id="save"]')->click(); diag('Search for Profile'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber profile successfully created", "Correct Alert was shown"); +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); @@ -179,7 +179,7 @@ $d->fill_element('//*[@id="description"]', 'xpath', 'Very very useful descriptio $d->find_element('//*[@id="save"]')->click(); diag('Search for Profile'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber profile successfully updated", "Correct Alert was shown"); +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); @@ -217,7 +217,7 @@ $d->select_if_unselected('//*[@id="profile_setidtable"]/tbody/tr/td[5]'); $d->find_element('//*[@id="save"]')->click(); diag('Check if change was applied'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Successfully updated subscriber", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Successfully updated subscriber", "Correct Alert was shown"); $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'); @@ -236,7 +236,7 @@ $d->find_element('//*[@id="status"]/option[contains(text(), "locked")]')->click( $d->find_element('//*[@id="save"]')->click(); diag('Check if subscriber got locked'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Successfully updated subscriber", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Successfully updated subscriber", "Correct Alert was shown"); #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"); @@ -250,7 +250,7 @@ $d->find_element('//*[@id="status"]/option[contains(text(), "active")]')->click( $d->find_element('//*[@id="save"]')->click(); diag('Check if subscriber got unlocked'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Successfully updated subscriber", "Correct Alert was shown"); +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'); @@ -267,7 +267,7 @@ $d->find_element('//*[@id="language"]/option[contains(text(), "German")]')->clic $d->find_element('//*[@id="save"]')->click(); diag('Check if language has been applied'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference language successfully updated", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Preference language successfully updated", "Correct Alert was shown"); $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'); @@ -282,7 +282,7 @@ $d->select_if_unselected('//*[@id="record_call"]'); $d->find_element('//*[@id="save"]')->click(); diag('Check if call recording was enabled'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference record_call successfully updated", "Correct Alert was shown"); +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('Trying to add a simple call forward'); @@ -346,7 +346,7 @@ diag('Save'); $d->find_element('//*[@id="cf_actions.save"]')->click(); diag('Check if call-forward has been applied'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Successfully saved Call Forward", "Correct Alert was shown"); +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"]/tbody/tr[1]/td[contains(text(), ' . $bsetname . ')]'), 'B-Set was selected'); ok($d->find_element_by_xpath('//*[@id="preferences_table_cf"]/tbody/tr[1]/td[contains(text(), ' . $destinationname . ')]'), 'Destination set was selected'); @@ -361,7 +361,7 @@ $d->find_element('//*[@id="save"]')->click(); diag('Check if value was set'); $d->scroll_to_element($d->find_element("Call Blockings", 'link_text')); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference block_in_mode successfully updated", "Correct Alert was shown"); +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'); @@ -392,7 +392,7 @@ $d->find_element('//*[@id="block_in_clir"]')->click(); $d->find_element('//*[@id="save"]')->click(); diag('Check if value was set'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Preference block_in_clir successfully updated", "Correct Alert was shown"); +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'); @@ -418,7 +418,7 @@ $d->move_and_click('//*[@id="subscriber_table"]/tbody/tr[1]/td/div/a[contains(te $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Subscriber has been deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Successfully terminated subscriber", "Correct Alert was shown"); +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'), 'Table is empty'); $d->find_element('//*[@id="content"]//div//a[contains(text(), "Back")]')->click(); @@ -446,7 +446,7 @@ $d->move_and_click('//*[@id="subscriber_profile_sets_table"]/tbody/tr[1]/td/div/ $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag('Check if Subscriber Profile Set has been deleted'); -is($d->find_element_by_xpath('//*[@id="content"]//div[contains(@class, "alert")]')->get_text(), "Subscriber profile set successfully deleted", "Correct Alert was shown"); +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'), 'Table is empty'); diff --git a/t/selenium/controller_timeset.t b/t/selenium/controller_timeset.t index 1bcaf57123..afefa9d10a 100644 --- a/t/selenium/controller_timeset.t +++ b/t/selenium/controller_timeset.t @@ -46,7 +46,7 @@ $d->fill_element('//*[@id="name"]', 'xpath', $timesetname); $d->find_element('//*[@id="save"]')->click(); diag("Search for our new Timeset"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Timeset entry successfully created", "Correct Alert was shown"); +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); @@ -62,7 +62,7 @@ $d->fill_element('//*[@id="name"]', 'xpath', $timesetname); $d->find_element('//*[@id="save"]')->click(); diag("Search for our new Timeset"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Timeset entry successfully updated", "Correct Alert was shown"); +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); @@ -100,7 +100,7 @@ $d->select_if_unselected('//*[@id="byday.weekdays.0"]'); $d->find_element('//*[@id="save"]')->click(); diag("Search for new Event"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Event entry successfully created", "Correct Alert was shown"); +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 =)'); @@ -119,7 +119,7 @@ $d->fill_element('//*[@id="endtime_datetimepicker"]', 'xpath', '13:00:00'); $d->find_element('//*[@id="save"]')->click(); diag("Search for Event"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Event entry successfully created", "Correct Alert was shown"); +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'); @@ -149,7 +149,7 @@ $d->select_if_unselected('//*[@id="time_setidtable"]/tbody/tr[1]/td[4]/input'); $d->find_element('//*[@id="save"]')->click(); diag("Search for Peering Group"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Peering group successfully created", "Correct Alert was shown"); +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); @@ -163,7 +163,7 @@ ok($d->wait_for_text('//*[@id="sip_peering_group_table"]/tbody/tr/td[6]', $times 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('//*[@id="content"]//div[contains(@class, "alert")]'), "Peering Group successfully deleted", "Correct Alert was shown"); +is($d->get_text_safe('//*[@id="content"]//div[contains(@class, "alert")]'), "Peering Group successfully deleted", "Correct Alert was shown"); diag("Go back to Time set page"); $d->find_element('//*[@id="main-nav"]//*[contains(text(),"Settings")]')->click(); @@ -188,7 +188,7 @@ $d->move_and_click('//*[@id="timeset_table"]//tr[1]/td//a[contains(text(), "Dele $d->find_element('//*[@id="dataConfirmOK"]')->click(); diag("Check if Time set was deleted"); -is($d->get_text('//*[@id="content"]//div[contains(@class, "alert")]'), "Timeset entry successfully deleted", "Correct Alert was shown"); +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');