def PostEditorsComment(self, sel, editorscomment):
    linkEditorsComment = "css=div.main > div.editable > div.display_data > a.edit_link"
    dialogEditorsComment = "css=div.main > div.editable > div.simple_overlay > h2:contains('Editing Editors comment')"
    sel.click(linkEditorsComment)
    time.sleep(5)
    if sel.is_visible(dialogEditorsComment) != True:
        mclib.AppendErrorMessage(
            self, sel, "Dialog for posting the editors comment was not found")
    else:
        sel.type("id=id_editors_comment", editorscomment)
        sel.click("css=button.done")
        time.sleep(3)
        print "Done"
        print "Checking that the website URL has been updated correctly..."
        #        linkEditorsComment = "css=div.description:nth-child(1)"
        linkEditorsComment = "css=div.editors_notes"
        str = sel.get_text(linkEditorsComment)
        postedComment = re.split("writes: ", str.replace("\n", ""))
        #        print postedComment
        if postedComment[1] != mclib.remove_html_tags(editorscomment):
            mclib.AppendErrorMessage(
                self, sel,
                "The Editor's Comment has not been updated as expected")
            print "Expected value: " + mclib.remove_html_tags(editorscomment)
            print "- Actual value: " + postedComment[1]
        else:
            print "OK - test passed"
def InlineEditDescription(self, sel, theme, newdescription):
    if theme == 4:
        linkEditDescription = "css=div.editable > div.display_data > h4.meta_title > a.edit_link"
        dialogEditDescription = "css=div.simple_overlay:contains('Editing Description')"
    else:
        linkEditDescription = "css=div.editable > div.display_data > h4.meta_title > a.edit_link"
        dialogEditDescription = "css=div#main > div.editable > div.simple_overlay > h2"
    print "Editing the description..."
    sel.click(linkEditDescription)
    time.sleep(5)
    if sel.is_visible(dialogEditDescription) != True:
        mclib.AppendErrorMessage(
            self, sel,
            "Dialog for inline editing of the description was not found")
    else:
        sel.type("id=id_description", newdescription)
        sel.click("css=button.done")
        time.sleep(3)
        print "Done"
        print "Checking that the description has been updated correctly..."
        linkDescription = "css=div.editable > div.display_data > div.description"
        updatedDescription = sel.get_text(linkDescription)
        if updatedDescription != mclib.remove_html_tags(newdescription):
            mclib.AppendErrorMessage(
                self, sel, "The description has not been updated as expected")
            print "Expected value: " + mclib.remove_html_tags(newdescription)
            print "- Actual value: " + updatedDescription
        else:
            print "OK - test passed"
예제 #3
0
def InlineEditDescription(self,sel,theme,newdescription):
    if theme==4:
        linkEditDescription = "css=div.editable > div.display_data > h4.meta_title > a.edit_link"
        dialogEditDescription = "css=div.simple_overlay:contains('Editing Description')"
    else:
        linkEditDescription = "css=div.editable > div.display_data > h4.meta_title > a.edit_link"
        dialogEditDescription = "css=div#main > div.editable > div.simple_overlay > h2"
    print "Editing the description..."
    sel.click(linkEditDescription)
    time.sleep(5)
    if sel.is_visible(dialogEditDescription)!=True:
        mclib.AppendErrorMessage(self,sel,"Dialog for inline editing of the description was not found")
    else:
        sel.type("id=id_description", newdescription)
        sel.click("css=button.done")
        time.sleep(3)
        print "Done"
        print "Checking that the description has been updated correctly..."
        linkDescription = "css=div.editable > div.display_data > div.description"
        updatedDescription = sel.get_text(linkDescription)
        if updatedDescription != mclib.remove_html_tags(newdescription):
            mclib.AppendErrorMessage(self,sel,"The description has not been updated as expected")
            print "Expected value: "+mclib.remove_html_tags(newdescription)
            print "- Actual value: "+updatedDescription
        else:
            print "OK - test passed"
