Skip to content

Commit

Permalink
Moved brand new wait-for-element keywords to plone.app.robotframework.
Browse files Browse the repository at this point in the history
Needs plone/plone.app.robotframework#136
Use the new keywords in more tests.
This should hopefully again bring a bit more stability.
  • Loading branch information
mauritsvanrees committed Jun 7, 2022
1 parent 701c059 commit 3821339
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 159 deletions.
20 changes: 0 additions & 20 deletions Products/CMFPlone/tests/robot/keywords.robot
Expand Up @@ -33,23 +33,3 @@ patterns are loaded
a folder with a document '${title}'
${folder_uid}= Create content type=Folder title=folder
Create content type=Document container=${folder_uid} title=${title}

Wait For Element
[Arguments] ${element}
[Documentation] Can contain css=, jquery=, or any other element selector.
Wait Until Page Contains Element ${element}
Set Focus To Element ${element}
Wait Until Element Is Visible ${element}

Wait For Then Click Element
[Arguments] ${element}
[Documentation] Can contain css=, jquery=, or any other element selector.
Wait For Element ${element}
Click Element ${element}

Wait For Then Click Hidden Element
[Arguments] ${element}
[Documentation] Meant for invisible elements. Can contain css=, jquery=, or any other element selector.
Wait Until Page Contains Element ${element}
Set Focus To Element ${element}
Click Element ${element}
21 changes: 5 additions & 16 deletions Products/CMFPlone/tests/robot/test_controlpanel_actions.robot
Expand Up @@ -71,37 +71,26 @@ I modify an action title
Click Link css=section:nth-child(3) li:first-child a
Wait until page contains Action Settings
Input Text for sure form.widgets.title A new site map
Set Focus To Element css=.pattern-modal-buttons > button
Wait Until Element Is Visible css=.pattern-modal-buttons > button
Click Element css=.pattern-modal-buttons > button
Wait For Then Click Element css=.pattern-modal-buttons > button

I change the actions order
Click Link css=section:nth-child(3) li:first-child a
Wait until page contains Action Settings
Input Text for sure form.widgets.position 3
Set Focus To Element css=.pattern-modal-buttons > button
Wait Until Element Is Visible css=.pattern-modal-buttons > button
Click Element css=.pattern-modal-buttons > button
Wait For Then Click Element css=.pattern-modal-buttons > button

I add a new action
Click Link Add new action
Wait until page contains New action
Select From List By Label form.widgets.category:list User actions
Input Text for sure form.widgets.id favorites
Set Focus To Element css=.pattern-modal-buttons > button
Wait Until Element Is Visible css=.pattern-modal-buttons > button
Click Element css=.pattern-modal-buttons > button
Wait For Then Click Element css=.pattern-modal-buttons > button
Wait until page contains favorites
Set Focus To Element css=section.category:last-child li:last-child a
Wait Until Element Is Visible css=section.category:last-child li:last-child a
Sleep 1
Click Link css=section.category:last-child li:last-child a
Wait For Then Click Element css=section.category:last-child li:last-child a
Wait until page contains Action Settings
Input Text for sure form.widgets.title My favorites
Input Text for sure form.widgets.url_expr string:\${globals_view/navigationRootUrl}/favorites
Set Focus To Element css=.pattern-modal-buttons > button
Wait Until Element Is Visible css=.pattern-modal-buttons > button
Click Element css=.pattern-modal-buttons > button
Wait For Then Click Element css=.pattern-modal-buttons > button

I delete an action
Click Button css=section:nth-child(3) li:first-child button[name=delete]
Expand Down
28 changes: 11 additions & 17 deletions Products/CMFPlone/tests/robot/test_controlpanel_filter.robot
Expand Up @@ -77,26 +77,24 @@ Input RichText
I add '${tag}' to the nasty tags list and remove it from the valid tags list
Input Text name=form.widgets.nasty_tags ${tag}
Remove line from textarea form.widgets.valid_tags ${tag}
Click Button Save
Wait until page contains Changes saved
I save the form

I remove '${tag}' from the valid tags list
Remove line from textarea form.widgets.valid_tags ${tag}
Click Button Save
Wait until page contains Changes saved
I save the form

I add '${tag}' to the valid tags list
Input Text name=form.widgets.valid_tags ${tag}
Click Button Save
Wait until page contains Changes saved
I save the form
Page Should Contain ${tag}

I add '${tag}' to the custom attributes list
Input Text name=form.widgets.custom_attributes ${tag}
Click Button Save
Wait until page contains Changes saved
I save the form
Page Should Contain ${tag}

