Exemplo n.º 1
0
 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"
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 def test_DeleteUser_272(self):
     sel = self.selenium
     # Log in as Admin
     loginlogout.LogInAsAdmin(self, sel)
     # Adding a new user withe the following parameters
     username = "******"
     password = "******"
     email = "*****@*****.**"
     # To select User role type "0"
     # To select Admin role type "1"
     role = "0"
     # This function add user
     users.AddUser(self, sel, username, email, role, password)
     # Now deleting the recently created user
     users.DeleteUser(self, sel, username, 0)
Exemplo n.º 6
0
    def test_CreateNewUserWithoutPassword_273(self):
        sel = self.selenium
        # Log in as Admin
        loginlogout.LogInAsAdmin(self, sel)
        # This is information for add user edit fields
        username = "******"
        password = ""
        email = "*****@*****.**"
        role = "0"  # "1" - Admin, "0" - User
        website = "www.google.com"
        # 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.UserRowInCompleteListOfAuthors(self, sel, username) != 0:
            print "Duplicate user found. Deleting it..."
            # This function delete user
            users.DeleteUser(self, sel, username, 1)
            print "User deleted: " + username
        # This function add user
        users.FillAddUserPopUp(self, sel, username, email, role, password)
        # Check if user appeared in the list
        print "Checking if the user was successfully created..."
        if users.UserRowInCompleteListOfAuthors(self, sel, username) == 0:
            mclib.AppendErrorMessage(
                self, sel,
                "Could not create a user with PASSWORD (optional field) blank")
        else:
            print "OK"
            # Attempt to log in with the new account
            loginlogout.LogOut(self, sel)
            sel.open(testvars.MCTestVariables["LoginPage"])
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            time.sleep(1)
            sel.click("id_username")
            sel.type("id_username", username)
            time.sleep(1)
            sel.click("css=input.button[type='submit']")

            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            if sel.is_text_present(
                    "This field is required.") and sel.is_element_present(
                        testvars.MCTestVariables["LogoutFootlink"]) == False:
                print "Could not login as a 'non-human' (passwordless) user. TEST PASSED"
            else:
                mclib.AppendErrorMessage(
                    self, sel, "Managed to login as a passwordless user " +
                    username + ". TEST FAILED")
Exemplo n.º 7
0
 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")
Exemplo n.º 8
0
    def test_UsernameDoesntAcceptMax1Chars_283(self):
        sel = self.selenium
        # Log in as Admin
        loginlogout.LogInAsAdmin(self, sel)
        # This is information for add user edit fields
        username = "******"
        password = "******"
        email = "*****@*****.**"
        role = "0"  # "1"-Admin, "0"-User
        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.FillAddUserPopUp(self,sel,username,email,role,password)
        print "Adding a new username " + username
        sel.open(testvars.MCTestVariables["UserPage"])
        buttonAddUser = "******"
        if sel.is_element_present(buttonAddUser) == True:
            sel.click(buttonAddUser)
            time.sleep(2)
            if sel.is_visible("//div[@id='label_sidebar']") == False:
                mclib.AppendErrorMessage(self, sel,
                                         "Add user pop-up does not display")
            else:
                # Enter username
                if sel.is_element_present("id_username") == True:
                    sel.click("id_username")
                    sel.type("id_username", username)
                    typedUsername = sel.get_value("id_username")
                    if typedUsername == username:
                        mclib.AppendErrorMessage(
                            self, sel,
                            "Username edit fields accepts strings longer than 30 characters."
                        )
                    elif typedUsername == username[:-1]:
                        print "Username edit field trims all input to 30 permitted characters."
                        print "Attempted to type: " + username
                        print "-- Actually typed: " + typedUsername
                    else:
                        print "Unexpected string found in Username edit field"
                        print "Expected string: " + username
                        print "- Actual string: " + typedUsername
                else:
                    mclib.AppendErrorMessage(
                        self, sel, "Edit field for user's username not found")
                # Enter user's email address
                if sel.is_element_present("id_email") == True:
                    sel.click("id_email")
                    sel.type("id_email", email)
                else:
                    mclib.AppendErrorMessage(
                        self, sel, "Edit field for user's email not found")
                # Enter user's role
                if sel.is_element_present("id_role_0") == True:
                    if role == "":
                        sel.click("id_role_0")
                    else:
                        sel.click("id_role_" + role)
                else:
                    mclib.AppendErrorMessage(
                        self, sel, "Radio buttons for user's role not found")
                # Enter user's password
                if sel.is_element_present("id_password_f") == True:
                    sel.click("id_password_f")
                    sel.type("id_password_f", password)
                else:
                    mclib.AppendErrorMessage(
                        self, sel, "Edit field for user's password not found")
                # Enter user's password confirmation
                if sel.is_element_present("id_password_f2") == True:
                    sel.click("id_password_f2")
                    sel.type("id_password_f2", password)
                else:
                    mclib.AppendErrorMessage(
                        self, sel,
                        "Edit field for user's password confirmation not found"
                    )
                # Save changes
                buttonSubmit = "submit"
                if sel.is_element_present(buttonSubmit) == True:
                    sel.click("submit")
                else:
                    mclib.AppendErrorMessage(
                        self, sel, "Save button on Add User pop-up not found")
                sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
                if users.UserRow(self, sel, username) != 0:
                    mclib.AppendErrorMessage(
                        self, sel,
                        "User with too long username found in the list: " +
                        username + ". TEST FAILED")
                else:
                    print "Could not add a user with an excessively long username. TEST PASSED"