예제 #4
0
def ModifyOrganizationSettings(self,sel,theme):
    NavigateToSettingsPage(self,sel)
    vSideBarBlurb = r'The<i style = "color: red"> Miro Guide</i>, our open content directory, '
    vSideBarBlurb = vSideBarBlurb + r'is browsed by a large and global audience of Miro users '
    vSideBarBlurb = vSideBarBlurb + r'and is also available in any web browser at miroguide.com. '
    vSideBarBlurb = vSideBarBlurb + r'Your media will be showcased with a wide variety of content, '
    vSideBarBlurb = vSideBarBlurb + r'ranging from mainstream (HBO, ABC, NBC), to professionally '
    vSideBarBlurb = vSideBarBlurb + r'produced web content ( Revision3, Next New Networks, Rocketboom), '
    vSideBarBlurb = vSideBarBlurb + r'to public broadcasting (PBS, NPR, LinkTV, Democracy Now!), to '
    vSideBarBlurb = vSideBarBlurb + r'completely independent video feeds. ' + \
time.strftime("%d-%m-%Y %H:%M:%S", time.localtime())
    vFooterBlurb = r'<i style = "color: red">Miro</i> works best when there you have got '
    vFooterBlurb = vFooterBlurb + r'an RSS feed. If that sounds confusing, do not worry, many services '
    vFooterBlurb = vFooterBlurb + r'create an RSS feed automatically (blip.tv, YouTube, Google Video, '
    vFooterBlurb = vFooterBlurb + r'and many others). Try out this web app to see if you have already '
    vFooterBlurb = vFooterBlurb + r'got one. ' + time.strftime("%d-%m-%Y %H:%M:%S", time.localtime())
    sel.type("id_sidebar_html", vSideBarBlurb)
    sel.type("id_footer_html", vFooterBlurb)
    sel.click("submit_settings")
    sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
    print "Changed organization settings (SideBarBlurb, FooterBlurb)"
    # ------ Workaround for blank page bug
    sel.open(testvars.MCTestVariables["CategoriesPage"])
    sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
    
# Check footbar at the administrator interface - UPDATE: FOOTER REMOVED FROM ADMIN PAGES
    elementFooterBlurb="//div[@id='footer']/div[1]"
#    if sel.is_element_present(elementFooterBlurb)==True:
#        if mclib.remove_html_tags(sel.get_text(elementFooterBlurb))!=mclib.remove_html_tags(vFooterBlurb):
#            self.verificationErrors.append("Wrong Footer blurb text on About page.")
#            print testvars.preE+"Wrong Footer blurb text in Administrator interface"
#            print "Expected text is " + mclib.remove_html_tags(vFooterBlurb)
#            print "- Actual text is "+mclib.remove_html_tags(sel.get_text(elementFooterBlurb))
#    else:
#        self.verificationErrors.append("Footer blurb is not present in Administrator interface")
#        print testvars.preE+"Footer blurb is not present in Administrator interface"
    
# Check at the Main site
    #sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
    sel.open(testvars.MCTestVariables["TestSite"])
    sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
    #SideBarBlurb is displayed only on List Theme (No.1)
    elementSideBarBlurb="about"
    if sel.is_element_present(elementSideBarBlurb)==True:
        if mclib.remove_html_tags(sel.get_text(elementSideBarBlurb))!=mclib.remove_html_tags(vSideBarBlurb):
            self.verificationErrors.append("Wrong SideBar blurb text on the Main site.")
            print testvars.preE+"Wrong SideBar blurb text the Main site"
            print "Expected text is " + mclib.remove_html_tags(vSideBarBlurb)
            print "- Actual text is "+mclib.remove_html_tags(sel.get_text(elementSideBarBlurb))
# Check at the About page
    sel.open("/about/")
    self.verificationErrors.append("Footer blurb is not present on About page")
    print testvars.preE+"Footer blurb is not present on About page"
