def test_ClearQueue_511(self):
        sel = self.selenium
        loginlogout.LogInAsAdmin(self,sel)
        # Memorizing 
        videosRejected = queue.ClearQueue(self,sel)
        # Check that videos were rejected
        print "Checking that videos were successfully rejected..."
        # At present, it is technically impossible to check the status for
        # every video on the rejected page because of an issue with
        # Bulk Edit page (5 or 6 are the viable limit)
        # As a temporary solution until the issue is resolved,
        # just three videos will be checked - the first, the last, and one
        # from the middle
        print "Looking up the following videos:"
        last = len(videosRejected)-1
        videosToCheck = [videosRejected[0],videosRejected[last/2],videosRejected[last]]
        print videosToCheck
        # Searching each selected video in the list of Rejected videos 
        # on Bulk Edit page
        for item in videosToCheck:
            if item!="None":
                newResult=queue.CheckVideoStatus(self,sel,item,"Rejected")
                print item+"__________"+str(newResult)
                if newResult==False:
                    mclib.AppendErrorMessage(self,sel,"Could not find video "+item+" in the list of rejected videos.")
                sel.click(testvars.MCUI["AdminReviewQueue"])
#                sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
                sel.open(testvars.MCTestVariables["TestSite"])
                sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
                sel.click(testvars.MCTestVariables["ViewAdmin"])
                sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            else:
                print "None__________None"
Ejemplo n.º 2
0
 def test_SubmitDuplicateVideo_475(self):
     sel = self.selenium
     # Log in as an Administrator
     loginlogout.LogInAsAdmin(self, sel)
     theme = 1  # List theme
     sitesettings.ChangeTheme(self, sel, theme)
     sitesettings.UncheckRequireLoginToSubmitVideo(self, sel)
     # Set video parameters
     testVideoURL = "http://www.youtube.com/watch?v=QIQwMwesb0w"
     testVideoTitle = "Miro Demo"
     titleUnicode = unicode(testVideoTitle)
     # Check if the video is in the premoderation queue ("Unapproved")
     print "Looking for the video " + testVideoTitle + " in the premoderation queue"
     if queue.FindVideoInQueue(self, sel, testVideoTitle) != [0, 0]:
         print "Found the video in the premoderation queue"
         for theme in range(1, 2):
             TestCase_SubmitDuplicateVideo_475.ChangeThemeAndSubmitDuplicateVideo(
                 self, sel, theme, testVideoURL)
     else:
         print "Could not find the video in the premoderation queue"
         # Check if the video is in the current ("Approved") set of videos
         if queue.CheckVideoStatus(self, sel, testVideoTitle,
                                   "Approved") == False:
             print "Could not find the video among the approved videos"
             self.fail(
                 "The test case demands that a copy of the video already existed in the system. Cannot continue now."
             )
         else:
             print "Found the video among the approved videos"
             for theme in range(1, 2):
                 TestCase_SubmitDuplicateVideo_475.ChangeThemeAndSubmitDuplicateVideo(
                     self, sel, theme, testVideoURL)
Ejemplo n.º 3
0
def RejectVideoFromApproved(self, sel, title):
    sel.open(testvars.MCTestVariables["ReviewQueuePage"])
    sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
    if queue.CheckVideoStatus(self, sel, title, "Approved") == True:
        print "Duplicate video found - preparing to delete it..."
        sel.set_timeout(300000)
        sel.open(testvars.MCTestVariables["BulkEditPage"])
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        trimmedTitle = mclib.split_by_punctuation_char(title)
        #    print title
        #    print trimmedTitle
        sel.type("q", trimmedTitle)
        sel.click("//div[@id='labels']/form[1]/button")
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        if sel.is_text_present(title) == True:  # found video?
            row = 1
            titleElement = "//div[@id='labels']/form[2]/table/tbody/tr[" + str(
                row) + "]/td[2]/span"
            while sel.is_element_present(titleElement):
                tempTitle = sel.get_text(titleElement)
                if tempTitle == title:
                    break
                row = row + 1
                titleElement = "//div[@id='labels']/form[2]/table/tbody/tr[" + str(
                    row) + "]/td[2]/span"
            if tempTitle == title:
                deleteElement = "//div[@id='labels']/form[2]/table/tbody/tr[" + str(
                    row) + "]/td[2]/div/a[2]"
                sel.click(deleteElement)
                sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        else:
            mclib.AppendErrorMessage(self, sel,
                                     "Query did not return the video " + title)
            print "Also tried searching by: " + trimmedTitle
            self.fail("Cannot proceed with the test scenario")
