Ejemplo 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"
Ejemplo 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")
Ejemplo 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)
 def test_EnablePlaylistsForAdmins(self):
     sel = self.selenium
     #       Log in as Admin
     loginlogout.LogInAsAdmin(self, sel)
     print "Starting test..."
     sitesettings.EnablePlaylists(self, sel, "Admins Only")
     print "Going to check if Playlists page is available..."
     print "=== For ADMIN:"
     playlists.VerifyPlaylistsPageIsEnabled(self, sel)
     print "=== For USER:"******"=== For ANONYMOUS USER:"
     loginlogout.LogOut(self, sel)
     playlists.VerifyPlaylistsPageIsDisabled(self, sel)
Ejemplo n.º 5
0
 def test_SubmitVideoAsLoggedUser_472(self):
     sel = self.selenium
     # Set video parameters
     testVideoURL = "http://www.youtube.com/watch?v=MFREixTg4eI"
     testVideoTitle = "Miro Video Player"
     titleUnicode = unicode(testVideoTitle)
     # Log in as an Administrator
     loginlogout.LogInAsAdmin(self, sel)
     theme = 1
     sitesettings.ChangeTheme(self, sel, theme)
     # Display 'Submit a Video' button on front page
     sitesettings.DisplaySubmitVideo(self, sel, theme)
     # Check if the video is in the premoderation queue ("Unapproved")
     # If yes, reject it
     queue.RejectVideoFromQueue(self, sel, titleUnicode)
     # Navigate to the front page
     #        sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
     sel.open(testvars.MCTestVariables["TestSite"])
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     # Check if the video is in the current ("Approved") set of videos
     # If yes, delete it
     submitvideos.RejectVideoFromApproved(self, sel, testVideoTitle)
     for theme in range(1, 2):
         print ""
         print "The current theme is " + str(theme)
         # Set the theme
         sitesettings.ChangeTheme(self, sel, theme)
         # Navigate to the front page
         #            sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
         sel.open(testvars.MCTestVariables["TestSite"])
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
         # Log out
         loginlogout.LogOut(self, sel)
         # Log in as User
         loginlogout.LogInAsUser(self, sel)
         # Submit a video and check the results
         submitvideos.SubmitVideo(self, sel, testVideoURL, theme,
                                  "LoggedUser")  # as Admin
         # Log out
         loginlogout.LogOut(self, sel)
         # Log in as Administrator
         loginlogout.LogInAsAdmin(self, sel)
         # Check if the video is in the premoderation queue ("Unapproved")
         # If yes, reject it
         queue.RejectVideoFromQueue(self, sel, titleUnicode)
Ejemplo n.º 6
0
 def ChangeThemeAndSubmitDuplicateVideo(self, sel, theme, testVideoURL):
     print "Changing theme " + str(theme)
     sitesettings.ChangeTheme(self, sel, theme)
     #        sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
     sel.open(testvars.MCTestVariables["TestSite"])
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     loginlogout.LogOut(self, sel)
     # Submit a video and check the results
     submitvideos.SubmitDuplicateVideo(self, sel, testVideoURL, theme)
     loginlogout.LogInAsAdmin(self, sel)
 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_EnablePlaylistsForEveryone(self):
     sel = self.selenium
     #       Log in as Admin
     loginlogout.LogInAsAdmin(self, sel)
     print "Starting test..."
     sitesettings.EnablePlaylists(self, sel, "Yes")
     print "Going to check if Playlists page is available..."
     print "=== For ADMIN:"
     playlists.VerifyPlaylistsPageIsEnabled(self, sel)
     print "=== For USER:"******"=== For ANONYMOUS USER:"******"PlaylistsPage"])
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     if sel.is_text_present("Login/Sign Up") == False:
         mclib.AppendErrorMessage(
             self, sel, "Anonymous user is not required to log in")
         print sel.get_html_source()
     else:
         print "OK - anonymous user is prompted to log in to view the playlist, test passed"