예제 #5
0
def PostEditorsComment(self,sel,editorscomment):
    linkEditorsComment = "css=div.main > div.editable > div.display_data > a.edit_link"
    dialogEditorsComment = "css=div.main > div.editable > div.simple_overlay > h2:contains('Editing Editors comment')"
    sel.click(linkEditorsComment)
    time.sleep(5)
    if sel.is_visible(dialogEditorsComment)!=True:
        mclib.AppendErrorMessage(self,sel,"Dialog for posting the editors comment was not found")
    else:
        sel.type("id=id_editors_comment", editorscomment)
        sel.click("css=button.done")
        time.sleep(3)
        print "Done"
        print "Checking that the website URL has been updated correctly..."
#        linkEditorsComment = "css=div.description:nth-child(1)"
        linkEditorsComment = "css=div.editors_notes"
        str = sel.get_text(linkEditorsComment)
        postedComment = re.split("writes: ",str.replace("\n",""))
#        print postedComment
        if postedComment[1] != mclib.remove_html_tags(editorscomment):
            mclib.AppendErrorMessage(self,sel,"The Editor's Comment has not been updated as expected")
            print "Expected value: "+mclib.remove_html_tags(editorscomment)
            print "- Actual value: "+postedComment[1]
        else:
            print "OK - test passed"
예제 #6
0
def AddCategory(self,sel,cat,slug,description,sub,parent):
    #Check if the parent category is available
    if (sub==1) and (parent!=""):
        if CategoryRow(self,sel,parent)==0:
            print parent+" category not found. Cannot create subcategory "+cat
            return 0
    # If the new category is a subcategory, prepend its name with an em dash in Unicode
    if sub==1:
        testCat=u'\u2014'+cat
    else:
        testCat=cat
    #Check if the category already exists
    if CategoryRow(self,sel,testCat)!=0:
        print testCat+" category already exists. Skipping add category procedure"
        return 0
    else:
        print "Adding a new category "+testCat
#        sel.open(testvars.MCTestVariables["CategoriesPage"])
#        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
#        buttonAddCategory = "//div[@id='content']/a/span"
        buttonAddCategory = "css=a.add"
        if sel.is_element_present(buttonAddCategory)==True:
            sel.click(buttonAddCategory)
            time.sleep(3)
            if sel.is_visible("//div[@id='label_sidebar']")==False:
                self.verificationErrors.append("Add category pop-up does not display")
                print testvars.preE+"Add category pop-up does not display"
            else:
                # Enter category name
                if sel.is_element_present("id_name")==True:
                    sel.click("id_name")
                    #sel.type_keys("id_name", cat)
                    sel.type("id_name",cat) #A workaround for a known bug in Selenium, which prevents some
                                            # characters from being typed
                else:
                    self.verificationErrors.append("Edit field for category name not found")
                    print testvars.preE+"Edit field for category name not found"
                # Enter category slug
                if sel.is_element_present("id_slug")==True:
                    if slug!="":
                        testSlug = slug
                    else:
                        testSlug = cat
                    sel.type("id_slug", testSlug)
                else:
                    self.verificationErrors.append("Edit field for category slug not found")
                    print testvars.preE+"Edit field for category slug not found"
                # Enter category description
                if sel.is_element_present("id_description")==True:
                    if description=="":
                        testDescription = "<b>" + cat + "</b> is the description of this item"
                    else:
                        testDescription = description
                    sel.type("id_description", testDescription)
                else:
                    mclib.AppendErrorMessage(self,sel,"Edit field for category description not found")
                    print testvars.preE+"Edit field for category description not found"
                # Check if it is a subcategory; if yes, specify parent
                if sub==1:
                    listCategoryParent="id_parent"
                    if sel.is_element_present(listCategoryParent)==True:
                        sel.select("id_parent", parent)
                    else:
                        self.verificationErrors.append("List of available parent categories not found")
                        print testvars.preE+"List of available parent categories not found"
                # Save changes
                buttonSubmit = "submit"
                if sel.is_element_present(buttonSubmit)==True:
                    sel.click("submit")
                    time.sleep(5)
                else:
                    mclib.AppendErrorMessage(self,sel,"Save button on Add Category pop-up not found")
