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

*** Keywords ***

I am logged in as site owner
  Log in as site owner

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

a collection
  [Arguments]  ${title}
  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  ${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  ${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  ${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
  Click Button  Save
  Wait until page contains  Item created

a folder
  [Arguments]  ${title}
  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  ${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
  Click Button  Save
  Wait until page contains  Item created  error=Image could not be created.

a link
  [Arguments]  ${title}
  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  ${PLONE_URL}/++add++News Item
  Wait until page contains  Add News Item
  Input text  name=form.widgets.IDublinCore.title  ${title}
  fill in metadata
  Click Button  Save
  Wait until page contains  Item created


# ----------------------------------------------------------------------------
# Collection
# ----------------------------------------------------------------------------

the content area should contain
  [Arguments]  ${text}
  Element Should Contain  id=content  ${text}

the content area should not contain
  [Arguments]  ${text}
  ${passed} =  Run Keyword And Return Status  Element Should Contain  id=content  ${text}
  Should Not Be True  ${passed}

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

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

fill in metadata
  Click Link  Categorization
  Input text  name=form.widgets.IDublinCore.subjects  testcreated\nrobot
  Click Link  Dates
  ${currentyear}=  Get Time  year
  fill date field  form.widgets.IDublinCore.effective  2009  January  1
  fill date field  form.widgets.IDublinCore.expires  2017  December  12
  Click Link  Ownership
  Input text  name=form.widgets.IDublinCore.creators  another_creator
  Input text  name=form.widgets.IDublinCore.contributors  contributor1\ncontributor2
  Input text  name=form.widgets.IDublinCore.rights  Copyright\nstatement\nhere
  Click Link  Settings
  Select from List  name=form.widgets.IAllowDiscussion.allow_discussion:list  Yes
  Select Checkbox  name=form.widgets.IExcludeFromNavigation.exclude_from_nav:list

fill date field
  [Arguments]  ${fieldid}  ${year}=2012  ${month}=January  ${day}=10
  [Documentation]  Fill in the specified date field (such as effective/expiration date in the "dates" metadata tab) with the specified date.
  ...  Month must be specified by name.
  Click Link  xpath=//div[@data-fieldname="${fieldid}"]//a[contains(@class,"caltrigger")]
  Select from list  id=calmonth  ${month}
  Select from list  id=calyear  ${year}
  Click Link  xpath=//div[@class='calweek']//a[contains(text(), "${day}")]