Ejemplo n.º 9
0
 def test_ViewProfile_540(self):
     sel = self.selenium
     # The profile to be viewed belongs to seleniumTestUser
     username = testvars.MCTestVariables["UserLogin"]
     name = testvars.MCTestVariables["UserName"]
     description = "test user for selenium auto testing. Please don't delete."
     location = "PCF"
     website = "http://www.seleniumhq.org/"
     image = "nest-test.jpg"
     loginlogout.LogInAsUser(self, sel)
     print "Checking profile"
     users.ViewProfile(self, sel)
     users.ViewUserCheck(self, sel, username, name, location, website,
                         description, image)
     loginlogout.LogOut(self, sel)
Ejemplo n.º 10
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")
 def test_LoginWithGoogleAccount(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 Login with Google account test with theme: " + str(
             theme)
         print "Changing theme..."
         sitesettings.ChangeTheme(self, sel, theme)
         loginlogout.LogInAsGoogleUser(
             self, sel, testvars.MCTestVariables["TestEmail"],
             testvars.MCTestVariables["TestEmailPassword"])
         loginlogout.LogOut(self, sel)
Ejemplo n.º 12
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)
    def LoggedAsAdmin_CommentPosted(self):
        #        print "Executing LoggedAsAdmin_CommentPosted()"
        sel = self.selenium
        print "Logging in as admin..."
        loginlogout.LogInAsAdmin(self, sel)
        #        LogIn(sel, testvars.MCTestVariables["AdminLogin"], testvars.MCTestVariables["AdminPassword"])
        print "Clicking first video on the page..."
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print "Generating and posting new comment..."
        self.comment = generateComment()
        sel.type(self.themeToTest.commentEditField, self.comment)
        sel.click(self.themeToTest.postCommentButtonAdmin)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Asserting comment is on the page...'
        self.failUnless(sel.is_text_present(self.comment))

        #deleting posts
        if self.bCommentNotLogged:
            print 'Deleting comment posted by unlogged user...'
            sel.click(self.themeToTest.deleteCommentButtonPart1 +
                      self.commentNotLogged +
                      self.themeToTest.deleteCommentButtonPart2)
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            self.failIf(sel.is_text_present(self.commentNotLogged))
        print 'Deleting comment posted by logged user...'
        sel.click(self.themeToTest.deleteCommentButtonPart1 +
                  self.commentUser + self.themeToTest.deleteCommentButtonPart2)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        self.failIf(sel.is_text_present(self.commentUser))
        print 'Deleting comment posted by Admin...'
        sel.click(self.themeToTest.deleteCommentButtonPart1 + self.comment +
                  self.themeToTest.deleteCommentButtonPart2)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        self.failIf(sel.is_text_present(self.comment))

        print 'Going back to the main page...'
        sel.open("/")
        print 'Logging out...'
        loginlogout.LogOut(self, sel)
 def test_LoginWithOpenIDAccount(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 Login with OpenID account test with theme: " + str(
             theme)
         print "Changing theme..."
         sitesettings.ChangeTheme(self, sel, theme)
         loginlogout.LogInAsOpenIDUser(
             self, sel, testvars.MCTestVariables["OpenIDLogin"],
             testvars.MCTestVariables["OpenIDPassword"])
         loginlogout.LogOut(self, sel)
         print "Logging out from myopenid.com..."
         sel.open("http://www.myopenid.com")
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
         sel.click("link=Sign Out")
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
 def test_LoginWithTwitterAccount(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 Login with Twitter account test with theme: " + str(
             theme)
         print "Changing theme..."
         sitesettings.ChangeTheme(self, sel, theme)
         loginlogout.LogInAsTwitterUser(
             self, sel, testvars.MCTestVariables["TwitterLogin"],
             testvars.MCTestVariables["TwitterPassword"])
         loginlogout.LogOut(self, sel)
         print "Logging out from Twitter..."
         sel.open("http://www.twitter.com")
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
         sel.click("css=span.caret")
         sel.click("css=a#signout-button")
 def test_LoginWithFBAccount(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 Login with Facebook account test with theme: " + str(
             theme)
         print "Changing theme..."
         sitesettings.ChangeTheme(self, sel, theme)
         loginlogout.LogInAsFacebookUser(
             self, sel, testvars.MCTestVariables["FBUsername"],
             testvars.MCTestVariables["FBLogin"],
             testvars.MCTestVariables["FBPassword"])
         loginlogout.LogOut(self, sel)
         print "Logging out from Facebook..."
         sel.open("http://www.facebook.com")
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
         sel.click("css=label.uiLinkButton input")
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
 def LoggedAsUser_CommentPosted(self):
     #login as an User
     #print 'Executing LoggedAsUser_CommentPosted()'
     sel = self.selenium
     print 'Logging in as User...'
     loginlogout.LogInAsUser(self, sel)
     #        LogIn(sel, gUserLogin, gUserPassword)
     #click on the first video and post a comment
     print "Clicking on the first video on the page..."
     sel.click(self.themeToTest.firstVideoOnPage)
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     print 'Generating and posting a new comment...'
     self.commentUser = generateComment()
     sel.type(self.themeToTest.commentEditField, self.commentUser)
     sel.click(self.themeToTest.postCommentButton)
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     #assert comment presents on the page
     print 'Asserting the comment is on the page...'
     self.failUnless(sel.is_text_present(self.commentUser))
     print 'Going back on main page...'
     sel.open("/")
     print 'Logging out...'
     loginlogout.LogOut(self, sel)