I save the form
Click Button Save
Wait For Then Click Element form.buttons.save
Wait until page contains Changes saved


Expand All @@ -107,17 +105,15 @@ the 'h1' tag is filtered out when a document is saved
Go To ${PLONE_URL}/doc1/edit
patterns are loaded
Input RichText <h1>h1 heading</h1><p>lorem ipsum</p>
Click Button Save
Wait until page contains Changes saved
I save the form
Page should not contain heading

the 'h1' tag is stripped when a document is saved
${doc1_uid}= Create content id=doc1 title=Document 1 type=Document
Go To ${PLONE_URL}/doc1/edit
patterns are loaded
Input RichText <h1>h1 heading</h1><p>lorem ipsum</p>
Click Button Save
Wait until page contains Changes saved
I save the form
Page should contain heading
Page Should Contain Element //div[@id='content-core']//h1 limit=0 message=h1 should have been stripped out

Expand All @@ -126,17 +122,15 @@ the '${tag}' tag is preserved when a document is saved
Go To ${PLONE_URL}/doc1/edit
patterns are loaded
Input RichText <${tag}>lorem ipsum</${tag}>
Click Button Save
Wait until page contains Changes saved
I save the form
Page Should Contain Element //div[@id='content-core']//${tag} limit=1 message=the ${tag} tag should have been preserved

the '${attribute}' attribute is preserved when a document is saved
${doc1_uid}= Create content id=doc1 title=Document 1 type=Document
Go To ${PLONE_URL}/doc1/edit
patterns are loaded
Input RichText <span ${attribute}="foo">lorem ipsum</span>
Click Button Save
Wait until page contains Changes saved
I save the form
Page Should Contain Element //span[@${attribute}] limit=1 message=the ${attribute} tag should have been preserved

success message should contain information regarding caching
Expand Down
20 changes: 5 additions & 15 deletions Products/CMFPlone/tests/robot/test_controlpanel_navigation.robot
Expand Up @@ -68,37 +68,27 @@ a private document '${title}'

I disable generate tabs
Unselect Checkbox form.widgets.generate_tabs:list
Set Focus To Element form.buttons.save
Wait Until Element Is Visible form.buttons.save
Click Button Save
Wait For Then Click Element form.buttons.save
Wait until page contains Changes saved

I disable non-folderish tabs
Unselect Checkbox xpath=//input[@value='Document']
Set Focus To Element form.buttons.save
Wait Until Element Is Visible form.buttons.save
Click Button Save
Wait For Then Click Element form.buttons.save
Wait until page contains Changes saved

I remove '${portal_type}' from the displayed types list
Unselect Checkbox xpath=//input[@value='Document']
Set Focus To Element form.buttons.save
Wait Until Element Is Visible form.buttons.save
Click Button Save
Wait For Then Click Element form.buttons.save
Wait until page contains Changes saved

I enable filtering by workflow states
Select Checkbox name=form.widgets.filter_on_workflow:list
Set Focus To Element form.buttons.save
Wait Until Element Is Visible form.buttons.save
Click Button Save
Wait For Then Click Element form.buttons.save
Wait until page contains Changes saved

I choose to show '${workflow_state}' items
Select Checkbox xpath=//input[@value='${workflow_state}']
Set Focus To Element form.buttons.save
Wait Until Element Is Visible form.buttons.save
Click Button Save
Wait For Then Click Element form.buttons.save
Wait until page contains Changes saved

I choose to not show '${workflow_state}' items
Expand Down
13 changes: 5 additions & 8 deletions Products/CMFPlone/tests/robot/test_controlpanel_search.robot
Expand Up @@ -49,18 +49,15 @@ the search control panel

