diff --git a/src/collective/taxonomy/tests/robot/test_taxonomy.robot b/src/collective/taxonomy/tests/robot/test_taxonomy.robot new file mode 100644 index 0000000..c1b2e1a --- /dev/null +++ b/src/collective/taxonomy/tests/robot/test_taxonomy.robot @@ -0,0 +1,78 @@ +*** Settings *** + +Resource plone/app/robotframework/browser.robot + +Library Remote ${PLONE_URL}/RobotRemote +Library Collections + +Test Setup Run Keywords Plone test setup +Test Teardown Run keywords Plone test teardown + + +*** Variables *** + +${TITLE} An edited page +${PAGE_ID} an-edited-page + + +*** Test Cases *** + +Scenario: As a manager I can add a taxonomy + Given a logged in manager + and an page type with a taxonomy + When I edit the page + and I select multiple options + Then I see '2' selected options + + When I save the page + and I edit the page + and I deselect option 'Information Science' + Then I see '1' selected options + +*** Keywords *** + +# Given + +a logged in manager + Enable autologin as Manager + +an page type with a taxonomy + Create content + ... type=Document + ... title=${TITLE} + + Go to ${PLONE_URL}/dexterity-types/Document/@@behaviors + Check Checkbox //input[@name="form.widgets.collective.taxonomy.generated.test:list"] + Click //button[@name="form.buttons.apply"] + Wait For Condition Text //body contains Behaviors successfully updated. + +# When +I edit the page + Go to ${PLONE_URL}/${PAGE_ID}/edit + Get Text //body contains Edit Page + +I select multiple options + Select Options By //select[@name="form.widgets.test.taxonomy_test.from"] index 0 2 + Click //button[@name="from2toButton"] + +I save the page + Click //button[@name="form.buttons.save"] + Wait For Condition Text //body contains Changes saved + +I deselect option '${label}' + Select Options By //select[@name="form.widgets.test.taxonomy_test.to"] label ${label} + Click //button[@name="to2fromButton"] + +# Then +I see '${count}' selected options + Get Element Count //select[@name="form.widgets.test.taxonomy_test.to"]/option should be ${count} + +# Misc + +Pause + [Documentation] Visually pause test execution with interactive dialog by + ... importing **Dialogs**-library and calling its + ... **Pause Execution**-keyword. + Import library Dialogs + Pause execution + diff --git a/src/collective/taxonomy/tests/robot/todo_test_taxonomy.robot b/src/collective/taxonomy/tests/robot/todo_test_taxonomy.robot deleted file mode 100644 index 71a88b9..0000000 --- a/src/collective/taxonomy/tests/robot/todo_test_taxonomy.robot +++ /dev/null @@ -1,105 +0,0 @@ -# ============================================================================ -# EXAMPLE ROBOT TESTS -# ============================================================================ -# -# Run this robot test stand-alone: -# -# $ bin/test -s collective.taxonomy -t test_taxonomy.robot --all -# -# Run this robot test with robot server (which is faster): -# -# 1) Start robot server: -# -# $ bin/robot-server --reload-path src collective.solr.testing.COLLECTIVE_SOLR_ROBOT_TESTING -# -# 2) Run robot tests: -# -# $ bin/robot src/collective/solr/tests/robot/test_search.robot -# -# See the http://docs.plone.org for further details (search for robot -# framework). -# -# ============================================================================ - -*** Settings ***************************************************************** - -Resource plone/app/robotframework/selenium.robot -Resource plone/app/robotframework/keywords.robot -Resource Products/CMFPlone/tests/robot/keywords.robot - -Library Remote ${PLONE_URL}/RobotRemote -Library DateTime - -Test Setup TestSetup -Test Teardown TestTeardown - -*** Variables *** - -${BROWSER} chrome - - -*** Test Cases *************************************************************** - -Scenario: As a manager I can add a taxonomy - Given a logged in manager - When I search for 'Colorless Green Ideas' - Then the search returns '1' results - and the search results should include 'Colorless Green Ideas' - -*** Keywords ***************************************************************** - -# Test Setup/Teardown - -TestSetup - Open test browser -# a logged in Manager - - -TestTeardown -# a logged in Manager - Close all browsers - - -# Given - -a logged in manager - Enable autologin as Manager - - -# When - -I search for '${searchterm}' - Go to ${PLONE_URL}/@@search - Input text xpath=//main//input[@name='SearchableText'] ${searchterm} - -I filter the search by portal type '${portal_type}' - Click Element xpath=//button[@id='search-filter-toggle'] - Wait until page contains element xpath=//input[@id='query-portaltype-Collection'] - Unselect Checkbox xpath=//input[@id='query-portaltype-Collection'] - Unselect Checkbox xpath=//input[@id='query-portaltype-Document'] - -I filter the search by creation date '${date_filter}' - Click Element xpath=//button[@id='search-filter-toggle'] - Wait until page contains element xpath=//input[@id='query-portaltype-Collection'] - Select Radio Button created query-date-${date_filter} - -# Then - -the search returns '${result_count}' results - Wait until keyword succeeds 5s 1s XPath Should Match X Times //strong[@id='search-results-number' and contains(.,'${result_count}')] 1 The search should have returned '${result_count}' results. - -the search results should include '${term}' - Wait until page contains element xpath=//ol[@class='searchResults'] - Page should contain ${term} - XPath Should Match X Times //div[@id='search-results']//ol//li//a[contains(., '${term}')] 1 Search results should have contained '${term}'. - -the search results should not include '${term}' - Wait until page contains Search results - Page should not contain element xpath=//*[@class='searchResults']/a[contains(text(), '${term}')] - - -# Misc - -Capture screenshot - [Arguments] ${filename} - Capture Page Screenshot filename=../../../../docs/_screenshots/${filename}