Ejemplo n.º 18
0
def SubmitVideo(self, sel, video_url, theme, role):
    if role != "Admin" and role != "LoggedUser" and role != "UnloggedUser":
        self.fail(
            "Wrong value of role parameter passed to SubmitVideo subroutine")
    else:
        print "preparing to submit video: " + str(video_url) + "..."
        if theme == 0:  # Admin interface
            submitVideoButton = "//a[@href='/submit_video/']"
        elif theme == 4:  # Blue theme
            submitVideoButton = "//div[@id='nav']/ul/li[6]/a"
        else:  # Any other front page theme
            submitVideoButton = "//ul[@id='nav']/li[6]/a/span"
        print "Checking if 'Submit Video' button is accessible..."
        if sel.is_element_present(submitVideoButton) == False:
            mclib.AppendErrorMessage(self, sel,
                                     "Could not find 'Submit Video' button")
        else:
            print "OK. Clicking the button..."
            sel.click(submitVideoButton)
            if CheckTextPresent(self, sel, "Enter the URL of your video", 30,
                                "Time out") == False:
                mclib.AppendErrorMessage(
                    self, sel,
                    "Could not find the prompt to enter the video URL")
            else:
                "OK. Entering the video URL..."
                sel.type("id_url", video_url)
                sel.click("//input[@value='Submit']")
                time.sleep(5)
                # Retrieving and storing video attributes
                if sel.is_text_present(
                        'That video has already been submitted!'):
                    mclib.AppendErrorMessage(
                        self, sel,
                        'Duplication occurred - the video is already in the system (approved or awaiting moderation)'
                    )
                elif sel.is_element_present('submit_video') == False:
                    mclib.AppendErrorMessage(
                        self, sel,
                        "Could not find the expected pop-up with the video attributes"
                    )
                else:
                    print "OK. Reading the video attributes..."
                    video_title = ""
                    video_author = ""
                    video_date = ""
                    video_tags = ""
                    video_description = ""
                    if sel.is_element_present(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/h2/a"
                    ):
                        video_title = sel.get_text(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/h2/a"
                        )
                        print "Title: " + video_title
                    if sel.is_element_present(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/span/span[1]"
                    ):
                        video_author = sel.get_text(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/span/span[1]"
                        )
                        print "Author: " + video_author
                    if sel.is_element_present(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/span/span[2]"
                    ):
                        video_date = sel.get_text(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/span/span[2]"
                        )
                        print "Date: " + video_date
                    if sel.is_element_present(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/div[1]"
                    ):
                        video_tags = sel.get_text(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/div[1]"
                        )
                        print "Tags: " + video_tags
                    if sel.is_element_present(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/div[2]"
                    ):
                        video_description = sel.get_text(
                            "//form[@id='submit_video']/table/tbody/tr[1]/td/div/div[2]"
                        )
                        print "Description: " + video_description
