def test_02_create_newpool(self): try: print (" creating a new pool with 1 disk") # cancelling the tour if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'): driver.find_element_by_xpath('/html/body/div[6]/div[1]/button').click() time.sleep(1) # Click create new pool option driver.find_element_by_xpath(xpaths['addAction']).click() # Click create Pool Button driver.find_element_by_xpath(xpaths['forwardButton']).click() # Enter User Full name driver.find_element_by_xpath(xpaths['newpoolName']).send_keys(pool1) # Select the disk driver.find_element_by_xpath(xpaths['disk1Checkbox']).click() # Select the disk driver.find_element_by_xpath(xpaths['diskselectedmoveButton']).click() # Click on create new Pool button driver.find_element_by_xpath(xpaths['createButton']).click() # checkbox confirmation driver.find_element_by_xpath(xpaths['confirmCheckbox']).click() # Click Ok Button driver.find_element_by_xpath(xpaths['createpoolButton']).click() #taking screenshot function.screenshot(driver, self) self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_login(self): try: print ("loging in FreeNAS new webui- woot woot") # enter username in the username textbox driver.find_element_by_xpath(xpaths['usernameTxtBox']).clear() driver.find_element_by_xpath(xpaths['usernameTxtBox']).send_keys(username) # enter password in the password textbox driver.find_element_by_xpath(xpaths['passwordTxtBox']).send_keys(password) # click driver.find_element_by_xpath(xpaths['submitButton']).click() # check if the dashboard opens time.sleep(1) self.error_check() self.error_check() # get the ui element ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li/a') # get the weather data page_data=ui_element.text print ("The page now is: " + page_data) # assert response self.assertTrue("Dashboard" in page_data) # cancelling the tour if function.is_element_present(driver, self, By.XPATH, '/html/body/div[5]/div[1]/button'): driver.find_element_by_xpath('/html/body/div[5]/div[1]/button').click() driver.execute_script("document.body.style.zoom='50 %'") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_update_nameserver(self): try: # Fill up the form # Enter password newuserpassword driver.find_element_by_xpath(xpaths['nameserver1']).clear() print("clear the nameserver 1 field") driver.find_element_by_xpath( xpaths['nameserver1']).send_keys("8.8.8.8") driver.find_element_by_xpath(xpaths['nameserver2']).clear() print("clear the nameserver 2 field") driver.find_element_by_xpath( xpaths['nameserver2']).send_keys("10.231.1.1") driver.find_element_by_xpath(xpaths['buttonSave']).click() #taking screenshot function.screenshot(driver, self) time.sleep(10) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_create_supergroup(self): try: print(" creating a new Super group with root access") time.sleep(1) # Click Group submenu driver.find_element_by_xpath(xpaths['submenuGroup']).click() # Perform hover to show menu hover_element = driver.find_element_by_xpath(xpaths['fabTrigger']) hover = ActionChains(driver).move_to_element(hover_element) hover.perform() time.sleep(1) # Click create new group option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname time.sleep(1) driver.find_element_by_xpath( xpaths['newGroupName']).send_keys(supergroupname) # Check Permit Sudo checkbox driver.find_element_by_xpath(xpaths['permitsudoCheckbox']).click() # Click on save new Group button driver.find_element_by_xpath(xpaths['saveButton']).click() #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate group, and print the error self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_create_newgroup(self): try: print(" creating a new group without root access") # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Perform hover to show menu hover_element = driver.find_element_by_xpath(xpaths['fabTrigger']) hover = ActionChains(driver).move_to_element(hover_element) hover.perform() time.sleep(1) # Click create new group option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname time.sleep(1) driver.find_element_by_xpath( xpaths['newGroupName']).send_keys(newgroupname) # Click on save new Group button driver.find_element_by_xpath(xpaths['saveButton']).click() #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate group, and print the error self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_configure_webdav(self): try: print(" configuring webdav service") time.sleep(1) # click on configure button driver.find_element_by_xpath(xpaths['configButton']).click() time.sleep(1) # Enter password newuserpassword driver.find_element_by_xpath(xpaths['webdavPassword']).clear() print("clear the webdav password field") driver.find_element_by_xpath( xpaths['webdavPassword']).send_keys(newuserpassword) # Enter password confirmation newuserpassword driver.find_element_by_xpath(xpaths['webdavPassword2']).clear() print("clear the webdav password2 field") driver.find_element_by_xpath( xpaths['webdavPassword2']).send_keys(newuserpassword) # Click on save button driver.find_element_by_xpath('//*[@id="save_button"]').click() #wait till saving is finished time.sleep(5) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_nav_net_static(self): try: # Click on the static submenu driver.find_element_by_xpath(xpaths['submenuStatic']).click() # cancelling the tour if self.is_element_present(By.XPATH, "/html/body/div[6]/div[1]/button"): driver.find_element_by_xpath( "/html/body/div[6]/div[1]/button").click() # get the ui element ui_element = driver.find_element_by_xpath( "//*[@id='breadcrumb-bar']/ul/li[2]/a") # get the weather data page_data = ui_element.text print("the Page now is: " + page_data) # assert response self.assertTrue("Static Routes" in page_data) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_nav_system_email(self): try: # driver.find_element_by_xpath(xpaths['navSystem']).click() time.sleep(1) driver.find_element_by_xpath(xpaths['submenuEmail']).click() # cancelling the tour if self.is_element_present(By.XPATH, '/html/body/div[6]/div[1]/button'): driver.find_element_by_xpath( '/html/body/div[6]/div[1]/button').click() # get the ui element ui_element = driver.find_element_by_xpath( '//*[@id="breadcrumb-bar"]/ul/li[2]/a') # get the weather data page_data = ui_element.text print("the Page now is: " + page_data) # assert response self.assertTrue("Email" in page_data) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_configure_webdav(self): try: print (" configuring webdav service") time.sleep(1) # click on configure button driver.find_element_by_xpath(xpaths['configButton']).click() time.sleep(1) # Enter password newuserpassword driver.find_element_by_xpath(xpaths['webdavPassword']).clear() print ("clear the webdav password field") driver.find_element_by_xpath(xpaths['webdavPassword']).send_keys(newuserpassword) # Enter password confirmation newuserpassword driver.find_element_by_xpath(xpaths['webdavPassword2']).clear() print ("clear the webdav password2 field") driver.find_element_by_xpath(xpaths['webdavPassword2']).send_keys(newuserpassword) # Click on save button driver.find_element_by_xpath('//*[@id="save_button"]').click() #wait till saving is finished time.sleep(5) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_create_newuser_primarygroup_uncheck(self): try: time.sleep(2) print(" creating a new user without creating a primary group") # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() #temporary turn off dropdownlist test # uncheck create primary group Checkbox # driver.find_element_by_xpath(xpaths['primaryGroupcheckbox']).click() # click on primary group dropdownlist # driver.find_element_by_xpath(xpaths['primaryGroupdropdown']).click() # if driver.find_element_by_xpath(xpaths['primaryGroupdropdown']).click(): # driver.find_element_by_xpath(xpaths['primaryGroupdropdown']).click() # select the element from the dropdown list by using selectlist function # time.sleep(2) # print ("attempt") # Select(driver.find_element_by_xpath(xpaths['primaryGroupdropdown'])).select_by_visible_text("userNAS") # print ("made") # driver.find_element_by_xpath('//*[contains(text(), "userNAS")]').click() # Enter User Full name driver.find_element_by_xpath( xpaths['newUserName']).send_keys(newuserfnameuncheck) # clear user name and enter new Username driver.find_element_by_xpath(xpaths['newUser']).clear() driver.find_element_by_xpath( xpaths['newUser']).send_keys(newusernameuncheck) # Enter Password driver.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf driver.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_turnon_iscsi(self): try: print(" turning on the iscsi service") # Click Service Menu driver.find_element_by_xpath(xpaths['navService']).click() # check if the Service page is opens time.sleep(1) # get the ui element ui_element = driver.find_element_by_xpath( '//*[@id="breadcrumb-bar"]/ul/li/a') # get the weather data page_data = ui_element.text print("the Page now is: " + page_data) # assert response self.assertTrue("Services" in page_data) function.status_change(driver, self, "5", "start") #iscsi test takes almost 3 min to turn on and display time.sleep(3) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_turnon_iscsi (self): try: print (" turning on the iscsi service") # Click Service Menu driver.find_element_by_xpath(xpaths['navService']).click() # check if the Service page is opens time.sleep(1) # get the ui element ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li/a') # get the weather data page_data=ui_element.text print ("the Page now is: " + page_data) # assert response self.assertTrue("Services" in page_data) function.status_change(driver, self, "5", "start") #iscsi test takes almost 3 min to turn on and display time.sleep(3) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_login(self): try: print ("loging in TrueNAS new webui- woot woot") # enter username in the username textbox driver.find_element_by_xpath(xpaths['usernameTxtBox']).clear() driver.find_element_by_xpath(xpaths['usernameTxtBox']).send_keys(username) # enter password in the password textbox driver.find_element_by_xpath(xpaths['passwordTxtBox']).send_keys(password) # click driver.find_element_by_xpath(xpaths['submitButton']).click() # check if the dashboard opens time.sleep(1) # get the ui element ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li/a') # get the weather data page_data=ui_element.text print ("The page now is: " + page_data) # assert response self.assertTrue("Dashboard" in page_data) # cancelling the tour if function.is_element_present(driver, self, By.XPATH, '/html/body/div[5]/div[1]/button'): driver.find_element_by_xpath('/html/body/div[5]/div[1]/button').click() driver.execute_script("document.body.style.zoom='50 %'") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_create_newgroup(self): try: print (" creating a new group without root access") # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Perform hover to show menu hover_element = driver.find_element_by_xpath(xpaths['fabTrigger']) hover = ActionChains(driver).move_to_element(hover_element) hover.perform() time.sleep(1) # Click create new group option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Groupname time.sleep(1) driver.find_element_by_xpath(xpaths['newGroupName']).send_keys(newgroupname) # Click on save new Group button driver.find_element_by_xpath(xpaths['saveButton']).click() #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate group, and print the error self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_turnon_webdav (self): try: print (" turning on the webdav service") # Click Service Menu driver.find_element_by_xpath(xpaths['navService']).click() # check if the Services page is open time.sleep(1) # get the ui element ui_element_page=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li/a') # get the weather data page_data=ui_element_page.text print ("the Page now is: " + page_data) # assert response self.assertTrue("Services" in page_data) # scroll down driver.find_element_by_tag_name('body').send_keys(Keys.END) time.sleep(2) function.status_change(driver, self, "17", "start") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_00_nav_acc_user(self): try: # Click Account menu print (" navigating to the user submenu") a = driver.find_element_by_xpath(xpaths['navAccount']) a.click() # allowing the button to load time.sleep(1) # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # get the ui element ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li[2]/a') # get the weather data page_data=ui_element.text print ("the Page now is: " + page_data) # assert response self.assertTrue("User" in page_data) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_00_nav_acc_user(self): try: # Click Account menu print (" navigating to the user submenu") a = driver.find_element_by_xpath(xpaths['navAccount']) a.click() # allowing the button to load time.sleep(1) # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # get the ui element ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li[2]/a') # get the weather data page_data=ui_element.text print ("the Page now is: " + page_data) # assert response self.assertTrue("User" in page_data) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_nav_net_conf(self): try: # Navigating to System>Update page a = driver.find_element_by_xpath(xpaths['navNetwork']) a.click() # allowing page to load by giving explicit time(in seconds) time.sleep(1) # Click on the Update submenu driver.find_element_by_xpath(xpaths['submenuNetworkconfig']).click() # cancelling the tour if self.is_element_present(By.XPATH,"/html/body/div[6]/div[1]/button"): driver.find_element_by_xpath("/html/body/div[6]/div[1]/button").click() # get the ui element ui_element=driver.find_element_by_xpath("//*[@id='breadcrumb-bar']/ul/li[2]/a") # get the weather data page_data=ui_element.text print ("the Page now is: " + page_data) # assert response self.assertTrue("Configuration" in page_data) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_turnon_webdav(self): try: print(" turning on the webdav service") # Click Service Menu driver.find_element_by_xpath(xpaths['navService']).click() # check if the Services page is open time.sleep(1) # get the ui element ui_element_page = driver.find_element_by_xpath( '//*[@id="breadcrumb-bar"]/ul/li/a') # get the weather data page_data = ui_element_page.text print("the Page now is: " + page_data) # assert response self.assertTrue("Services" in page_data) # scroll down driver.find_element_by_tag_name('body').send_keys(Keys.END) time.sleep(2) function.status_change(driver, self, "17", "start") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_create_newuser_primarygroup_uncheck(self): try: time.sleep(2) print (" creating a new user without creating a primary group") # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() #temporary turn off dropdownlist test # uncheck create primary group Checkbox # driver.find_element_by_xpath(xpaths['primaryGroupcheckbox']).click() # click on primary group dropdownlist # driver.find_element_by_xpath(xpaths['primaryGroupdropdown']).click() # if driver.find_element_by_xpath(xpaths['primaryGroupdropdown']).click(): # driver.find_element_by_xpath(xpaths['primaryGroupdropdown']).click() # select the element from the dropdown list by using selectlist function # time.sleep(2) # print ("attempt") # Select(driver.find_element_by_xpath(xpaths['primaryGroupdropdown'])).select_by_visible_text("userNAS") # print ("made") # driver.find_element_by_xpath('//*[contains(text(), "userNAS")]').click() # Enter User Full name driver.find_element_by_xpath(xpaths['newUserName']).send_keys(newuserfnameuncheck) # clear user name and enter new Username driver.find_element_by_xpath(xpaths['newUser']).clear() driver.find_element_by_xpath(xpaths['newUser']).send_keys(newusernameuncheck) # Enter Password driver.find_element_by_xpath(xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf driver.find_element_by_xpath(xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print ("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print ("could not find the save button and clicking") #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_check_update_now(self): try: # Click on the checknow button driver.find_element_by_xpath(xpaths['buttonChecknow']).click() time.sleep(2) # get the ui element, check if first element is present, if yes, check value text if as expected if self.is_element_present( By.XPATH, "/html/body/app-root/app-admin-layout/mat-sidenav-container/mat-sidenav-content/div/app-update/mat-card[1]/div/div[4]/div/table/tbody/tr[1]/td[1]" ): ui_element = driver.find_element_by_xpath( "/html/body/app-root/app-admin-layout/mat-sidenav-container/mat-sidenav-content/div/app-update/mat-card[1]/div/div[4]/div/table/tbody/tr[1]/td[1]" ) update_data = ui_element.text if update_data == "Upgrade": print("There is an available upgrade") # assert response self.assertTrue("Upgrade" in update_data) self.error_check_sys() else: print("There is an unexpected issue: it is not an upgrade") self.error_check_sys() elif self.is_element_present( By.XPATH, "/html/body/app-root/app-admin-layout/md-sidenav-container/div[6]/div/app-update/md-card/div/div[4]/div/div" ): ui_element2 = driver.find_element_by_xpath( "/html/body/app-root/app-admin-layout/md-sidenav-container/div[6]/div/app-update/md-card/div/div[4]/div/div" ) update_data2 = ui_element2.text if "No" in update_data2: print("There is no update available") self.assertTrue("No" in update_data2) self.error_check_sys() else: print( "There is an unexpected issue: something wrong with no update available element:" + update_data2) self.error_check_sys() else: print("There is an unexpected issue") self.error_check_sys() #taking screenshot function.screenshot(driver, self) time.sleep(5) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_04_close_navStorage(self): try: print (" closing Storage menu") driver.find_element_by_xpath(xpaths['navStorage']).click() function.screenshot(driver, self) time.sleep(20) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_04_theme4(self): try: self.theme_change(theme_name['theme4']) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_07_close_navAccount(self): try: print (" closing account menu") driver.find_element_by_xpath(xpaths['navAccount']).click() function.screenshot(driver, self) time.sleep(20) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_06_create_newuser_suggestedname(self): try: print(" creating a new user with suggested name") # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # cancelling the tour if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'): driver.find_element_by_xpath( '/html/body/div[6]/div[1]/button').click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name driver.find_element_by_xpath( xpaths['newUserName']).send_keys(newuserfname) # not required since UI auto fills suggested username # driver.find_element_by_xpath(xpaths['newUser']).clear() # driver.find_element_by_xpath(xpaths['newUser']).send_keys(newusername) # Enter User email id driver.find_element_by_xpath( xpaths['newUserEmail']).send_keys(newuseremail) # Enter Password driver.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf driver.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) #taking screenshot function.screenshot(driver, self) self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_05_create_duplicateuser(self): try: print(" creating a duplicate user") # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # cancelling the tour if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'): driver.find_element_by_xpath( '/html/body/div[6]/div[1]/button').click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Perform hover to show menu hover_element = driver.find_element_by_xpath(xpaths['fabTrigger']) hover = ActionChains(driver).move_to_element(hover_element) hover.perform() time.sleep(1) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Username driver.find_element_by_xpath( xpaths['newUser']).send_keys(newusername) # Enter User Full name driver.find_element_by_xpath( xpaths['newUserName']).send_keys(newuserfname) # Enter Password driver.find_element_by_xpath( xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf driver.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_04_create_superuser(self): try: print(" creating a super user with root access") time.sleep(2) # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Perform hover to show menu hover_element = driver.find_element_by_xpath(xpaths['fabTrigger']) hover = ActionChains(driver).move_to_element(hover_element) hover.perform() time.sleep(1) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter New Username driver.find_element_by_xpath( xpaths['newUser']).send_keys(superusername) # Enter User Full name driver.find_element_by_xpath( xpaths['newUserName']).send_keys(superuserfname) # Enter Password driver.find_element_by_xpath( xpaths['newUserPass']).send_keys(superuserpassword) # Enter Password Conf driver.find_element_by_xpath( xpaths['newUserPassConf']).send_keys(superuserpassword) # check Permit Sudo Checkbox driver.find_element_by_xpath(xpaths['permitSudocheckbox']).click() # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print("could not find the save button and clicking") #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) self.error_check() # check if the the user list is loaded after addding a new user except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_close_network_tab(self): try: # Close the System Tab driver.find_element_by_xpath(xpaths['navNetwork']).click() time.sleep(2) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_04_theme4(self): try: self.theme_change(theme_name['theme4']) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_turnoff_iscsi (self): try: print (" turning off the iscsi service") time.sleep(2) function.status_change(driver, self, "5", "stop") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_turnoff_iscsi (self): try: print (" turning off the iscsi service") time.sleep(2) self.status_change("6", "stop") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_web_close(self): try: print("Closing the website") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_checkif_iscsi_on (self): try: print (" check if iscsi turned on") time.sleep(2) #status check function.status_check(driver, "6") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_checkif_iscsi_on (self): try: print (" check if iscsi turned on") time.sleep(2) #status check function.status_check(driver, "5") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_01_edit_groupNAS_sudo(self): try: print ("change permission of groupNAS to sudo") time.sleep(2) self.edit("group", newgroupname) driver.find_element_by_xpath('//*[@id="bsdgrp_sudo"]/mat-checkbox/label/div').click() driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(20) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) self.screenshot("-e") for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_nav_to_blog(self): try: print("navihgating to about page") # click on contact us driver.find_element_by_xpath(xpaths['blogButton']).click() #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_turnon_afp (self): try: print (" turning on the afp service") # scroll down driver.find_element_by_tag_name('body').send_keys(Keys.HOME) time.sleep(2) function.status_change(driver, self, "1", "start") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_04_delete_group(self): try: print(" deleting a group: " + supergroupname) time.sleep(2) # self.delete("group", supergroupname) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_02_edit_userNAS_sudo(self): try: print ("Changing permission to sudo user ") # Changing permission to sudo ui_sudo=driver.find_element_by_xpath('//*[@id="sudo"]/mat-checkbox') driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(15) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_delete_pool2(self): try: print (" deleting a pool: " + pool2) time.sleep(2) function.pool_detach(driver, self, pool2) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback") #temporary driver.refresh()
def test_02_01_edit_groupNAS_sudo(self): try: print ("change permission of groupNAS to sudo") time.sleep(2) function.user_edit(driver, self, "group", newgroupname) driver.find_element_by_xpath('//*[@id="bsdgrp_sudo"]/mat-checkbox/label/div').click() driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(20) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_02_delete_user(self): try: print(" deleting a user: "******"user", newusernameuncheck) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i]) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_04_delete_user(self): try: print(" deleting a user: unas (suggested by UI)") time.sleep(2) function.user_delete(driver, self, "user", "unas") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1, len(exc_info_p)): print(exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_02_edit_userNAS_sudo(self): try: print ("Changing permission to sudo user ") # Changing permission to sudo ui_sudo=driver.find_element_by_xpath('//*[@id="sudo"]/mat-checkbox') function.user_edit(driver, self, "user", newusername) driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(15) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_configure_email(self): try: # Close the System Tab driver.find_element_by_xpath(xpaths['outgoingMail']).clear() print ("configuring outgoing server to [email protected]") driver.find_element_by_xpath(xpaths['outgoingMail']).send_keys("*****@*****.**") driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(5) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_04_turnoff_webdav (self): try: print (" turning off the webdav service") # Click Service Menu driver.find_element_by_xpath(xpaths['navService']).click() # scroll down driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) function.status_change(driver, self, "17", "stop") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_02_update_nameserver(self): try: # Fill up the form # Enter password newuserpassword driver.find_element_by_xpath(xpaths['nameserver3']).clear() print ("clear the nameserver 3 field") # driver.find_element_by_xpath(xpaths['nameserver3']).send_keys("8.8.8.8") # driver.find_element_by_xpath(xpaths['buttonSave']).click() #taking screenshot function.screenshot(driver, self) time.sleep(10) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_01_edit_userNAS_email(self): try: print ("Change the email to [email protected] ") time.sleep(2) #call edit funtion on the userNAS function.user_edit(driver, self, "user", newusername) # get the ui element ui_email=driver.find_element_by_xpath('//*[@id="email"]/mat-input-container/div/div[1]/div/input') ui_email.clear() ui_email.send_keys("*****@*****.**") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_04_create_superuser(self): try: print (" creating a super user with root access") time.sleep(2) # Click User submenu driver.find_element_by_xpath(xpaths['submenuUser']).click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name driver.find_element_by_xpath(xpaths['newUserName']).send_keys(superuserfname) # clear user name and enter new Username driver.find_element_by_xpath(xpaths['newUser']).clear() driver.find_element_by_xpath(xpaths['newUser']).send_keys(superusername) # Enter Password driver.find_element_by_xpath(xpaths['newUserPass']).send_keys(superuserpassword) # Enter Password Conf driver.find_element_by_xpath(xpaths['newUserPassConf']).send_keys(superuserpassword) # check Permit Sudo Checkbox driver.find_element_by_xpath(xpaths['permitSudocheckbox']).click() # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print ("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print ("could not find the save button and clicking") #taking screenshot function.screenshot(driver, self) # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) self.error_check() # check if the the user list is loaded after addding a new user except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_06_create_newuser_suggestedname(self): try: print (" creating a new user with create new primary group") # cancelling the tour if function.is_element_present(driver, self, By.XPATH, '/html/body/div[6]/div[1]/button'): driver.find_element_by_xpath('/html/body/div[6]/div[1]/button').click() # scroll down to find hover tab driver.find_element_by_tag_name('html').send_keys(Keys.END) time.sleep(2) # Click create new user option driver.find_element_by_xpath(xpaths['fabAction']).click() # Enter User Full name driver.find_element_by_xpath(xpaths['newUserName']).send_keys(newuserfname) # not required since UI auto fills suggested username # driver.find_element_by_xpath(xpaths['newUser']).clear() # driver.find_element_by_xpath(xpaths['newUser']).send_keys(newusername) # Enter User email id driver.find_element_by_xpath(xpaths['newUserEmail']).send_keys(newuseremail) # Enter Password driver.find_element_by_xpath(xpaths['newUserPass']).send_keys(newuserpassword) # Enter Password Conf driver.find_element_by_xpath(xpaths['newUserPassConf']).send_keys(newuserpassword) # Click on create new User button if driver.find_element_by_xpath(xpaths['saveButton']): print ("found the save button") driver.find_element_by_xpath(xpaths['saveButton']).click() else: print ("could not find the save button and clicking") # check if there is a generic error when making a duplicate user, and print the error time.sleep(1) #taking screenshot function.screenshot(driver, self) self.error_check() except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_turnon_ssh (self): try: # click Service Menu driver.find_element_by_xpath(xpaths['navService']).click() # allowing the button to load time.sleep(1) print (" turning on the ssh service") # scroll down driver.find_element_by_tag_name('body').send_keys(Keys.END) time.sleep(2) function.status_change(driver, self, "14", "start") #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_03_configure_ssh(self): try: print (" configuring ssh service with root access") time.sleep(2) # click on configure button driver.find_element_by_xpath(xpaths['configButton']).click() # uncheck on Login as Root with Passsword driver.find_element_by_xpath('//*[@id="ssh_rootlogin"]/mat-checkbox/label/div').click() # click on save button driver.find_element_by_xpath('//*[@id="save_button"]').click() time.sleep(5) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")
def test_01_nav_system_cloudcreds(self): try: driver.find_element_by_xpath(xpaths['submenuCloudcreds']).click() # cancelling the tour if self.is_element_present(By.XPATH,'/html/body/div[6]/div[1]/button'): driver.find_element_by_xpath('/html/body/div[6]/div[1]/button').click() # get the ui element ui_element=driver.find_element_by_xpath('//*[@id="breadcrumb-bar"]/ul/li[2]/a') # get the weather data page_data=ui_element.text print ("the Page now is: " + page_data) # assert response self.assertTrue("Cloud Credentials" in page_data) #taking screenshot function.screenshot(driver, self) except Exception: exc_info_p = traceback.format_exception(*sys.exc_info()) #taking screenshot function.screenshot(driver, self) for i in range(1,len(exc_info_p)): print (exc_info_p[i].rstrip()) self.assertEqual("Just for fail", str(Exception), msg="Test fail: Please check the traceback")