-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring controlpanel_search robot test
- Loading branch information
Showing
1 changed file
with
40 additions
and
56 deletions.
There are no files selected for viewing
96 changes: 40 additions & 56 deletions
96
Products/CMFPlone/tests/robot/test_controlpanel_search.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,65 @@ | ||
*** Settings ***************************************************************** | ||
*** Settings *** | ||
|
||
Resource plone/app/robotframework/keywords.robot | ||
Resource plone/app/robotframework/saucelabs.robot | ||
Resource plone/app/robotframework/selenium.robot | ||
Resource plone/app/robotframework/browser.robot | ||
Resource keywords.robot | ||
|
||
Library Remote ${PLONE_URL}/RobotRemote | ||
Library Remote ${PLONE_URL}/RobotRemote | ||
|
||
Resource keywords.robot | ||
Test Setup Run Keywords Plone test setup | ||
Test Teardown Run keywords Plone test teardown | ||
|
||
Test Setup Run keywords Plone Test Setup | ||
Test Teardown Run keywords Plone Test Teardown | ||
|
||
|
||
*** Test Cases *************************************************************** | ||
*** Test Cases *** | ||
|
||
Scenario: Enable Livesearch in the Search Control Panel | ||
Given a logged-in site administrator | ||
and a document 'My Document' | ||
and the search control panel | ||
When I enable livesearch | ||
# Then then searching for 'My Document' will show a live search | ||
# XXX: Not implemented yet. See https://github.com/plone/Products.CMFPlone/issues/176 for details | ||
Given a logged-in site administrator | ||
and a document 'My Document' | ||
and the search control panel | ||
When I enable livesearch | ||
Then then searching for 'My Document' will show a live search | ||
|
||
Scenario: Exclude Content Types from Search | ||
Given a logged-in site administrator | ||
and a document 'My Document' | ||
and the search control panel | ||
When I exclude the 'Document' type from search | ||
Then searching for 'My Document' will not return any results | ||
|
||
|
||
*** Keywords ***************************************************************** | ||
Given a logged-in site administrator | ||
and a document 'My Document' | ||
and the search control panel | ||
When I exclude the 'Document' type from search | ||
Then searching for 'My Document' will not return any results | ||
|
||
# --- GIVEN ------------------------------------------------------------------ | ||
|
||
a logged-in site administrator | ||
Enable autologin as Site Administrator | ||
*** Keywords *** | ||
|
||
a document '${title}' | ||
Create content type=Document id=doc title=${title} | ||
# GIVEN | ||
|
||
the search control panel | ||
Go to ${PLONE_URL}/@@search-controlpanel | ||
Wait until page contains Search Settings | ||
Go to ${PLONE_URL}/@@search-controlpanel | ||
Get Text //body contains Search Settings | ||
|
||
|
||
# --- WHEN ------------------------------------------------------------------- | ||
# WHEN | ||
|
||
I enable livesearch | ||
Select Checkbox form.widgets.enable_livesearch:list | ||
Wait For Then Click Element css=#form-buttons-save | ||
Wait until page contains Changes saved | ||
Check Checkbox //input[@name="form.widgets.enable_livesearch:list"] | ||
Click //button[@name="form.buttons.save"] | ||
Get Text //body contains Changes saved | ||
|
||
I exclude the '${portal_type}' type from search | ||
# Make sure we see the checkbox, in expanded in jenkins it gets a bit under the toolbar | ||
${element} Set Variable xpath=//input[@name='form.widgets.types_not_searched:list' and @value='${portal_type}'] | ||
Wait For Element ${element} | ||
Unselect Checkbox ${element} | ||
Wait For Then Click Element css=#form-buttons-save | ||
Wait until page contains Changes saved | ||
# Make sure we see the checkbox, in expanded in jenkins it gets a bit under the toolbar | ||
Check Checkbox //input[@name='form.widgets.types_not_searched:list' and @value='${portal_type}'] | ||
Click //button[@name="form.buttons.save"] | ||
Get Text //body contains Changes saved | ||
|
||
|
||
# --- THEN ------------------------------------------------------------------- | ||
# THEN | ||
|
||
then searching for 'My Document' will show a live search | ||
# XXX: Not implemented yet. | ||
Go to ${PLONE_URL} | ||
Wait until page contains element xpath=//input[@name='SearchableText'] | ||
Input Text name=SearchableText My | ||
Go to ${PLONE_URL} | ||
Type Text //input[@name="SearchableText"] My D | ||
Get Element States //ul[contains(@class,"livesearch-results")] contains visible | ||
Get Text //ul[contains(@class,"livesearch-results")] contains My Document | ||
|
||
searching for '${search_term}' will not return any results | ||
Go to ${PLONE_URL}/@@search | ||
Given patterns are loaded | ||
Wait until page contains No results were found | ||
Input Text xpath=//form[@id='searchform']//input[@name='SearchableText'] ${search_term} | ||
Submit Form name=searchform | ||
Wait until page contains items matching your search terms | ||
Page Should Contain Element //span[@id='search-results-number' and contains(.,'0')] 1 | ||
|
||
|
||
Go to ${PLONE_URL}/@@search | ||
Get Text //body contains No results were found | ||
Type Text //form[@id='searchform']//input[@name='SearchableText'] ${search_term} | ||
Click //input[@type="submit" and @value="Search"] | ||
Get Text //body contains items matching your search terms | ||
Get Text //span[@id='search-results-number'] should be 0 |