@ -29,12 +29,8 @@ if(!$pbx){
} ;
} ;
my $ customerid = ( "id" . int ( rand ( 100000 ) ) . "ok" ) ;
my $ customerid = ( "id" . int ( rand ( 100000 ) ) . "ok" ) ;
my $ domainstring = ( "domain" . int ( rand ( 100000 ) ) . ".example.org" ) ;
my $ emailstring = ( "test" . int ( rand ( 10000 ) ) . "\@example.org" ) ;
my $ username = ( 'demo' . int ( rand ( 1000 ) ) . "name" ) ;
$ c - > login_ok ( ) ;
$ c - > login_ok ( ) ;
$ c - > create_domain ( $ domainstring ) ;
if ( $ pbx == 1 ) {
if ( $ pbx == 1 ) {
$ c - > create_customer ( $ customerid , 1 ) ;
$ c - > create_customer ( $ customerid , 1 ) ;
@ -42,11 +38,19 @@ if($pbx == 1){
$ c - > create_customer ( $ customerid ) ;
$ c - > create_customer ( $ customerid ) ;
}
}
diag ( " Open Details for our just created Customer") ;
diag ( " Search for Customer") ;
$ d - > fill_element ( '#Customer_table_filter input' , 'css' , 'thisshouldnotexist' ) ;
$ 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' ) ;
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 ) ;
$ d - > fill_element ( '#Customer_table_filter input' , 'css' , $ customerid ) ;
ok ( $ d - > wait_for_text ( '//*[@id="Customer_table"]/tbody/tr[1]/td[2]' , $ customerid ) , 'Customer found' ) ;
ok ( $ d - > wait_for_text ( '//*[@id="Customer_table"]/tbody/tr[1]/td[2]' , $ customerid ) , 'Customer found' ) ;
diag ( "Check customer details" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "' . $ customerid . '")]' ) , 'Customer ID is correct' ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "default")]' ) , 'Reseller is correct' ) ;
ok ( $ d - > wait_for_text ( '//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "default-customer")]' , 'default-customer@default.invalid' ) , 'Contact Email is correct' ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="Customer_table"]/tbody/tr[1]/td[contains(text(), "Default Billing Profile")]' ) , 'Billing Profile is correct' ) ;
diag ( "Open Details for our just created Customer" ) ;
$ d - > move_action ( element = > $ d - > find_element ( '//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]' ) ) ;
$ d - > move_action ( element = > $ d - > find_element ( '//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]' ) ) ;
$ d - > find_element ( '//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="Customer_table"]/tbody/tr[1]//td//div//a[contains(text(),"Details")]' ) - > click ( ) ;
@ -56,6 +60,9 @@ $d->find_element('//div[contains(@class,"accordion-body")]//*[contains(@class,"b
$ d - > fill_element ( 'div.modal #firstname' , 'css' , "Alice" ) ;
$ d - > fill_element ( 'div.modal #firstname' , 'css' , "Alice" ) ;
$ d - > fill_element ( '#company' , 'css' , 'Sipwise' ) ;
$ d - > fill_element ( '#company' , 'css' , 'Sipwise' ) ;
ok ( $ d , 'Inserting name works' ) ;
ok ( $ d , 'Inserting name works' ) ;
$ d - > fill_element ( '#street' , 'css' , 'Frunze Square' ) ;
$ d - > fill_element ( '#postcode' , 'css' , '03141' ) ;
$ d - > fill_element ( '#city' , 'css' , 'Kiew' ) ;
$ d - > fill_element ( '#countryidtable_filter input' , 'css' , 'thisshouldnotexist' ) ;
$ d - > fill_element ( '#countryidtable_filter input' , 'css' , 'thisshouldnotexist' ) ;
$ d - > find_element ( '#countryidtable tr > td.dataTables_empty' , 'css' ) ;
$ d - > find_element ( '#countryidtable tr > td.dataTables_empty' , 'css' ) ;
$ d - > fill_element ( '#countryidtable_filter input' , 'css' , 'Ukraine' ) ; # Choosing Country
$ d - > fill_element ( '#countryidtable_filter input' , 'css' , 'Ukraine' ) ; # Choosing Country
@ -63,35 +70,44 @@ $d->select_if_unselected('//table[@id="countryidtable"]/tbody/tr[1]/td[contains(
ok ( $ d , 'Successfuly added a Country' ) ;
ok ( $ d , 'Successfuly added a Country' ) ;
$ d - > find_element ( '#save' , 'css' ) - > click ( ) ; # Save
$ d - > find_element ( '#save' , 'css' ) - > click ( ) ; # Save
diag ( "Check if successful" ) ;
diag ( "Check contact details" ) ;
$ d - > find_element ( '//div[contains(@class,"accordion-body")]//table//td[contains(text(),"Sipwise")]' ) ;
ok ( $ d - > wait_for_text ( '//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Email")]/../td[2]' , 'default-customer@default.invalid' ) , "Email is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Name")]/../td[contains(text(), "Alice")]' ) , "Name is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Company")]/../td[contains(text(), "Sipwise")]' ) , "Company is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Address")]/../td[text()[contains(.,"03141")]]' ) , "Postal code is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Address")]/../td[text()[contains(.,"Kiew")]]' ) , "City is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="collapse_contact"]//table//tr//td[contains(text(), "Address")]/../td[text()[contains(.,"Frunze Square")]]' ) , "Street is correct" ) ;
diag ( "Edit Fraud Limits" ) ;
diag ( "Edit Fraud Limits" ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]' ) - > click ( ) ;
$ d - > scroll_to_element ( $ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]' ) ) ;
$ d - > scroll_to_element ( $ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Fraud Limits")]' ) ) ;
$ d - > move_and_click ( '//*[@id="collapse_fraud"]//table//tr//td[text()[contains(.,"Monthly Settings")]]/../td//a[text()[contains(.,"Edit")]]' , 'xpath' ) ;
$ d - > move_and_click ( '//*[@id="collapse_fraud"]//table//tr//td[text()[contains(.,"Monthly Settings")]]/../td//a[text()[contains(.,"Edit")]]' , 'xpath' ) ;
diag ( "Do Edit Fraud Limits" ) ;
$ d - > fill_element ( '#fraud_interval_limit' , 'css' , "100" ) ;
$ d - > fill_element ( '#fraud_interval_limit' , 'css' , "100" ) ;
$ d - > fill_element ( '#fraud_interval_notify' , 'css' , 'mymail@example.org' ) ;
$ d - > fill_element ( '#fraud_interval_notify' , 'css' , 'mymail@example.org' ) ;
$ d - > find_element ( '#save' , 'css' ) - > click ( ) ;
$ d - > find_element ( '#save' , 'css' ) - > click ( ) ;
$ d - > find_element ( '//div[contains(@class,"accordion-body")]//table//td[contains(text(),"mymail@example.org")]' ) ;
diag ( "Check Fraud Limit details" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="collapse_fraud"]//table//tr//td[contains(text(), "Monthly Settings")]/../td[contains(text(), "100")]' ) , "Limit is correct" ) ;
ok ( $ d - > wait_for_text ( '//*[@id="collapse_fraud"]//table//tr//td[contains(text(), "Monthly Settings")]/../td[4]' , 'mymail@example.org' ) , "Mail is correct" ) ;
diag ( "Create a new Phonebook entry" ) ;
diag ( "Create a new Phonebook entry" ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) - > click ( ) ;
$ d - > scroll_to_element ( $ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) ) ;
$ d - > scroll_to_element ( $ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) ) ;
$ d - > find_element ( "Create Phonebook Entry" , 'link_text' ) - > click ( ) ;
$ d - > find_element ( "Create Phonebook Entry" , 'link_text' ) - > click ( ) ;
$ d - > fill_element ( '//*[@id="name"]' , 'xpath' , 'Test Nam e') ;
$ d - > fill_element ( '//*[@id="name"]' , 'xpath' , 'Test er ') ;
$ d - > fill_element ( '//*[@id="number"]' , 'xpath' , '0123456789' ) ;
$ d - > fill_element ( '//*[@id="number"]' , 'xpath' , '0123456789' ) ;
$ d - > find_element ( '//*[@id="save"]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="save"]' ) - > click ( ) ;
diag ( " Check if Phonebook Entry has been created ") ;
diag ( " Search for Phonebook Entry ") ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) - > click ( ) ;
$ d - > scroll_to_element ( $ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) ) ;
$ d - > scroll_to_element ( $ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(),"Phonebook")]' ) ) ;
$ d - > fill_element ( '//*[@id="phonebook_table_filter"]/label/input' , 'xpath' , 'thisshouldnotexist' ) ;
$ 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' ) ;
ok ( $ d - > find_element_by_css ( '#phonebook_table tr > td.dataTables_empty' , 'css' ) , 'Garbage text was not found' ) ;
$ d - > fill_element ( '//*[@id="phonebook_table_filter"]/label/input' , 'xpath' , '0123456789' ) ;
$ d - > fill_element ( '//*[@id="phonebook_table_filter"]/label/input' , 'xpath' , 'Tester' ) ;
ok ( $ d - > wait_for_text ( '//*[@id="phonebook_table"]/tbody/tr/td[3]' , '0123456789' ) , 'Entry has been found' ) ;
diag ( "Check Phonebook entry details" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="phonebook_table"]/tbody/tr[1]/td[contains(text(), "Tester")]' ) , "Name is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="phonebook_table"]/tbody/tr[1]/td[contains(text(), "0123456789")]' ) , "Number is correct" ) ;
diag ( "Create a new Location" ) ;
diag ( "Create a new Location" ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(), "Locations")]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//a[contains(text(), "Locations")]' ) - > click ( ) ;
@ -105,12 +121,16 @@ $d->fill_element('//*[@id="blocks.0.row.ip"]', 'xpath', '127.0.0.1');
$ d - > fill_element ( '//*[@id="blocks.0.row.mask"]' , 'xpath' , '16' ) ;
$ d - > fill_element ( '//*[@id="blocks.0.row.mask"]' , 'xpath' , '16' ) ;
$ d - > find_element ( '//*[@id="save"]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="save"]' ) - > click ( ) ;
diag ( " Check if Location has been created ") ;
diag ( " Search for Location ") ;
$ d - > find_element ( '//*[@id="customer_details"]//div//div//a[contains(text(),"Locations")]' ) - > click ( ) ;
$ d - > find_element ( '//*[@id="customer_details"]//div//div//a[contains(text(),"Locations")]' ) - > click ( ) ;
$ d - > fill_element ( '//*[@id="locations_table_filter"]/label/input' , 'xpath' , 'thisshouldnotexist' ) ;
$ d - > fill_element ( '//*[@id="locations_table_filter"]/label/input' , 'xpath' , 'thisshouldnotexist' ) ;
ok ( $ d - > find_element_by_css ( '#locations_table tr > td.dataTables_empty' , 'css' ) , 'Garbage text was not found' ) ;
ok ( $ d - > find_element_by_css ( '#locations_table tr > td.dataTables_empty' , 'css' ) , 'Garbage text was not found' ) ;
$ d - > fill_element ( '//*[@id="locations_table_filter"]/label/input' , 'xpath' , 'Test Location' ) ;
$ d - > fill_element ( '//*[@id="locations_table_filter"]/label/input' , 'xpath' , 'Test Location' ) ;
ok ( $ d - > wait_for_text ( '//*[@id="locations_table"]/tbody/tr/td[2]' , 'Test Location' ) , "Location has been found" ) ;
diag ( "Check location details" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="locations_table"]/tbody/tr[1]/td[contains(text(), "Test Location")]' ) , "Name is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="locations_table"]/tbody/tr[1]/td[contains(text(), "This is a Test Location")]' ) , "Description is correct" ) ;
ok ( $ d - > find_element_by_xpath ( '//*[@id="locations_table"]/tbody/tr[1]/td[contains(text(), "127.0.0.1/16")]' ) , "Network block is correct" ) ;
diag ( "Open delete dialog and press cancel" ) ;
diag ( "Open delete dialog and press cancel" ) ;
$ c - > delete_customer ( $ customerid , 1 ) ;
$ c - > delete_customer ( $ customerid , 1 ) ;
@ -122,7 +142,5 @@ $c->delete_customer($customerid, 0);
$ d - > fill_element ( '//*[@id="Customer_table_filter"]/label/input' , 'xpath' , $ customerid ) ;
$ 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' ) ;
ok ( $ d - > find_element_by_css ( '#Customer_table tr > td.dataTables_empty' , 'css' ) , 'Customer was deleted' ) ;
$ c - > delete_domain ( $ domainstring ) ;
done_testing ;
done_testing ;
# vim: filetype=perl
# vim: filetype=perl