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

*** Keywords ***

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

Click Edit
  Click Link  xpath=//a[contains(., "Edit")]

# ----------------------------------------------------------------------------
# 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 Element  xpath=//div[@data-fieldname="${fieldid}"]//input[contains(@class,"pattern-pickadate-date")]
  Select from list  css=div[data-fieldname="${fieldid}"] .picker__select--month  ${month}
  Select from list  css=div[data-fieldname="${fieldid}"] select.picker__select--year  ${year}
  Click Element  xpath=//div[@data-fieldname="${fieldid}"]//div[contains(@class, 'picker__day')][contains(text(), "${day}")]

I set the criteria ${type} in row ${number} to the option '${label}'
  ${criteria_row} =  Convert to String  .querystring-criteria-wrapper:nth-child(${number})
  Wait until page contains Element  css=${criteria_row} .querystring-criteria-${type} .select2-choice
  Click Element  css=${criteria_row} .querystring-criteria-${type} .select2-choice
  Wait until page contains Element  xpath=//div[@class='select2-result-label']/descendant-or-self::*[contains(text(), '${label}')]
  Click Element  xpath=//div[@class='select2-result-label']/descendant-or-self::*[contains(text(), '${label}')]

I set the criteria ${type} in row ${number} to the options '${label}'
  ${criteria_row} =  Convert to String  .querystring-criteria-wrapper:nth-child(${number})
  Wait until page contains Element  css=${criteria_row} .querystring-criteria-${type} .select2-choices
  Click Element  css=${criteria_row} .querystring-criteria-${type} .select2-choices
  Wait until page contains Element  xpath=//div[@class='select2-result-label']/descendant-or-self::*[contains(text(), '${label}')]
  Click Element  xpath=//div[@class='select2-result-label']/descendant-or-self::*[contains(text(), '${label}')]

I set the criteria ${type} in row ${number} to the text '${label}'
  ${criteria_row} =  Convert to String  .querystring-criteria-wrapper:nth-child(${number})
  Input text  css=${criteria_row} .querystring-criteria-value input  ${label}\t
