コード例 #1
0
 def test_AddEditorsComment(self):
     sel = self.selenium
     #       Log in as Admin
     loginlogout.LogInAsAdmin(self, sel)
     theme = 4  # The feature is available for Blue theme only
     print "Changing theme..."
     sitesettings.ChangeTheme(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"])
     #        newEditorsComment = "<b>TEST</b>"
     newEditorsComment = r"<p><b>Why use MiroCommunity?</b></p>"
     newEditorsComment = newEditorsComment + "<p><b><i>Leverage Existing Video</i></b> Your community already has "
     newEditorsComment = newEditorsComment + "a LOT of relevant video floating around on the internet. "
     newEditorsComment = newEditorsComment + "<b>Miro Community</b> can aggregate it all in one central location. "
     newEditorsComment = newEditorsComment + "Videos can be created by you or your organization, but can also easily "
     newEditorsComment = newEditorsComment + "be brought in from a broader pool of creators. Videos can come from "
     newEditorsComment = newEditorsComment + "YouTube, blip.tv, Vimeo, or almost any video blog or site powered by "
     newEditorsComment = newEditorsComment + "drupal, plone, or other CMS that creates a media RSS feed.</p>"
     newEditorsComment = newEditorsComment + "<b><i>A Video-Centric Approach</i></b> Put video front and center. The most successful "
     newEditorsComment = newEditorsComment + "video sites are centered around the videos; for example, <a href='www.youtube."
     newEditorsComment = newEditorsComment + "com'>YouTube</a>, Hulu, and the TED conference. These sites have regular "
     newEditorsComment = newEditorsComment + "viewers/visitors who come expecting entertainment, enrichment, and engagement. "
     newEditorsComment = newEditorsComment + "Miro Community makes video easy to find, and lets you point people directly "
     newEditorsComment = newEditorsComment + "to the content they are looking for.</p>"
     print "Posting the Editor's comment: " + newEditorsComment
     videopage.PostEditorsComment(self, sel, newEditorsComment)
コード例 #2
0
 def PostToTwitter(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"])
     print "Posting the video on Twitter..."
     videopage.PostToTwitter(self, sel, theme)
コード例 #3
0
 def EditWebsite(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"])
     newWebsite = "http://www.mirocommunity.org/"
     print "Changing the website to: " + newWebsite
     videopage.InlineEditWebsite(self, sel, theme, newWebsite)
コード例 #4
0
 def EditPublicationDate(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"])
     newDate = "2010-01-01 23:59:59"  #Format: yyyy-mm-dd hh:mm:ss
     print "Replacing the existing date with " + newDate
     videopage.InlineEditPublicationDate(self, sel, theme, newDate)
コード例 #5
0
 def EditTags(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"])
     newTag = "TestWithTheme" + str(theme)
     print "Changing the tag to: " + newTag
     videopage.InlineEditTags(self, sel, theme, newTag)
コード例 #6
0
 def AddToPlaylist(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"])
     playlist = "Test " + str(theme) + " " + time.strftime(
         "%d-%m-%Y %H:%M:%S", time.localtime())
     print "Adding the video to playlist " + playlist + "..."
     videopage.AddToPlaylist(self, sel, theme, playlist)
コード例 #7
0
 def EditCategory(self, sel, theme):
     # Selecting video No. <theme> from New Videos listing
     videoTitleLink = videopage.PickVideoFromNewVideosListingPage(self,
                                                                  sel,
                                                                  theme=1)
     videoTitle = sel.get_text(videoTitleLink)
     print "Opening video page for video " + videoTitle + "..."
     sel.click(videoTitleLink)
     sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
     newCategory = testvars.newCategories[theme - 1]
     print "Changing the category to: " + newCategory
     videopage.InlineEditCategory(self, sel, theme, newCategory)
コード例 #8
0
 def EditAuthor(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"])
     # The current author for the video will be replaced with a test user
     newAuthor = testvars.MCTestVariables["UserName"]
     print "Replacing the existing date with " + newAuthor
     videopage.InlineEditAuthor(self, sel, theme, newAuthor)
コード例 #9
0
 def DeleteComment(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"])
     temp_comment = testcases_comments.generateComment()
     print "Posting a test comment..."
     videopage.PostComment(self, sel, theme, temp_comment)
     print "Deleting the test comment"
     videopage.DeleteComment(self, sel, theme, temp_comment)
コード例 #10
0
    def EmailToFriends(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"])
        videoPageURL = sel.get_location()
        print "Mailing the link to video to friends..."
        videopage.EmailToFriends(self, sel, theme,
                                 testvars.MCTestVariables["TestEmail"])
        time.sleep(10)
        print "Checking the last email in the inbox..."
        mailUser = testvars.MCTestVariables["TestEmail"]
        mailPassword = testvars.MCTestVariables["TestEmailPassword"]
        mail = imaplib.IMAP4_SSL('imap.gmail.com', 993)
        mail.login(mailUser, mailPassword)
        mail.select('Inbox')
        result, data = mail.search(None, "ALL")
        ids = data[0]  # data is a list.
        id_list = ids.split()  # ids is a space separated string
        latest_email_id = id_list[-1]  # get the latest
        result, data = mail.fetch(
            latest_email_id,
            "(RFC822)")  # fetch the email body (RFC822) for the given ID
        emailHeader = HeaderParser().parsestr(data[0][1])
        print "Email sender: " + emailHeader['From']
        print "Email subject: " + emailHeader['Subject']
        if emailHeader['From'] != "Miro Community <*****@*****.**>":
            mclib.AppendErrorMessage(self, sel, "Unexpected mail sender found")
        elif not (videoTitle in data[0][1]):
            mclib.AppendErrorMessage(self, sel,
                                     "Video title not found in email")
            print "Video title: " + videoTitle
            print data[0][1]
#        elif not('href=3D"'+videoPageURL+'"' in data[0][1]):
#        elif not(videoPageURL in data[0][1]):
#            mclib.AppendErrorMessage(self,sel,"Link to video not found")
#            print "Link to video: "+videoPageURL
#            print data[0][1]
        else:
            print "OK"


#        print 'Message %s\n%s\n' % (latest_email_id, data[0][1])
        mail.close()
        mail.logout()
コード例 #11
0
    def UpdateThumbnail(self, sel, theme):
        # Selecting video No. <theme> from New Videos listing
        videoTitleLink = videopage.PickVideoFromNewVideosListingPage(
            self, sel, theme)
        videoTitle = sel.get_text(videoTitleLink)

        print "Step A. Upload thumbnail from YouTube"
        print "Opening the video page for video " + videoTitle + " ..."
        #        sel.click("css = div#content div.video:nth(0) > a.thumbnail > img")

        #        imageSrc = sel.get_attribute("//div[@id='content']/div["+videoNumber+"]/a/img@src")
        #        image1 = Image.open(urlib.urlopen(imageSrc))
        sel.click(videoTitleLink)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        YouTubeThumbURL = "http://img.youtube.com/vi/qzotQbR0GC0/0.jpg"
        initialThumbURL = videopage.GetThumbnailURL(self, sel)
        print initialThumbURL
        videopage.ChangeThumbnail(self, sel, theme, YouTubeThumbURL, "")
        sel.open(testvars.MCTestVariables["NewVideosListingPage"])
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        #        imageSrc = sel.get_attribute("//div[@id='content']/div["+videoNumber+"]/a/img@src")
        #        image2 = Image.open(urlib.urlopen(imageSrc))
        #        if ImageChop.difference(image2,image1) == None:
        #            mclib.AppendErrorMessage(self,sel,"The thumbnail has not changed")
        print ""

        print "Step B. Upload an image from TestInput folder"
        print "Opening the video page for video " + videoTitle + " ..."
        sel.click("link=" + videoTitle)
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        fileNewImage = "background" + str(theme) + ".jpg"
        thumbnailFile = os.path.join(
            testvars.MCTestVariables["GraphicFilesDirectory"], fileNewImage)
        videopage.ChangeThumbnail(self, sel, theme, "", thumbnailFile)
        print ""

        if initialThumbURL != "":
            print "Step C. Restore the initial thumbnail"
            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.ChangeThumbnail(self, sel, theme, initialThumbURL, "")
コード例 #12
0
    def EditDescription(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"])

        newDescription = r'<h1>Advantages of Miro Community</h1><ul><li>Run a beautiful video '
        newDescription = newDescription + 'presentation website on your own domain, without having to maintain the software.</li>'
        newDescription = newDescription + '<li>Works with your existing video hosting setup and workflow - no need to re-post '
        newDescription = newDescription + 'videos.</li> <li>Works with free video hosting services, if you do not already have '
        newDescription = newDescription + 'videos online.</li> <li>Lets you bring together videos from a wide-variety of hosts and '
        newDescription = newDescription + 'sources, into one curated experience.</li><li>Automatically import and publish RSS feeds '
        newDescription = newDescription + 'of videos from any source.</li> <li>Create a discussion space for video about your '
        newDescription = newDescription + 'community; strengthen your relationships with your community.</li><li>Runs on open-source '
        newDescription = newDescription + 'software.</li></ul>'
        #        newDescription = 'test Oct7'
        print "Updating the description with the following text: "
        print newDescription
        videopage.InlineEditDescription(self, sel, theme, newDescription)
コード例 #13
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")