#        sel.refresh()
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Check if the new category is present in the list
        rowNo = CategoryRow(self,sel,testCat)
        if rowNo==0:   # not found
            mclib.AppendErrorMessage(self,sel,testCat+" category was not added to the list")
        else:
            labelDescription = "//div[@id='labels']/form/table/tbody/tr["+str(rowNo)+"]/td[3]"
            labelSlug = "//div[@id='labels']/form/table/tbody/tr["+str(rowNo)+"]/td[4]"
            #Check category description
            if sel.is_element_present(labelDescription)!=True:
                mclib.AppendErrorMessage(self,sel,"Category description not found")
            elif sel.get_text(labelDescription)!=mclib.remove_html_tags(testDescription):
                mclib.AppendErrorMessage(self,sel,"Wrong category description text displayed")
                print "Expected category description: "+mclib.remove_html_tags(testDescription)
                print "- Actual category description: "+sel.get_text(labelDescription)
            #Check category slug
            if sel.is_element_present(labelSlug)!=True:
                mclib.AppendErrorMessage(self,sel,"Category slug not found")
            elif sel.get_text(labelSlug)!=testSlug:
                mclib.AppendErrorMessage(self,sel,"Wrong category slug text displayed")
                print "Expected category slug: "+testSlug
                print "- Actual category slug: "+sel.get_text(labelSlug)
        return 1
예제 #7
0
def EditAboutUs(self,sel,theme,newabouttext):
    NavigateToSettingsPage(self,sel)
# Type the values into edit fields
    if sel.is_element_present("id_about_html")==False:
        mclib.AppendErrorMessage(self,sel,"About Us edit field not found")
    else:
        sel.click("id_about_html")
        sel.type("id_about_html", newabouttext)
        if sel.is_element_present("submit_settings")==False:
            mclib.AppendErrorMessage(self,sel,"Save Changes button not found")
        else:
            # Click Save
            sel.click("submit_settings")
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
    # ------ Workaround for blank page bug
            sel.open(testvars.MCTestVariables["CategoriesPage"])
            time.sleep(3)
            sel.open(testvars.MCTestVariables["SettingsPage"])
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
    # --------- End of workaround insert
            print "Changed About Us text to: "+newabouttext
        
            # Click View Main Site
            #sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
            sel.open(testvars.MCTestVariables["TestSite"])
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            # CHECK ABOUT PAGE
            # Navigate to About page
            sel.open("/about")
            sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
            # Verify About text
            print "Verifying About Us text..."
            trimmedAboutText = mclib.remove_html_tags(newabouttext)
#            print trimmedAboutText
            mainText = str(sel.get_text("//div[@id='main']"))
            #for i in mainText:
            #    print str(ord(i))+","
            if theme==4:
                elementAbout="//div[@id='main']/p[1]"
#                elementAbout="//div[@id='main']/div[1]/h2"
#            else:
#                elementAbout="//div[@id='main']/h2[1]"
                mainText = mainText.replace('\n','')
            # Check that elementAbout exists
                if sel.is_element_present(elementAbout)==False:
                    mclib.AppendErrorMessage(self,sel,"About Us information is not present on About Us page")
                elif sel.is_visible(elementAbout)==False:
                    mclib.AppendErrorMessage(self,sel,"About Us information is not visible on the About Us page")
                elif sel.get_text(elementAbout)!=newabouttext and mainText.find(trimmedAboutText)==-1:
                    mclib.AppendErrorMessage(self,sel,"Wrong About Us text on About page.")
                    print "Expected text is "+trimmedAboutText
                    print "- Actual text is "+mainText
                else:
                    print "OK"
            else:
                if mainText.find(newabouttext)==-1 and mainText.find(trimmedAboutText)==-1:
                    mclib.AppendErrorMessage(self,sel,"Updated About Us text not found on About page")
                    print "Expected text: "+trimmedAboutText
                    print "Actual text on the main page"+mainText
                else:
                    print "OK"
