# COPY FROM Products.CMFPlone/Products/CMFPlone/tests/robot/keywords.txt
*** Keywords ***

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

a folder '${foldername}' with a document '${documentname}'
    Go to  ${PORTAL_URL}/createObject?type_name=Folder
    Input text  name=title  ${foldername}
    Click Button  Save
    Go to  ${PORTAL_URL}/folder/edit
    Input text  name=title  ${documentname}
    Click Button  Save

a document
    [Arguments]  ${title}
    Go to  ${PORTAL_URL}/createObject?type_name=Document
    Input text  name=title  ${title}
    Click Button  Save

a folder
    [Arguments]  ${title}
    Go to  ${PORTAL_URL}/createObject?type_name=Folder
    Input text  name=title  ${title}
    Click Button  Save

there should be '${count}' livesearch results
    Wait until keyword succeeds  5s  1s  Element Should Be Visible  css=div#LSResult
    Wait until keyword succeeds  5s  1s  Xpath Should Match X Times  //div[@id = 'LSResult']/descendant::li  ${count}


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

Log in
    [Arguments]  ${userid}  ${password}
    Go to  ${PORTAL_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 out
    Go to  ${PORTAL_URL}/logout
    Page should contain  logged out

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

a site owner
    Log in  ${SITE_OWNER_NAME}  ${SITE_OWNER_PASSWORD}