Ejemplo n.º 4
0
 def EditTitle(self, sel, theme):
     # Selecting video No. <theme> from New Videos listing
     videoTitleLink = videopage.PickVideoFromNewVideosListingPage(
         self, sel, theme)
     videoTitle = sel.get_text(videoTitleLink)
     print "Opening video page for video " + videoTitle + "..."
     sel.click(videoTitleLink)
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     newTitle = "test title"
     print "Replacing the existing title with " + newTitle
     videopage.InlineEditTitle(self, sel, theme, newTitle)
     if queue.CheckVideoStatus(self, sel, newTitle, "Approved") == True:
         print "OK, test passed"
         print "Restoring the original title..."
         sel.open(testvars.MCTestVariables["NewVideosListingPage"])
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
         sel.click(videoTitleLink)
         sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
         videopage.InlineEditTitle(self, sel, theme, videoTitle)
     else:
         print "Oops, test failed"
         mclib.AppendErrorMessage(
             self, sel,
             "Could not find the video in the list of approved videos")
    def test_SearchVideoByNonASCIITerm_261(self):
        sel = self.selenium
        loginlogout.LogInAsAdmin(self, sel)
        searchterm = u"\u0442\u0443\u0440\u0438\u0437\u043C"  #'tourism' in Cyrillic alphabet
        #        searchterm = u"\u0414\u0443\u0431\u0440\u043E\u0432\u043D\u0438\u043A"  #'Dubrovnik' in Cyrillic alphabet
        sortby = 1  # sort by Relevance
        if sources.SearchForVideos(self, sel, searchterm, sortby) == 0:
            print "0 videos found - cannot approve, feature or add to queue items"
        else:
            # Approve video No.1
            video1title = sel.get_text(
                "//div[@id='admin_videolisting_row']/div[1]/div[1]/h3/a")
            print "Approving video \"" + video1title + "\"..."
            approveLink = "//div[@id='admin_videolisting_row']/div[1]/div[2]/a[2]/span"
            if sel.is_element_present(approveLink) == True:
                sel.click(approveLink)
                time.sleep(10)
                print "OK"
            else:
                mclib.AppendErrorMessage(
                    self, sel, "Approve link not found for the video")
            # Feature video No.2 (as video 1 disappears from the list, )
            video2title = sel.get_text(
                "//div[@id='admin_videolisting_row']/div[1]/div[1]/h3/a")
            print "Featuring video \"" + video2title + "\"..."
            featureLink = "//div[@id='admin_videolisting_row']/div[1]/div[2]/a[1]/span"
            if sel.is_element_present(featureLink) == True:
                sel.click(featureLink)
                time.sleep(5)
                #sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
                print "OK"
            else:
                mclib.AppendErrorMessage(
                    self, sel, "Feature link not found for the video")
            # Add to Queue video No.3
            video3title = sel.get_text(
                "//div[@id='admin_videolisting_row']/div[1]/div[1]/h3/a")
            print "Adding video \"" + video3title + "\" to the queue..."
            queueLink = "//div[@id='admin_videolisting_row']/div[1]/div[2]/a[3]/span"
            if sel.is_element_present(queueLink) == True:
                sel.click(queueLink)
                time.sleep(5)
                print "OK"
            else:
                mclib.AppendErrorMessage(
                    self, sel, "Add to Queue link not found for the video")

            #Checking the new videos in the lists
            #Searching for the approved video
            queue.CheckVideoStatus(self, sel, video1title, "Approved")

            # Navigate to Manage Sources page to prevent freezing if the script
            sel.click(testvars.MCUI["AdminManageSources"])
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])

            print " "
            #Searching for the featured video
            queue.CheckVideoStatus(self, sel, video2title, "Featured")

            print ""
            print "Searching for the video in the queue..."
            # Looking for the last page in the queue
            try:
                sel.open(testvars.MCTestVariables["ReviewQueuePage"] +
                         "/?page=1000000")
                sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            except:
                pass
            if sel.is_element_present(
                    "//a[contains(text(),video3title)]") == True:
                print "Found video \"" + video3title + "\" in the queue on the last page - OK"
            else:
                mclib.AppendErrorMessage(
                    self, sel, "Could not find video " + video3title +
                    " on the last page of the queue")
def InlineManageVideo(self, sel, theme, action):
    if action == "Feature":
        if theme != 4: ActionLink = "Feature this video"
        else: ActionLink = "Feature this Video"
    elif action == "Unfeature":
        if theme != 4: ActionLink = "Unfeature this video"
        else: ActionLink = "Unfeature this Video"
    elif action == "Reject":
        if theme != 4: ActionLink = "Reject this video"
        else: ActionLink = "Reject this Video"
    elif action == "Approve":
        if theme != 4: ActionLink = "Approve this video"
        else: ActionLink = "Approve this Video"
    else:
        mclib.AppendErrorMessage(
            self, sel, "Wrong parameter passed to InlineManageVideo procedure")
    if sel.is_element_present(
            "link=" +
            ActionLink) == 0:  # Action button not found on the video page
        mclib.AppendErrorMessage(self, sel,
                                 "'" + ActionLink + "' button is missing")
        # self.fail("Impossible to carry on with the test")
        return False
    else:
        # Memorize the video title
        if theme != 4:
            titleCaption = "//div[@id='main']/div[1]/div/div/div[1]/h2"
        else:
            titleCaption = "css=h2.edit_click"  #"//div[@id='view_video']/div[3]/div[1]/div/div[1]/h2"
        titleUntrimmed = sel.get_text(titleCaption)
        title = titleUntrimmed.replace(' Edit', '')
        print "Going to " + action + " video: " + title
        print "Clicking the button..."
        sel.click("link=" + ActionLink)  # Click Action button
        time.sleep(5)
        sel.refresh()
        time.sleep(5)
        #        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        if sel.is_element_present(
                "link=" +
                ActionLink) != 0:  # Action button must have disappeared
            mclib.AppendErrorMessage(
                self, sel, "'" + action +
                "' button is still present on the page, though it should not")
            return False
        else:
            print "OK"
            print "Verifying that the video has actually been " + action + "d..."
            if action == "Feature":
                blCheckResult = queue.CheckVideoStatus(self, sel, title,
                                                       "Featured")
            if action == "Unfeature":
                blCheckResult = not (queue.CheckVideoStatus(
                    self, sel, title, "Featured"))
            if action == "Reject":
                blCheckResult = queue.CheckVideoStatus(self, sel, title,
                                                       "Rejected")
            if action == "Approve":
                blCheckResult = queue.CheckVideoStatus(self, sel, title,
                                                       "Approved")
            time.sleep(3)
            if action != "Reject":
                print "Rejecting the " + action + "d video..."
                bulkedit.DeleteVideo(self, sel, title)
                return blCheckResult
            else:
                print "Approving the rejected video..."
                bulkedit.ApproveRejectedVideo(self, sel, title)
                return blCheckResult