def access_files(self): """ Access the upload view by clicking on the upload link. """ interpreter.click( "//div[@id='archetypes-fieldname-files']//a[@id='plone-article-upload-link']" ) interpreter.wait_for_condition( "selenium.isElementPresent('new_file_btn_ok');", 10000)
def test_add_two_images_and_change_position(self): "Add two images and change their position" interpreter.annotate("Test: Add two images and change their position") images = [] images.append(dataprovider.plonearticle.articleimage.get("Image 1")) images.append(dataprovider.plonearticle.articleimage.get("Image 2")) logical.plonearticle.article.add_multiple_images(images) # Change position of images interpreter.click("//a[@class='file_move_down'][1]") interpreter.click("//a[@class='file_move_down'][1]") logical.plonearticle.article.save_article(self.article)
def existing_article_without_attachments(self, article): interpreter.annotate("Setup article") self.existing_article(article) # Need to delete all images for attachment_type in ["images", "files", "links"]: physical.cmfplone.tab.access("edit") physical.cmfplone.schemata.access(attachment_type) i = 0 while interpreter.is_element_present("//div[@id='%s-innercontent%06d']" % (attachment_type, i)): interpreter.click("//div[@id='%s-innercontent%06d']/div/a[@class='file_delete']" % (attachment_type, i)) i+=1 #os.system("pause") logical.cmfplone.content.save(article)
def save(self, attach, postcondition="success"): """ Save the attachment. Postcondition can be "success" or "error" """ interpreter.click("new_file_btn_ok") if postcondition=="success": interpreter.wait_for_condition("selenium.isElementPresent('upload-status-success');",10000) elif postcondition=="error": interpreter.wait_for_condition("selenium.isElementPresent('upload-status-error');",10000) # In case of an error, the title and description should not be lost interpreter.failUnless(interpreter.get_value("//input[@id='new_file_title']")==attach['new_file_title']) interpreter.failUnless(interpreter.get_value("//input[@id='new_file_description']")==attach['new_file_description'])
def save(self, attach, postcondition="success"): """ Save the attachment. Postcondition can be "success" or "error" """ interpreter.click("new_file_btn_ok") if postcondition == "success": interpreter.wait_for_condition( "selenium.isElementPresent('upload-status-success');", 10000) elif postcondition == "error": interpreter.wait_for_condition( "selenium.isElementPresent('upload-status-error');", 10000) # In case of an error, the title and description should not be lost interpreter.failUnless( interpreter.get_value("//input[@id='new_file_title']") == attach['new_file_title']) interpreter.failUnless( interpreter.get_value("//input[@id='new_file_description']") == attach['new_file_description'])
def cancel(self): """ Cancel the upload form, and return to the attachment form. """ interpreter.click("btnCancel")
def access_files(self): """ Access the upload view by clicking on the upload link. """ interpreter.click("//div[@id='archetypes-fieldname-files']//a[@id='plone-article-upload-link']") interpreter.wait_for_condition("selenium.isElementPresent('new_file_btn_ok');",10000)
def access(self): """ Access the browse view by clicking on the browse link. """ interpreter.click("plone-article-browse-link")