コード例 #1
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)
コード例 #2
0
 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)
コード例 #3
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)
コード例 #4
0
 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)
コード例 #5
0
 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"
コード例 #6
0
    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('/')
コード例 #7
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"