get_text_safe is mainly used to retrieve text from elements that like to
randomly dissapear. in the case of dissapearing, it wont crash the entire
script, instead it will only mark current test as failed.
added function call everywhere where it was needed
Change-Id: I82c00b135ec91e3ad5f003e0a1b9f677b5776b1a
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");
}
subdelete_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");
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
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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('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");
$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");
$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");
$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");
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');
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('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');
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');
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');
@ -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
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");
@ -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");
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");
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");
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");
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');
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');
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");