Skip to content

Commit

Permalink
Modernize robot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroel authored and pbauer committed Feb 12, 2014
1 parent ccb3d26 commit ddfd295
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 140 deletions.
3 changes: 2 additions & 1 deletion plone/app/contenttypes/testing.py
Expand Up @@ -14,6 +14,7 @@
from zope.interface import alsoProvides

import pkg_resources
from .tests.robot.variables import TEST_FOLDER_ID


def set_browserlayer(request):
Expand Down Expand Up @@ -56,7 +57,7 @@ def setUpPloneSite(self, portal):
setRoles(portal, TEST_USER_ID, ['Manager'])
portal.invokeFactory(
"Folder",
id="robot-test-folder",
id=TEST_FOLDER_ID,
title=u"Test Folder"
)

Expand Down
22 changes: 12 additions & 10 deletions plone/app/contenttypes/tests/robot/contenttypes_keywords.txt
@@ -1,3 +1,5 @@
Variables plone/app/contenttypes/tests/robot/variables.py

*** Keywords ***

Suite Setup
Expand Down Expand Up @@ -35,9 +37,9 @@ Create Event
Input text name=form.widgets.start_date-year 2013
Input text name=form.widgets.end_date-day 10
Input text name=form.widgets.end_date-year 2013

Click Button Save
Page Should Contain Item created
Page Should Contain Item created

Create News Item
[Arguments] ${title}
Expand All @@ -46,7 +48,7 @@ Create News Item
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save

Page Should Contain Item created
Page Should Contain Item created

Create Link
[Arguments] ${title}
Expand All @@ -56,7 +58,7 @@ Create Link
Input text name=form.widgets.remoteUrl http://plone.org
Click Button Save

Page Should Contain Item created
Page Should Contain Item created

Create Collection
[Arguments] ${title}
Expand All @@ -65,7 +67,7 @@ Create Collection
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save

Page Should Contain Item created
Page Should Contain Item created

Create Folder
[Arguments] ${title}
Expand All @@ -74,7 +76,7 @@ Create Folder
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save

Page Should Contain Item created
Page Should Contain Item created

Create Document
[Arguments] ${title}
Expand All @@ -83,15 +85,15 @@ Create Document
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save

Page Should Contain Item created
Page Should Contain Item created

Create Image
[Arguments] ${title}
Go to ${test-folder}/++add++Image

Input text name=form.widgets.title ${title}
Input text name=form.widgets.title ${title}
Choose File name=form.widgets.image ${PATH_TO_TEST_FILES}/image.jpg
Click Button Save

Page Should Contain Item created
Page Should Contain Click to view full-size image
Page Should Contain Item created
Page Should Contain Click to view full-size image
64 changes: 13 additions & 51 deletions plone/app/contenttypes/tests/robot/keywords.txt
@@ -1,79 +1,41 @@
*** Keywords ***
Variables plone/app/contenttypes/tests/robot/variables.py

# ----------------------------------------------------------------------------
# Suite
# ----------------------------------------------------------------------------
*** Keywords ***

Suite Setup
Open browser ${PLONE_URL} browser=${BROWSER} remote_url=${REMOTE_URL} desired_capabilities=${DESIRED_CAPABILITIES}
I am logged in as site owner
Log in as site owner

Suite Teardown
Close All Browsers


# ----------------------------------------------------------------------------
# Login/Logout
# ----------------------------------------------------------------------------

Log in
[Arguments] ${userid} ${password}
[Documentation] Log in to the site as ${userid} using ${password}. There
... is no guarantee of where in the site you are once this is
... done. (You are responsible for knowing where you are and
... where you want to be)
Go to ${PLONE_URL}/login_form
Page should contain element __ac_name
Page should contain element __ac_password
Page should contain button Log in
Input text __ac_name ${userid}
Input text __ac_password ${password}
Click Button Log in

Log in as site owner
[Documentation] Log in as the SITE_OWNER provided by plone.app.testing,
... with all the rights and privileges of that user.
Log in ${SITE_OWNER_NAME} ${SITE_OWNER_PASSWORD}

Log in as test user
Log in ${TEST_USER_NAME} ${TEST_USER_PASSWORD}

Log out
Go to ${PLONE_URL}/logout
Page should contain logged out


# ----------------------------------------------------------------------------
# Content
# ----------------------------------------------------------------------------

a collection
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++Collection
Go to ${PLONE_URL}/++add++Collection
Wait until page contains Add Collection
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save
Wait until page contains Item created

a document
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++Document
Go to ${PLONE_URL}/++add++Document
Wait until page contains Add Page
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save
Wait until page contains Item created

a event
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++Event
Go to ${PLONE_URL}/++add++Event
Wait until page contains Add Event
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save
Wait until page contains Item created

a file
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++File
Go to ${PLONE_URL}/++add++File
Wait until page contains Add File
Input text name=form.widgets.title ${title}
Choose File name=form.widgets.file ${PATH_TO_TEST_FILES}/file.pdf
Expand All @@ -82,15 +44,15 @@ a file

a folder
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++Folder
Go to ${PLONE_URL}/++add++Folder
Wait until page contains Add Folder
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save
Wait until page contains Item created

a image
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++Image
Go to ${PLONE_URL}/++add++Image
Wait until page contains Add Image
Input text name=form.widgets.title ${title}
Choose File name=form.widgets.image ${PATH_TO_TEST_FILES}/image.png
Expand All @@ -99,15 +61,15 @@ a image

a link
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++Link
Go to ${PLONE_URL}/++add++Link
Wait until page contains Add Link
Input text name=form.widgets.IDublinCore.title ${title}
Click Button Save
Wait until page contains Item created

a news item
[Arguments] ${title}
Go to ${TEST_FOLDER}/++add++News Item
Go to ${PLONE_URL}/++add++News Item
Wait until page contains Add News Item
Input text name=form.widgets.IDublinCore.title ${title}
fill in metadata
Expand All @@ -130,12 +92,12 @@ the content area should not contain

the collection should contain
[Arguments] ${title}
Go to ${TEST_FOLDER}/my-collection
Go to ${PLONE_URL}/my-collection
The content area should contain ${title}

the collection should not contain
[Arguments] ${title}
Go to ${TEST_FOLDER}/my-collection
Go to ${PLONE_URL}/my-collection
The content area should not contain ${title}

fill in metadata
Expand Down
@@ -1,17 +1,14 @@
*** Settings ***

Variables plone/app/testing/interfaces.py
Variables plone/app/contenttypes/tests/robot/variables.py

Library Selenium2Library timeout=${SELENIUM_TIMEOUT} implicit_wait=${SELENIUM_IMPLICIT_WAIT}

Resource plone/app/robotframework/keywords.robot
Resource plone/app/contenttypes/tests/robot/keywords.txt

Suite Setup Suite Setup
Suite Teardown Suite Teardown
Test Setup Run keywords Open test browser
Test Teardown Close all browsers

*** Variables ***

*** Test Cases ***
*** Test cases ***

Scenario: Test Creator Criterion
Given a site owner document Site Owner Document
Expand All @@ -26,6 +23,7 @@ Scenario: Test Creator Criterion

a site owner document
[Arguments] ${title}
Log in as site owner
a document ${title}

a test user document
Expand Down
@@ -1,20 +1,20 @@
*** Settings ***

Variables plone/app/testing/interfaces.py
Variables plone/app/contenttypes/tests/robot/variables.py

Library Selenium2Library timeout=${SELENIUM_TIMEOUT} implicit_wait=${SELENIUM_IMPLICIT_WAIT}

Resource plone/app/robotframework/keywords.robot
Resource plone/app/contenttypes/tests/robot/keywords.txt

Suite Setup Suite Setup
Suite Teardown Suite Teardown
Variables plone/app/contenttypes/tests/robot/variables.py

Test Setup Run keywords Open test browser
Test Teardown Close all browsers

*** Variables ***

*** Test Cases ***
*** Test cases ***

Scenario: Test Relative Location Criterion
Given a document Document outside Folder
Given I am logged in as site owner
And a document Document outside Folder
And a folder 'my-folder' with a document 'Document within Folder'
And a collection My Collection
When I set the collection's relative location criterion to ../my-folder
Expand All @@ -23,22 +23,23 @@ Scenario: Test Relative Location Criterion


Scenario: Test Absolute Location Criterion
Given a document Document outside Folder
Given I am logged in as site owner
And a document Document outside Folder
And a folder 'my-folder' with a document 'Document within Folder'
And a collection My Collection
When I set the collection's absolute location criterion to /robot-test-folder/my-folder/
When I set the collection's absolute location criterion to /my-folder/
Then the collection should contain Document within Folder
And the collection should not contain Document outside Folder


*** Keywords ***

a folder '${folder-id}' with a document '${document-title}'
Go to ${TEST_FOLDER}/++add++Folder
Go to ${PLONE_URL}/++add++Folder
Wait until page contains element name=form.widgets.IDublinCore.title
Input text name=form.widgets.IDublinCore.title ${folder-id}
Click Button Save
Go to ${TEST_FOLDER}/${folder-id}/++add++Document
Go to ${PLONE_URL}/${folder-id}/++add++Document
Wait until page contains element name=form.widgets.IDublinCore.title
Input text name=form.widgets.IDublinCore.title ${document-title}
Click Button Save
Expand Down
@@ -1,20 +1,18 @@
*** Settings ***

Variables plone/app/testing/interfaces.py
Variables plone/app/contenttypes/tests/robot/variables.py

Library Selenium2Library timeout=${SELENIUM_TIMEOUT} implicit_wait=${SELENIUM_IMPLICIT_WAIT}

Resource plone/app/robotframework/keywords.robot
Resource plone/app/contenttypes/tests/robot/keywords.txt

Suite Setup Suite Setup
Suite Teardown Suite Teardown
Test Setup Run keywords Open test browser
Test Teardown Close all browsers

*** Variables ***

*** Test Cases ***
*** Test cases ***

Scenario: Test Review state Criterion
Given a published document Published Document
Given I am logged in as site owner
And a published document Published Document
And a private document Private Document
And a collection My Collection
When I set the collection's review state criterion to private
Expand Down
@@ -1,20 +1,18 @@
*** Settings ***

Variables plone/app/testing/interfaces.py
Variables plone/app/contenttypes/tests/robot/variables.py

Library Selenium2Library timeout=${SELENIUM_TIMEOUT} implicit_wait=${SELENIUM_IMPLICIT_WAIT}

Resource plone/app/robotframework/keywords.robot
Resource plone/app/contenttypes/tests/robot/keywords.txt

Suite Setup Suite Setup
Suite Teardown Suite Teardown
Test Setup Run keywords Open test browser
Test Teardown Close all browsers

*** Variables ***

*** Test Cases ***
*** Test cases ***

Test Short name (id) Criterion
Given a document First Document
Given I am logged in as site owner
And a document First Document
And a document Second Document
And a collection My Collection
When I set the collection short name (id) criterion to first-document
Expand Down

1 comment on commit ddfd295

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS FAILED
Mr.Roboto url : http://jenkins.plone.org/roboto/get_info?push=8d914365d8fe45dfb29448dbac492f91
[SUCCESS] kgs-plone.app.contenttypes-plone-5.0-python-2.7 kgs
[FAILURE] kgs-plone.app.contenttypes-plone-4.3-python-2.6 kgs
[FAILURE] kgs-plone.app.contenttypes-plone-4.3-python-2.7 kgs

Please sign in to comment.