Skip to content

Instantly share code, notes, and snippets.

@ericof
Created May 16, 2013 13:09
Show Gist options
  • Save ericof/5591586 to your computer and use it in GitHub Desktop.
Save ericof/5591586 to your computer and use it in GitHub Desktop.
Robotframework test for the content type constrains form feature of Plone
*** Settings ***
Variables plone/app/testing/interfaces.py
Variables variables.py
Library Selenium2Library timeout=${SELENIUM_TIMEOUT} implicit_wait=${SELENIUM_IMPLICIT_WAIT}
Resource keywords.txt
Suite Setup Suite Setup
Suite Teardown Suite Teardown
*** Test cases ***
Scenario: Link to constrains link should be on Add New menu
Given a site owner
And the test folder
When I open the Add New menu
And choose Restrictions
Then the constrains form should be available
Scenario: Select constrains
Given a site owner
And the test folder
When I go to the constrains form
And I choose to select manually the restriction policy
Then allowed types form should be available
Then I allow only Pages
And I save the form
When I go back to the test folder
And I open the Add New menu
Then Only Page content type should be listed
Scenario: The constrains form should keep selection between accesses
Given a site owner
And the test folder
When When I go to the constrains form
Then allowed types form should be available
And only Page should be selected
*** Keywords ***
the site root
Go to ${PLONE_URL}
the test folder
Go to ${TEST_FOLDER}
the folder contents view
Go to ${TEST_FOLDER}/folder_contents
I go to the constrains form
I open the Add New menu
choose Restrictions
the constrains form should be available
I open the Add New menu
Open Add New Menu
choose Restrictions
Click Link link=Restrictions…
the constrains form should be available
Wait Until Page Contains Element form-widgets-constrain_types_mode
I choose to select manually the restriction policy
Select From List xpath=//select[@id='form-widgets-constrain_types_mode'] 1
Allowed types form should be available
Element should be visible css=div#formfield-form-widgets-current_prefer
I Allow only Pages
Select checkbox id=form-widgets-current_prefer-0
only Page should be selected
Checkbox Should be selected id=form-widgets-current_prefer-0
I save the form
Click Button Save
I go back to the test folder
the test folder
Only Page content type should be listed
Element should contain plone-contentmenu-factories Page
Page Should Not Contain Element css=dl#plone-contentmenu-factories a.event
Page Should Not Contain Element css=dl#plone-contentmenu-factories a.folder
Page Should Not Contain Element css=dl#plone-contentmenu-factories a.collection
Page Should Not Contain Element css=dl#plone-contentmenu-factories a.link
I only allow Pages to be added
I go to the constrains form
I choose to select manually the restriction policy
allowed types form should be available
I allow only Pages
I save the form
I go back to the test folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment