コード例 #1
0
        
    def fill(self, form):
        """
        Fill in the attachment form generically.
        """
        for key, value in form.items():
            interpreter.type(key, value)

    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")

register_pom("PloneArticle", Attachment_Upload())
コード例 #2
0
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; see the file COPYING. If not, write to the
## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

from funittest import interpreter
from funittest import register_pom

class AttachmentBrowse:
    """
    When the user edits an article, he can access the different attachments,
    image, link and file.
    The user can click on the browse button to add an attachment to the
    article, which already exists somewhere in the site.
    The browse form is the same for the different attachment types, so
    this model is designed to be reusable.
    """
    def access(self):
        """
        Access the browse view by clicking on the browse link.
        """
        interpreter.click("plone-article-browse-link")        
        # XXX Wait for condition!
                
register_pom("PloneArticle", AttachmentBrowse())
コード例 #3
0
    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")


register_pom("PloneArticle", Attachment_Upload())
コード例 #4
0
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; see the file COPYING. If not, write to the
## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

from funittest import interpreter
from funittest import register_pom


class AttachmentBrowse:
    """
    When the user edits an article, he can access the different attachments,
    image, link and file.
    The user can click on the browse button to add an attachment to the
    article, which already exists somewhere in the site.
    The browse form is the same for the different attachment types, so
    this model is designed to be reusable.
    """
    def access(self):
        """
        Access the browse view by clicking on the browse link.
        """
        interpreter.click("plone-article-browse-link")
        # XXX Wait for condition!


register_pom("PloneArticle", AttachmentBrowse())