예제 #8
0
def AddCategory(self, sel, cat, slug, description, sub, parent):
    #Check if the parent category is available
    if (sub == 1) and (parent != ""):
        if CategoryRow(self, sel, parent) == 0:
            print parent + " category not found. Cannot create subcategory " + cat
            return 0
    # If the new category is a subcategory, prepend its name with an em dash in Unicode
    if sub == 1:
        testCat = u'\u2014' + cat
    else:
        testCat = cat
    #Check if the category already exists
    if CategoryRow(self, sel, testCat) != 0:
        print testCat + " category already exists. Skipping add category procedure"
        return 0
    else:
        print "Adding a new category " + testCat
        #        sel.open(testvars.MCTestVariables["CategoriesPage"])
        #        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        #        buttonAddCategory = "//div[@id='content']/a/span"
        buttonAddCategory = "css=a.add"
        if sel.is_element_present(buttonAddCategory) == True:
            sel.click(buttonAddCategory)
            time.sleep(3)
            if sel.is_visible("//div[@id='label_sidebar']") == False:
                self.verificationErrors.append(
                    "Add category pop-up does not display")
                print testvars.preE + "Add category pop-up does not display"
            else:
                # Enter category name
                if sel.is_element_present("id_name") == True:
                    sel.click("id_name")
                    #sel.type_keys("id_name", cat)
                    sel.type(
                        "id_name", cat
                    )  #A workaround for a known bug in Selenium, which prevents some
                    # characters from being typed
                else:
                    self.verificationErrors.append(
                        "Edit field for category name not found")
                    print testvars.preE + "Edit field for category name not found"
                # Enter category slug
                if sel.is_element_present("id_slug") == True:
                    if slug != "":
                        testSlug = slug
                    else:
                        testSlug = cat
                    sel.type("id_slug", testSlug)
                else:
                    self.verificationErrors.append(
                        "Edit field for category slug not found")
                    print testvars.preE + "Edit field for category slug not found"
                # Enter category description
                if sel.is_element_present("id_description") == True:
                    if description == "":
                        testDescription = "<b>" + cat + "</b> is the description of this item"
                    else:
                        testDescription = description
                    sel.type("id_description", testDescription)
                else:
                    mclib.AppendErrorMessage(
                        self, sel,
                        "Edit field for category description not found")
                    print testvars.preE + "Edit field for category description not found"
                # Check if it is a subcategory; if yes, specify parent
                if sub == 1:
                    listCategoryParent = "id_parent"
                    if sel.is_element_present(listCategoryParent) == True:
                        sel.select("id_parent", parent)
                    else:
                        self.verificationErrors.append(
                            "List of available parent categories not found")
                        print testvars.preE + "List of available parent categories not found"
                # Save changes
                buttonSubmit = "submit"
                if sel.is_element_present(buttonSubmit) == True:
                    sel.click("submit")
                    time.sleep(5)
                else:
                    mclib.AppendErrorMessage(
                        self, sel,
                        "Save button on Add Category pop-up not found")
#        sel.refresh()
        sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
        # Check if the new category is present in the list
        rowNo = CategoryRow(self, sel, testCat)
        if rowNo == 0:  # not found
            mclib.AppendErrorMessage(
                self, sel, testCat + " category was not added to the list")
        else:
            labelDescription = "//div[@id='labels']/form/table/tbody/tr[" + str(
                rowNo) + "]/td[3]"
            labelSlug = "//div[@id='labels']/form/table/tbody/tr[" + str(
                rowNo) + "]/td[4]"
            #Check category description
            if sel.is_element_present(labelDescription) != True:
                mclib.AppendErrorMessage(self, sel,
                                         "Category description not found")
            elif sel.get_text(labelDescription) != mclib.remove_html_tags(
                    testDescription):
                mclib.AppendErrorMessage(
                    self, sel, "Wrong category description text displayed")
                print "Expected category description: " + mclib.remove_html_tags(
                    testDescription)
                print "- Actual category description: " + sel.get_text(
                    labelDescription)
            #Check category slug
            if sel.is_element_present(labelSlug) != True:
                mclib.AppendErrorMessage(self, sel, "Category slug not found")
            elif sel.get_text(labelSlug) != testSlug:
                mclib.AppendErrorMessage(self, sel,
                                         "Wrong category slug text displayed")
                print "Expected category slug: " + testSlug
                print "- Actual category slug: " + sel.get_text(labelSlug)
        return 1