def test_AddNewUser_270(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) # This is information for add user edit fields username = "******" password = "******" email = "*****@*****.**" # To select User role type "0" # To select Admin role type "1" role = "0" # This function returns the row number for the desired username # on /users page. # Returns row number if the us username is found and 0 otherwise. if users.UserRow(self, sel, username) != 0: print "Duplicate user found. Deleting it..." # This function delete user users.DeleteUser(self, sel, username, 0) # This function add user users.AddUser(self, sel, username, email, role, password) print "Logging out..." # This function log out loginlogout.LogOut(self, sel) print "Logging in as user: "******"ViewAdmin"]) == True: print "Log in as User failed" else: print "Logged as User"
def test_case(self): self.initialize() sel = self.selenium print "Loging in..." loginlogout.LogInBasic(self, sel, testvars.MCTestVariables["AdminLogin"], testvars.MCTestVariables["AdminPassword"]) WaitUntilElementOnTheScreen(sel, gViewAdmin, gTimeOut) print "Cliking 'View Admin' link..." sel.click(gViewAdmin) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) print "Going on 'Bulk Edit' page..." # sel.click(gBulkEditOnAdminPage) sel.open(testvars.MCTestVariables["BulkEditPage"]) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) #------------------------------------------------------------------------------------------------------------------------------- print "Sorting Videos by one of the attributes..." sel.click(self.cSortingLink) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) print "Checking if the first page is sorted..." self.checkIfPageIsSorted(self.cGetElementMethod, self.cCompareMethod) self.cFirstPage = False i = 2 while sel.is_element_present(self.getPageLink_(i)): print "Checking if the page #", i, " is sorted..." sel.click(self.getPageLink_(i)) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) self.checkIfPageIsSorted(self.cGetElementMethod, self.cCompareMethod) i = i + 1 #------------------------------------------------------------------------------------------------------------------------------- print "Set start values to variables..." self.zeroVariables() print "Checking if there is a first page..." if sel.is_element_present(self.getPageLink_(1)): print "Going back to the first page..." sel.click(self.getPageLink_(1)) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) print "Sorting Videos by one of the attributes..." sel.click(self.cSortingLink) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) print "Checking if the first page is sorted..." self.checkIfPageIsSorted(self.cGetElementMethod, self.cCompareMethod) self.cFirstPage = False i = 2 while sel.is_element_present(self.getPageLink_(i)): print "Checking if the page #", i, " is sorted..." sel.click(self.getPageLink_(i)) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) self.checkIfPageIsSorted(self.cGetElementMethod, self.cCompareMethod) i = i + 1 print "Algorithm, that is used to check if page is sorted, is based on checking if previous pair of elements has the same results as current pair,\n\
def test_EditUserProfile_539(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) # Check that user newTestUser exists. If not, create a new user username = "******" password = "******" if users.UserRow(self, sel, username) == 0: users.AddUser(self, sel, username, "", "0", password) # New settings for the user profile name = "NewUser" newusername = "" password = "******" location = "North America" website = "http://www.google.ca/" description = "Miro Community QA" photo = "photo5.jpg" email = "*****@*****.**" print "Log in as " + username loginlogout.LogInBasic(self, sel, username, password) print "Editing the profile for " + username users.EditUserProfile( self, sel, name, newusername, email, location, website, os.path.join(testvars.MCTestVariables["GraphicFilesDirectory"], photo), description) users.ViewUserCheck(self, sel, username, name, location, website, description, photo)
def test_AddNewAdmin_271(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) # This is information for add user edit fields username = "******" password = "******" email = "*****@*****.**" role = "1" # "1"-Admin, "0"-User # This function returns the row number for the desired username # on /users page. # Returns row number if the us username is found and 0 otherwise. if users.UserRow(self, sel, username) != 0: print "Duplicate user found. Deleting it..." # This function delete user users.DeleteUser(self, sel, username, 0) # This function add user users.AddUser(self, sel, username, email, role, password) print "Logging out..." # This function log out loginlogout.LogOut(self, sel) print "Logging in as user: "******"ViewAdmin"] ) == True or sel.is_element_present( testvars.MCTestVariables["ViewAdminBlueTheme"]) == True: print "Logged as Admin" else: mclib.AppendErrorMessage( self, sel, "User " + username + " does not have Administrator privileges")
def test_CreateNewUserUsernameAndPassword_280(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) # This is information for add user edit fields username = "******" password = "******" email = "" # To select User role type "0" # To select Admin role type "1" role = "" # This function returns the row number for the desired username # on /users page. # Returns row number if the us username is found and 0 otherwise. if users.UserRow(self, sel, username) != 0: print "Duplicate user found. Deleting it..." # This function delete user users.DeleteUser(self, sel, username, 0) print "User deleted: " + username # This function add user users.AddUser(self, sel, username, email, role, password) print "Logging out..." # This function log out loginlogout.LogOut(self, sel) print "Logging in as user: " + username # This function login as just created user loginlogout.LogInBasic(self, sel, username, password)
def LoginAsAdminSetThemeGoToViewAdmin(self): sel = self.selenium loginlogout.LogInBasic(self, sel, testvars.MCTestVariables["AdminLogin"], testvars.MCTestVariables["AdminPassword"]) sel.open(testvars.MCTestVariables["ListThemeLink"]) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) # sel.click(gVideosSectionOnAdminPage) sel.open(testvars.MCTestVariables["ReviewQueuePage"]) sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
def test_SignUpAndLogin(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) print "Starting tests..." for theme in range(1, 2): print "" print "============================================" print "" print "Running Sign Up and Login test with theme: " + str(theme) print "Changing theme..." sitesettings.ChangeTheme(self, sel, theme) loginlogout.LogOut(self, sel) newUsername = "******" + time.strftime( "%d_%m_%Y__%H_%M", time.localtime()) + "_theme" + str(theme) newPassword = "******" print "Signing up as user " + newUsername loginlogout.SignUp(self, sel, newUsername, newPassword, testvars.MCTestVariables["TestEmail"]) loginlogout.ActivateUserAccount( self, sel, testvars.MCTestVariables["TestEmail"], testvars.MCTestVariables["TestEmailPassword"]) loginlogout.LogInBasic(self, sel, newUsername, newPassword) # Navigating to user profile to check the user's account parameters print "Checking the user's profile..." linkYourProfile = "link=Your Profile" if sel.is_element_present(linkYourProfile) == False: mclib.AppendErrorMessage( self, sel, "'Your profile' link on Home page not found") else: sel.click("link=Your Profile") sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"]) if sel.get_value( "id_email") != testvars.MCTestVariables["TestEmail"]: mclib.AppendErrorMessage( self, sel, "Unexpected user email encountered in User Profile") print "Expected email: " + testvars.MCTestVariables[ "TestEmail"] print "- Actual email: " + sel.get_value("id_email") print "Checking user's name on Profile page..." if sel.is_element_present("id_username") == False: mclib.AppendErrorMessage( self, sel, "User Name field on Profile page not found") else: if sel.get_value("id_username") != newUsername: mclib.AppendErrorMessage(self, sel, "Unexpected user name found") print "Expected user name: " + newUsername print "- Actual user name: " + sel.get_value( "id_username") else: print "OK"
def test_EditUser_291(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) # This is information for add user edit fields username = "******" newusername = "******" password = "******" name = "John Doe" email = "*****@*****.**" # To select User role type "0" # To select Admin role type "1" role = "1" location = "Greenland" website = "www.google.ca" logo = "photo3.jpg" description = "Hello" # Check if user appeared if users.UserRow(self, sel, username) != 0: print "Found user " + username + ". Deleting it..." users.DeleteUser(self, sel, username, 0) if newusername != "": if users.UserRow(self, sel, newusername) != 0: print "Found user " + newusername + ". Deleting it..." users.DeleteUser(self, sel, newusername, 0) # Add user <username> users.AddUser(self, sel, username, email, role, password) # Now modify this user account users.EditUser(self, sel, username, newusername, name, email, role, location, website, description, logo, password) # Attempt to login to the system with the modified account if newusername != "": userlogin = newusername else: userlogin = username if users.UserRow(self, sel, userlogin) != 0: print "User " + username + " successfully edited" # Log out loginlogout.LogOut(self, sel) print "Logging in as user: "******"..." # Log in as just created user loginlogout.LogInBasic(self, sel, userlogin, password)
def LogIn(sel, username, password): loginlogout.LogInBasic(self, sel, username, password) return True
def test_NewUserUsernameMaxMax2MinChars_281(self): sel = self.selenium # Log in as Admin loginlogout.LogInAsAdmin(self, sel) # This is information for add user edit fields username = "******" password = "******" email = "*****@*****.**" # To select User role type "0" # To select Admin role type "1" role = "0" # This function returns the row number for the desired username # on /users page. # Returns row number if the us username is found and 0 otherwise. if users.UserRow(self, sel, username) != 0: print "Duplicate user found. Deleting it..." # This function delete user users.DeleteUser(self, sel, username, 0) print "User deleted: " + username # This function add user users.AddUser(self, sel, username, email, role, password) print "Logging out..." # This function check and log out if users.UserRow(self, sel, username) != 0: loginlogout.LogOut(self, sel) else: users.AddUser(self, sel, username, email, role, password) print "Logging in as user: "******"link=Logout " + username) sel.wait_for_page_to_load("10000") ##### Creating user with 15 chars in the 'Username' field ##### loginlogout.LogInAsAdmin(self, sel) username = "******" if users.UserRow(self, sel, username) != 0: print "Duplicate user found. Deleting it..." users.DeleteUser(self, sel, username, 0) print "User deleted: " + username users.AddUser(self, sel, username, email, role, password) print "Logging out..." if users.UserRow(self, sel, username) != 0: loginlogout.LogOut(self, sel) else: users.AddUser(self, sel, username, email, role, password) print "Logging in as user: "******"link=Logout " + username) sel.wait_for_page_to_load("10000") ##### Creating user with 1 chars in the 'Username' field ##### loginlogout.LogInAsAdmin(self, sel) username = "******" if users.UserRow(self, sel, username) != 0: print "Duplicate user found. Deleting it..." users.DeleteUser(self, sel, username, 0) print "User deleted: " + username users.AddUser(self, sel, username, email, role, password) print "Logging out..." if users.UserRow(self, sel, username) != 0: loginlogout.LogOut(self, sel) else: users.AddUser(self, sel, username, email, role, password) print "Logging in as user: "******"link=Logout " + username) sel.wait_for_page_to_load("10000")