Add RobotFramework integration and some RobotFramework tests

This commit is contained in:
Cédric Messiant 2013-09-27 17:29:32 +02:00
parent 4a7b163d2c
commit d1a3249af4
5 changed files with 70 additions and 0 deletions

View File

@ -3,9 +3,18 @@ extends =
base.cfg
parts +=
omelette
robot
eggs +=
ipdb
[omelette]
recipe = collective.recipe.omelette
eggs = ${test:eggs}
[robot]
recipe = zc.recipe.egg
eggs =
collective.contact.core
ecreall.helpers.testing
Pillow
plone.app.robotframework[ride,reload]

View File

@ -61,6 +61,7 @@ setup(name='collective.contact.core',
],
extras_require={
'test': ['plone.app.testing',
'plone.app.robotframework',
'ecreall.helpers.testing',
],
},

View File

@ -4,6 +4,10 @@ from plone.app.testing import PloneWithPackageLayer
from plone.app.testing import IntegrationTesting
from plone.app.testing import FunctionalTesting
from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE
from plone.testing import z2
import collective.contact.core
@ -28,3 +32,9 @@ INTEGRATION = IntegrationTesting(
FUNCTIONAL = FunctionalTesting(
bases=(COLLECTIVE_CONTACT_CORE, ),
name="FUNCTIONAL")
ACCEPTANCE = FunctionalTesting(
bases=(COLLECTIVE_CONTACT_CORE,
AUTOLOGIN_LIBRARY_FIXTURE,
z2.ZSERVER_FIXTURE),
name="ACCEPTANCE")

View File

@ -0,0 +1,26 @@
*** Settings ***
Test Setup Open test browser
Test Teardown Close all browsers
Resource plone/app/robotframework/keywords.robot
*** Keywords ***
Go to directory
Go to ${PLONE_URL}/mydirectory
*** Test cases ***
Directory is available
Log in as site owner
Click link css=#portaltab-mydirectory a
Element should contain css=#content h1 Military directory
Create a new organization
Log in as site owner
Go to directory
Open Add New Menu
Click link css=#plone-contentmenu-factories a#organization
Wait Until Page Contains Element css=#form-widgets-IBasic-title
Input Text css=#form-widgets-IBasic-title Squadron five
Click Button Save
Page should contain Squadron five
Go to directory
Element should contain organizations Squadron five

View File

@ -0,0 +1,24 @@
import os
import unittest
import robotsuite
from plone.testing import layered
from ..testing import ACCEPTANCE
def test_suite():
suite = unittest.TestSuite()
current_dir = os.path.abspath(os.path.dirname(__file__))
robot_dir = os.path.join(current_dir, 'robot')
robot_tests = [
os.path.join('robot', doc) for doc in os.listdir(robot_dir)
if doc.endswith('.robot') and doc.startswith('test_')
]
for test in robot_tests:
suite.addTests([
layered(
robotsuite.RobotTestSuite(test),
layer=ACCEPTANCE
),
])
return suite