def test_02_create_a_pool(browser): time.sleep(1) # Click create new pool option browser.find_element_by_xpath(xpaths['addAction']).click() # wait on the page to load wait = wait_on_element(browser, xpaths['forwardButton']) assert wait, f'Loading pool page timeout' # Click create Pool Button browser.find_element_by_xpath(xpaths['forwardButton']).click() # wait on the page to load wait = wait_on_element(browser, xpaths['newpoolName']) assert wait, f'Loading pool page timeout' # Enter User Full name browser.find_element_by_xpath(xpaths['newpoolName']).send_keys(pool1) # Select the disk browser.find_element_by_xpath(xpaths['disk1Checkbox']).click() # Select the disk browser.find_element_by_xpath(xpaths['diskselectedmoveButton']).click() # Click on create new Pool button browser.find_element_by_xpath(xpaths['createButton']).click() # checkbox confirmation browser.find_element_by_xpath(xpaths['confirmCheckbox']).click() # Click Ok Button browser.find_element_by_xpath(xpaths['createpoolButton']).click() xpath = xpaths['addAction'] wait = wait_on_element(browser, xpath) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(browser, script_name, test_name) assert wait, f'Creating the new pool {pool1} timeout' no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_04_create_superuser(browser): test_name = sys._getframe().f_code.co_name browser.find_element_by_tag_name('html').send_keys(Keys.END) # Click create new user option browser.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name browser.find_element_by_xpath(xpaths['newUserName']).send_keys(superuserfn) # clear user name and enter new Username browser.find_element_by_xpath(xpaths['newUser']).clear() browser.find_element_by_xpath(xpaths['newUser']).send_keys(superuser) # Enter Password browser.find_element_by_xpath( xpaths['newUserPass']).send_keys(superuserpassword) # Enter Password Conf browser.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(superuserpassword) # check Permit Sudo Checkbox browser.find_element_by_xpath(xpaths['permitSudocheckbox']).click() # Click on create new User button assert is_element_present(browser, xpaths['saveButton']) is True browser.find_element_by_xpath(xpaths['saveButton']).click() # wait on the fabAction xpath = xpaths['fabAction'] wait = wait_on_element(browser, xpath, script_name, test_name) assert wait, f'Loading Users page timeout' # taking screenshot take_screenshot(browser, script_name, test_name) # check if there is a generic error when making a duplicate user, and print the error no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_02_create_newuser(browser): test_name = sys._getframe().f_code.co_name # Click create new user option browser.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name browser.find_element_by_xpath(xpaths['newUserName']).send_keys(newuserfn) # clear user name and enter new Username browser.find_element_by_xpath(xpaths['newUser']).clear() browser.find_element_by_xpath(xpaths['newUser']).send_keys(newuser) # Enter User email id browser.find_element_by_xpath( xpaths['newUserEmail']).send_keys(newuseremail) # Enter Password browser.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf browser.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button assert is_element_present(browser, xpaths['saveButton']) is True print("found the save button") browser.find_element_by_xpath(xpaths['saveButton']).click() # wait on the fabAction xpath = xpaths['fabAction'] wait = wait_on_element(browser, xpath, script_name, test_name) assert wait, f'Loading Users page timeout' # taking screenshot take_screenshot(browser, script_name, test_name) no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_06_create_newuser_suggested_name(browser): # Click create new user option browser.find_element_by_xpath(xpaths['fabAction']).click() # wait on the page to load wait = wait_on_element(browser, xpaths['newUserName']) assert wait, f'Loading Users Add page timeout' # Enter User Full name browser.find_element_by_xpath(xpaths['newUserName']).send_keys(nouserfn) browser.find_element_by_xpath( xpaths['newUserEmail']).send_keys(newuseremail) # Enter Password browser.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf browser.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button assert is_element_present(browser, xpaths['saveButton']) is True browser.find_element_by_xpath(xpaths['saveButton']).click() # wait on the fabAction wait = wait_on_element(browser, xpaths['fabAction']) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(browser, script_name, test_name) assert wait, f'Loading Users page timeout' no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_03_create_newuser_primarygroup_uncheck(browser): # Click create new user option browser.find_element_by_xpath(xpaths['fabAction']).click() # wait on the page to load wait = wait_on_element(browser, xpaths['newUserName']) assert wait, f'Loading Users Add page timeout' # Enter User Full name browser.find_element_by_xpath( xpaths['newUserName']).send_keys(uncheckuserfn) # clear user name and enter new Username browser.find_element_by_xpath(xpaths['newUser']).clear() browser.find_element_by_xpath(xpaths['newUser']).send_keys(uncheckuser) # Enter Password browser.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf browser.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button assert is_element_present(browser, xpaths['saveButton']) is True browser.find_element_by_xpath(xpaths['saveButton']).click() # wait on the fabAction wait = wait_on_element(browser, xpaths['fabAction']) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(browser, script_name, test_name) assert wait, f'Loading Users page timeout' # check if there is a generic error when making a duplicate user, and print the error no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_06_create_newuser_suggestedname(wb_driver): print(" creating a new user with suggested name") # Click User sub-menu wb_driver.find_element_by_xpath(xpaths['submenuUser']).click() # scroll down to find hover tab wb_driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option wb_driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name wb_driver.find_element_by_xpath( xpaths['newUserName']).send_keys(newuserfname) wb_driver.find_element_by_xpath( xpaths['newUserEmail']).send_keys(newuseremail) # Enter Password wb_driver.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf wb_driver.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button if wb_driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") wb_driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") time.sleep(1) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback'] time.sleep(2)
def test_04_create_newpool2(wb_driver): test_name = sys._getframe().f_code.co_name time.sleep(1) # Click create new pool option wb_driver.find_element_by_xpath(xpaths['addAction']).click() # Click create Pool Button wb_driver.find_element_by_xpath(xpaths['forwardButton']).click() # Enter User Full name wb_driver.find_element_by_xpath(xpaths['newpoolName']).send_keys(pool2) # Select the 2 disks wb_driver.find_element_by_xpath(xpaths['disk2Checkbox']).click() wb_driver.find_element_by_xpath(xpaths['disk3Checkbox']).click() # Select the disk wb_driver.find_element_by_xpath(xpaths['diskselectedmoveButton']).click() # Click on create new Pool button wb_driver.find_element_by_xpath(xpaths['createButton']).click() # check box confirmation wb_driver.find_element_by_xpath(xpaths['confirmCheckbox']).click() # Click OK Button wb_driver.find_element_by_xpath(xpaths['createpoolButton']).click() xpath = xpaths['addAction'] wait = wait_on_element(wb_driver, xpath, script_name, test_name) assert wait, f'Creating the new pool {pool2} timeout' # taking screenshot take_screenshot(wb_driver, script_name, test_name) no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback']
def test_03_edit_userNAS_sudo(wb_driver): # Changing permission to sudo user_edit(wb_driver, "user", newusername) wb_driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(5) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback']
def test_05_edit_groupNAS_sudo(wb_driver): time.sleep(2) user_edit(wb_driver, "group", newgroupname) wb_driver.find_element_by_xpath(xpaths['group']).click() wb_driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(5) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback']
def test_04_edit_usernas_permit_sudo(browser): assert is_element_present(browser, xpaths['newuserUserMenu']) browser.find_element_by_xpath(xpaths['newuserUserMenu']).click() assert is_element_present(browser, xpaths['newuserUserEdit']) browser.find_element_by_xpath(xpaths['newuserUserEdit']).click() browser.find_element_by_xpath(xpaths['permitSudo']).click() # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(browser, script_name, test_name) # click save browser.find_element_by_xpath('//*[@id="save_button"]').click() no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_02_edit_userNAS_email(wb_driver): time.sleep(2) # call edit funtion on the userNAS user_edit(wb_driver, "user", newusername) # get the ui element ui_email = wb_driver.find_element_by_xpath(xpaths['email']) ui_email.clear() ui_email.send_keys("*****@*****.**") # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) time.sleep(2) no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback']
def test_02_edit_usernas_email(browser): assert is_element_present(browser, xpaths['newuserUserMenu']) browser.find_element_by_xpath(xpaths['newuserUserMenu']).click() assert is_element_present(browser, xpaths['newuserUserEdit']) browser.find_element_by_xpath(xpaths['newuserUserEdit']).click() ui_email = browser.find_element_by_xpath(xpaths['email']) ui_email.clear() ui_email.send_keys("*****@*****.**") # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(browser, script_name, test_name) # click save browser.find_element_by_xpath('//*[@id="save_button"]').click() no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_02_create_newgroup(browser): test_name = sys._getframe().f_code.co_name # Click create new group option browser.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname browser.find_element_by_xpath(xpaths['newGroupName']).send_keys(newgroup) # Click on save new Group button browser.find_element_by_xpath(xpaths['saveButton']).click() # wait on the fabAction xpath = xpaths['fabAction'] wait = wait_on_element(browser, xpath, script_name, test_name) assert wait, f'Loading Users page timeout' # taking screenshot take_screenshot(browser, script_name, test_name) no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_03_create_supergroup(browser): # Click create new group option browser.find_element_by_xpath(xpaths['fabAction']).click() # wait on the page to load wait = wait_on_element(browser, xpaths['newGroupName']) assert wait, f'Loading Groups Add page timeout' # Enter New Groupname browser.find_element_by_xpath(xpaths['newGroupName']).send_keys(supergroup) # Check Permit sudo checkbox browser.find_element_by_xpath(xpaths['permitsudoCheckbox']).click() # Click on save new Group button browser.find_element_by_xpath(xpaths['saveButton']).click() # wait on the fabAction xpath = xpaths['fabAction'] wait = wait_on_element(browser, xpath) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(browser, script_name, test_name) assert wait, f'Loading Users page timeout' no_error = error_check(browser) assert no_error['result'], no_error['traceback']
def test_02_create_newgroup(wb_driver): # scroll down to find hover tab wb_driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new group option wb_driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname time.sleep(1) wb_driver.find_element_by_xpath( xpaths['newGroupName']).send_keys(newgroupname) time.sleep(1) # Click on save new Group button wb_driver.find_element_by_xpath(xpaths['saveButton']).click() time.sleep(1) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) # check if there is a generic error when making a duplicate group, and print the error no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback'] time.sleep(2)
def test_04_create_superuser(wb_driver): print(" creating a super user with root access") time.sleep(2) # Click User sub menu wb_driver.find_element_by_xpath(xpaths['submenuUser']).click() # scroll down to find hover tab wb_driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option wb_driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name wb_driver.find_element_by_xpath( xpaths['newUserName']).send_keys(superuserfname) # clear user name and enter new Username wb_driver.find_element_by_xpath(xpaths['newUser']).clear() wb_driver.find_element_by_xpath(xpaths['newUser']).send_keys(superusername) # Enter Password wb_driver.find_element_by_xpath( xpaths['newUserPass']).send_keys(superuserpassword) # Enter Password Conf wb_driver.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(superuserpassword) # check Permit Sudo Checkbox wb_driver.find_element_by_xpath(xpaths['permitSudocheckbox']).click() # Click on create new User button if wb_driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") wb_driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") time.sleep(1) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) # check if there is a generic error when making a duplicate user, and print the error no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback'] time.sleep(2)
def test_04_create_duplicategroup(wb_driver): test_name = sys._getframe().f_code.co_name # Click create new group option wb_driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname wb_driver.find_element_by_xpath( xpaths['newGroupName']).send_keys(newgroupname) # Click on save new Group button if wb_driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") wb_driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") wb_driver.find_element_by_xpath(xpaths['cancelButton']).click() # wait on the fabAction xpath = xpaths['fabAction'] wait = wait_on_element(wb_driver, xpath, script_name, test_name) assert wait, f'Loading Users page timeout' # taking screenshot take_screenshot(wb_driver, script_name, test_name) no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback']
def test_03_create_supergroup(wb_driver): time.sleep(1) # Click Group sub-menu wb_driver.find_element_by_xpath(xpaths['submenuGroup']).click() time.sleep(1) # Click create new group option wb_driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname time.sleep(1) wb_driver.find_element_by_xpath( xpaths['newGroupName']).send_keys(supergroupname) # Check Permit sudo checkbox wb_driver.find_element_by_xpath(xpaths['permitsudoCheckbox']).click() # Click on save new Group button wb_driver.find_element_by_xpath(xpaths['saveButton']).click() time.sleep(1) # taking screenshot test_name = sys._getframe().f_code.co_name take_screenshot(wb_driver, script_name, test_name) # check if there is a generic error when making a duplicate group, and print the error no_error = error_check(wb_driver) assert no_error['result'], no_error['traceback'] time.sleep(2)