#                if CheckTextPresent(self, sel, "You can also optionally add tags for the video (below).", 30, "ERROR: Time out")==False:
#                    mclib.AppendErrorMessage(self,sel,"Could not find the option to add tags for the video being submitted")
                    print "Now uploading the video..."
                    sel.click("//input[@value='Submit']")
                    # Checking that the video was submitted correctly
                    print "Checking that the video was submitted correctly..."
                    if role != "Admin":
                        time.sleep(10)
                        #checkMessage = CheckTextPresent(self, sel, "Thanks for submitting a video, our moderators will review it soon.", 30, "Moderation message not found")
                        if sel.is_text_present(
                                "Thanks for submitting a video, our moderators will review it soon."
                        ) == False:
                            mclib.AppendErrorMessage(
                                self, sel,
                                "Could not find the message: 'Thanks for submitting a video, our moderators will review it soon'"
                            )

                        else:
                            sel.click("css=div.overlay a.close")
                            time.sleep(2)
                            loginlogout.LogOut(self, sel)
                            loginlogout.LogInAsAdmin(self, sel)
                            print "Looking for the submitted video in the review queue..."
                            if queue.FindVideoInQueue(self, sel,
                                                      video_title) == [0, 0]:
                                mclib.AppendErrorMessage(
                                    self, sel,
                                    "Submitted video not found in the review queue"
                                )
                            else:
                                print "OK"
                    else:  # for Admin
                        sel.wait_for_page_to_load(
                            testvars.MCTestVariables["TimeOut"])
                        video_tags_list = ((video_tags.replace(
                            'Tags: ', '')).lower()).split(', ')
                        #                print video_tags_list
                        #                print [x for x in video_tags_list if sel.is_text_present(x)==True]
                        if sel.is_element_present(
                                "//a[text()='" + video_url +
                                "']") == False and sel.is_element_present(
                                    "//a[@href='" + video_url + "']") == False:
                            mclib.AppendErrorMessage(
                                self, sel, "Link to original video not found")
                        elif sel.is_text_present(video_title) == False:
                            mclib.AppendErrorMessage(self, sel,
                                                     "Video TITLE not found")
                        elif sel.is_text_present(video_author) == False:
                            mclib.AppendErrorMessage(self, sel,
                                                     "Video AUTHOR not found")
                        elif video_tags_list != [
                                x for x in video_tags_list
                                if sel.is_text_present(x) == True
                        ]:
                            # (Checking if every element of the list is present on the web page)
                            mclib.AppendErrorMessage(self, sel,
                                                     "Video TAGS not found")
                        elif sel.is_text_present(video_description) == False:
                            mclib.AppendErrorMessage(
                                self, sel, "Video DESCRIPTION not found")
                        else:
                            print "OK"
