@ -43,4 +43,51 @@ sub delete_domain {
$ self - > driver - > find_element ( '//*[@id="Domain_table"]/tbody/tr[1]/td[4]/div/a[1]' ) - > click ( ) ;
$ self - > driver - > find_element ( '//*[@id="dataConfirmOK"]' ) - > click ( ) ;
}
sub create_reseller {
my ( $ self , $ name , $ resellerid ) = @ _ ;
return unless $ name && $ resellerid ;
diag ( 'Go to reseller page' ) ;
$ self - > driver - > find_element ( '//*[@id="main-nav"]//*[contains(text(),"Settings")]' ) - > click ( ) ;
$ self - > driver - > find_element ( 'Resellers' , 'link_text' ) - > click ( ) ;
diag ( 'Try to create a reseller' ) ;
$ self - > driver - > find_element ( 'Create Reseller' , 'link_text' ) - > click ( ) ;
$ self - > driver - > fill_element ( '//*[@id="contractidtable_filter"]/label/input' , 'xpath' , 'thisshouldnotexist' ) ;
ok ( $ self - > driver - > find_element_by_css ( '#contractidtable tr > td.dataTables_empty' , 'css' ) , 'Garbage text was not found' ) ;
$ self - > driver - > fill_element ( '//*[@id="contractidtable_filter"]/label/input' , 'xpath' , $ resellerid ) ;
ok ( $ self - > driver - > wait_for_text ( '//*[@id="contractidtable"]/tbody/tr/td[3]' , $ resellerid ) , "Default Contact found" ) ;
$ 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 ( ) ;
}
sub create_reseller_contract {
my ( $ self , $ resellerid ) = @ _ ;
return unless $ resellerid ;
diag ( 'Go to Reseller and Peering Contracts page' ) ;
$ self - > driver - > find_element ( '//*[@id="main-nav"]//*[contains(text(),"Settings")]' ) - > click ( ) ;
$ self - > driver - > find_element ( 'Reseller and Peering Contracts' , 'link_text' ) - > click ( ) ;
diag ( 'Try to create a reseller contract' ) ;
$ self - > driver - > find_element ( 'Create Reseller Contract' , 'link_text' ) - > click ( ) ;
if ( ! $ self - > driver - > find_element ( '//*[@id="contactidtable"]/tbody/tr[1]/td[4]' ) - > get_text ( ) eq 'default-system@default.invalid' ) {
$ self - > driver - > fill_element ( '//*[@id="contactidtable_filter"]/label/input' , 'xpath' , 'default-system@default.invalid' ) ;
ok ( $ self - > driver - > wait_for_text ( '//*[@id="contactidtable"]/tbody/tr[1]/td[4]' , 'default-system@default.invalid' ) , "Default Contact found" ) ;
$ self - > driver - > select_if_unselected ( '//*[@id="contactidtable"]/tbody/tr[1]/td[5]/input' ) ;
}
else {
ok ( $ self - > driver - > select_if_unselected ( '//*[@id="contactidtable"]/tbody/tr[1]/td[5]/input' ) , "Default Contact found" ) ;
} ;
$ self - > driver - > scroll_to_element ( $ self - > driver - > find_element ( '//*[@id="external_id"]' ) ) ;
$ self - > driver - > fill_element ( '//*[@id="billing_profileidtable_filter"]/label/input' , 'xpath' , 'thisshouldnotexist' ) ;
ok ( $ self - > driver - > find_element_by_css ( '#billing_profileidtable tr > td.dataTables_empty' , 'css' ) , 'Garbage text was not found' ) ;
$ self - > driver - > fill_element ( '//*[@id="billing_profileidtable_filter"]/label/input' , 'xpath' , 'Default Billing Profile' ) ;
ok ( $ self - > driver - > wait_for_text ( '//*[@id="billing_profileidtable"]/tbody/tr/td[3]' , 'Default Billing Profile' ) , "Default Billing Profile found" ) ;
$ self - > driver - > select_if_unselected ( '//*[@id="billing_profileidtable"]/tbody/tr[1]/td[4]/input' ) ;
$ self - > driver - > fill_element ( '//*[@id="external_id"]' , 'xpath' , $ resellerid ) ;
$ self - > driver - > find_element ( '//*[@id="save"]' ) - > click ( ) ;
}
1 ;