I enable livesearch
Select Checkbox form.widgets.enable_livesearch:list
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page 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
Set Focus To Element xpath=//input[@name='form.widgets.types_not_searched:list' and @value='${portal_type}']
Unselect Checkbox xpath=//input[@name='form.widgets.types_not_searched:list' and @value='${portal_type}']
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
${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


Expand Down
12 changes: 4 additions & 8 deletions Products/CMFPlone/tests/robot/test_controlpanel_security.robot
Expand Up @@ -64,9 +64,9 @@ the security control panel

a published test folder
Go to ${PLONE_URL}/test-folder
Wait until element is visible css=#plone-contentmenu-workflow
Wait For Element css=#plone-contentmenu-workflow
Click link xpath=//li[@id='plone-contentmenu-workflow']/a
Wait until element is visible id=workflow-transition-publish
Wait For Element id=workflow-transition-publish
Click link id=workflow-transition-publish
Wait until page contains Item state changed

Expand Down Expand Up @@ -142,9 +142,7 @@ A user folder should be created when a user registers and logs in to the site
Input Text for sure form.widgets.email joe@test.com
Input Text for sure form.widgets.password supersecret
Input Text for sure form.widgets.password_ctl supersecret
Set Focus To Element css=#form-buttons-register
Wait Until Element Is Visible css=#form-buttons-register
Click Button Register
Wait For Then Click Element css=#form-buttons-register

# I login to the site
Go to ${PLONE_URL}/login
Expand Down Expand Up @@ -176,9 +174,7 @@ UUID should be used for the user id
Input Text for sure form.widgets.email joe@test.com
Input Text for sure form.widgets.password supersecret
Input Text for sure form.widgets.password_ctl supersecret
Set Focus To Element css=#form-buttons-register
Wait Until Element Is Visible css=#form-buttons-register
Click Button Register
Wait For Then Click Element css=#form-buttons-register

# I login to the site
Go to ${PLONE_URL}/login
Expand Down
23 changes: 6 additions & 17 deletions Products/CMFPlone/tests/robot/test_controlpanel_site.robot
Expand Up @@ -63,44 +63,33 @@ the site control panel

I enable the sitemap
Given patterns are loaded
Set Focus To Element css=#formfield-form-widgets-enable_sitemap
Wait Until Element Is Visible css=#formfield-form-widgets-enable_sitemap
Wait For Element css=#formfield-form-widgets-enable_sitemap
Select Checkbox form.widgets.enable_sitemap:list
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved

I set the site title to '${site_title}'
Given patterns are loaded
Input Text name=form.widgets.site_title ${site_title}
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved

I set a custom logo
Given patterns are loaded
Choose File name=form.widgets.site_logo ${PATH_TO_TEST_FILES}/pixel.png
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved

I enable dublin core metadata
Given patterns are loaded
Select Checkbox form.widgets.exposeDCMetaTags:list
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved

I add a Javascript snippet to the webstats javascript
Given patterns are loaded
Input Text name=form.widgets.webstats_js <script id="webstats_snippet"></script>
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved


Expand Down
10 changes: 2 additions & 8 deletions Products/CMFPlone/tests/robot/test_controlpanel_social.robot
Expand Up @@ -44,20 +44,14 @@ the social control panel

I disable social
UnSelect Checkbox form.widgets.share_social_data:list
Sleep 2
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved

I provide social settings
Input Text name=form.widgets.twitter_username plonecms
Input Text name=form.widgets.facebook_app_id 123456
Input Text name=form.widgets.facebook_username plonecms
Sleep 2
Set Focus To Element css=#form-buttons-save
Wait Until Element Is Visible css=#form-buttons-save
Click Button Save
Wait For Then Click Element css=#form-buttons-save
Wait until page contains Changes saved


Expand Down
12 changes: 4 additions & 8 deletions Products/CMFPlone/tests/robot/test_edit_user_schema.robot
Expand Up @@ -103,9 +103,8 @@ I add a new text field to the member fields

I Open the test_field Settings
Go to ${PLONE_URL}/@@member-fields
Wait until page contains element css=div[data-field_id='test_field']
Set Focus To Element css=div[data-field_id='test_field'] a.fieldSettings
Wait Until Keyword Succeeds 3 100ms Click link css=div[data-field_id='test_field'] a.fieldSettings
Wait For Element css=div[data-field_id='test_field']
Wait For Then Click Element css=div[data-field_id='test_field'] a.fieldSettings

I add a new required text field to the member fields
Go to ${PLONE_URL}/@@member-fields
Expand Down Expand Up @@ -173,11 +172,8 @@ a logged-in user will see the field on top of the user profile
a logged-in user will see a field with min/max constraints
a logged-in user will see the field in the user profile
Input Text form.widgets.email test@plone.org
Set Focus To Element css=#form-widgets-test_field
Wait Until Element Is visible css=#form-widgets-test_field
Wait For Element css=#form-widgets-test_field
Input Text form.widgets.test_field 1
Set Focus To Element css=.formControls button#form-buttons-save
Wait Until Element Is visible css=.formControls button#form-buttons-save
Click Button Save
Wait For Then Click Element css=.formControls button#form-buttons-save
Wait until page contains There were some errors.
Page should contain Value is too short

0 comments on commit 3821339

Please sign in to comment.