Ejemplo n.º 19
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")
Ejemplo n.º 20
0
def CheckRequireLoginToSubmitVideo(self,sel,theme):
    NavigateToSettingsPage(self,sel)
    print "Checking 'Require Users to Login to Submit a Video' check box..."
    if sel.is_element_present("id_display_submit_button")==False:
        mclib.AppendErrorMessage(self,sel,"Display 'Submit a Video' button check box not found")
    else:
        if sel.is_element_present("id_submission_requires_login")==False:
            mclib.AppendErrorMessage(self,sel,"'Require Users to Login to Submit a Video' check box not found")
        else:
            sel.check("id_display_submit_button")
            sel.check("id_submission_requires_login")
            sel.click("submit_settings")
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            sel.open(testvars.MCTestVariables["SettingsPage"])
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            # Go to Main Site
            #sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
            sel.open(testvars.MCTestVariables["TestSite"])
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            print "Logged as Admin - navigating to Home page"
            # Looking for Submit a Video button on the front pages - logged as Admin
            if theme==4:
                submitButton="link=Submit"        
                submitCaption="Submit"
            else:
                submitButton="//ul[@id='nav']/li[6]/a/span"
                submitCaption="Submit A Video"
            print "Logged as Admin: Checking Submit a Video button..."
            if sel.is_element_present(submitButton)==False or sel.get_text(submitButton)!=submitCaption:
                mclib.AppendErrorMessage(self,sel,"Logged as Admin: Submit a Video button was not found on the front pages")
            else:
                sel.click(submitButton)
                time.sleep(2)
                if sel.is_element_present("submit_video")==False:
                    mclib.AppendErrorMessage(self,sel,"Logged as Admin: Submit Video Pop-up did not appear")
                else:
                    #sel.click("//div[@id='submit_video']/div[1]")
                    sel.key_press("submit_video","\\27")           # Press Escape
                    print "OK"
            # Log out
            print "Logging out..."
            loginlogout.LogOut(self,sel)
            print "OK"
            print "Logged out: Checking Submit a Video button..."
            # Looking for Submit a Video button on the front pages - logged out
            if sel.is_element_present(submitButton)==False or sel.get_text(submitButton)!=submitCaption:
                mclib.AppendErrorMessage(self,sel,"Logged out: Submit a Video button was not found on the front pages")
            else:
                sel.click(submitButton)
                time.sleep(2)
                if sel.is_element_present("overlay")==False:
                    mclib.AppendErrorMessage(self,sel,"Logged out: Login Pop-up did not appear")
                else:
                    #sel.click("//div[@id='overlay']/div[1]")
                    sel.key_press("overlay","\\27")
                    print "OK"
            # Log in as user
            print "Logging in as User..."
            loginlogout.LogInAsUser(self,sel)
            print "OK"
            print "Logged as User: Checking Submit a Video button..."
            # Looking for Submit a Video button on the front pages - logged as User
            if sel.is_element_present(submitButton)==False or sel.get_text(submitButton)!=submitCaption:
                mclib.AppendErrorMessage(self,sel,"Logged as User: Submit a Video button was not found on the front pages")
            else:
                sel.click(submitButton)
                time.sleep(2)
                if sel.is_element_present("submit_video")==False:
                    mclib.AppendErrorMessage(self,sel,"Logged as User: Submit Video Pop-up did not appear")
                else:
                    #sel.click("//div[@id='submit_video']/div[1]")
                    sel.key_press("submit_video","\\27")
                    print "OK"
    def NotLogged_ModerationRequired(self):
        #click on the first video and post comment as not logged in user
        #print "Log--> Executing NotLogged_ModerationRequired()"
        sel = self.selenium
        print "Clicking on the first video on the page..."
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        self.bCommentNotLogged = 1
        print "Generating and posting new comment..."
        self.commentNotLogged = generateComment()
        sel.type(self.themeToTest.commentEditField, self.commentNotLogged)
        sel.type(self.themeToTest.posterNameEditField, "TestPoster")
        sel.click(self.themeToTest.postCommentButton)
        #wait until notification that comment was sent to moderators presents on the page
        print "Waiting for notification that comment was sent to moderators..."
        if (not WaitUntilTextOnTheScreen(sel, gCommentModerationText,
                                         gTimeOut)):
            print "ERROR: Notification that comment was sent to moderators is not on the page"
            self.failIf(True)
        else:
            print 'Text "', gCommentModerationText, '" is on the page'

        #login as admin and approve the comment that was sent in previous step
        print 'Logging in as Admin...'
        loginlogout.LogInAsAdmin(self, sel)
        print 'Opening Admin|Comments page and approving previously posted comment...'
        sel.click("link=View Admin")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click("link=Comments")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click('//tr[td="' + self.commentNotLogged +
                  '"]/td/div/form/input[@class="approve submit"]')
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])

        #assert comment is present on the page
        print 'Returning to the main page...'
        #        sel.click('link=View Main Site')
        sel.open(testvars.MCTestVariables["TestSite"])
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Logging out...'
        loginlogout.LogOut(self, sel)
        print "Clicking on the first video on the page..."
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Asserting the comment is on the page...'
        self.failUnless(sel.is_text_present(self.commentNotLogged))

        #-----
        #-----
        #-----

        print "Generating and posting a new comment..."
        #post new comment and assert if notification that comment was sent to moderators presents on the page
        self.comment = generateComment()
        sel.type(self.themeToTest.commentEditField, self.comment)
        sel.type(self.themeToTest.posterNameEditField, "TestPoster")
        sel.click(self.themeToTest.postCommentButton)
        print "Waiting for notification that comment was sent to moderators..."
        if (not WaitUntilTextOnTheScreen(sel, gCommentModerationText,
                                         gTimeOut)):
            print "ERROR: Notification that comment was sent to moderators is not on the page"
            self.failIf(True)
        else:
            print 'Text "', gCommentModerationText, '" is on the page'

        #login as admin and remove the comment that was sent in previous step
        print 'Logging in as Admin'
        loginlogout.LogInAsAdmin(self, sel)
        print 'Opening Admin|Comments and removing previously posted comment...'
        #        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click("link=View Admin")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click("link=Comments")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click('//tr[td="' + self.comment +
                  '"]/td/div/form/input[@class="remove submit"]')

        #assert comment is not present on the page
        print 'Going back on main page...'
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        #        sel.click('link=View Main Site')
        sel.open(testvars.MCTestVariables["TestSite"])
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Logging out...'
        sel.click('link=Logout seleniumTestAdmin')
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print "Clicking on the first video on the page..."
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Asserting the comment is not on the page...'
        self.failIf(sel.is_text_present(self.comment))
        print 'Going back on main page...'
        sel.open('/')
    def LoggedAsUser_ModerationRequired(self):
        #login as a User
        #print 'Log--> Executing LoggedAsUser_ModerationRequired()'
        sel = self.selenium
        print 'Logging in as User...'
        loginlogout.LogInAsUser(self, sel)
        #       LogIn(sel, gUserLogin, gUserPassword)
        #click on the first video and post a comment
        print 'Clicking on the first video on the page...'
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Generating and posting new comment...'
        self.commentUser = generateComment()
        sel.type(self.themeToTest.commentEditField, self.commentUser)
        sel.click(self.themeToTest.postCommentButton)
        #wait until notification that comment was sent to moderators presents on the page
        print "Waiting for notification that comment was sent to moderators..."
        if (not WaitUntilTextOnTheScreen(sel, gCommentModerationText,
                                         gTimeOut)):
            print "ERROR: Notification that comment was sent to moderators is not displayed on the page"
            self.failIf(True)
        else:
            print 'Text "', gCommentModerationText, '" is on the page'

        #logout
        print "Logging out..."
        loginlogout.LogOut(self, sel)
        #login as admin and approve the comment that was sent in previous step
        print 'Logging in as Admin...'
        loginlogout.LogInAsAdmin(self, sel)
        print 'Opening settings and approving a previously posted comment...'
        sel.click("link=View Admin")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click("link=Comments")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click('//tr[td="' + self.commentUser +
                  '"]/td/div/form/input[@class="approve submit"]')
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])

        #login as a user and assert that the comment is present on the page
        print "Going back on the main page..."
        #        sel.click('link=View Main Site')
        sel.open(testvars.MCTestVariables["TestSite"])
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print "Logging out..."
        loginlogout.LogOut(self, sel)
        print 'Logging in as User...'
        loginlogout.LogInAsUser(self, sel)
        #        LogIn(sel, gUserLogin, gUserPassword)
        print 'Clicking on the first video on the page...'
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Asserting the comment is on the page...'
        self.failUnless(sel.is_text_present(self.commentUser))

        #-----
        #-----
        #-----

        #generate and post new comment
        print 'Generating and posting a new comment...'
        self.comment = generateComment()
        sel.type(self.themeToTest.commentEditField, self.comment)
        sel.click(self.themeToTest.postCommentButton)
        #wait until notification that comment was sent to moderators presents on the page
        print "Waiting for notification that comment was sent to moderators..."
        if (not WaitUntilTextOnTheScreen(sel, gCommentModerationText,
                                         gTimeOut)):
            print "ERROR: Notification that comment was sent to moderators is not on the page"
            self.failIf(True)
        else:
            print 'Text "', gCommentModerationText, '" is on the page'

        #logout
        print "Logging out..."
        loginlogout.LogOut(self, sel)
        #login as admin and remove the comment that was sent in previous step
        print 'Logging in as Admin...'
        loginlogout.LogInAsAdmin(self, sel)
        print 'Opening Admin|Comments and removing a previously posted comment...'
        sel.click("link=View Admin")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click("link=Comments")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        sel.click('//tr[td="' + self.comment +
                  '"]/td/div/form/input[@class="remove submit"]')

        #assert comment does not present on the page
        print "Going back on the main page..."
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        #        sel.click('link=View Main Site')
        sel.open(testvars.MCTestVariables["TestSite"])
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print "Logging out"
        loginlogout.LogOut(self, sel)
        print 'Clicking on the first video on the page...'
        sel.click(self.themeToTest.firstVideoOnPage)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        print 'Asserting the comment is on the page...'
        self.failIf(sel.is_text_present(self.comment))
        sel.open('/')