Skip to content

Commit

Permalink
refactoring controlpanel actions robot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
1letter committed Sep 25, 2024
1 parent aa6a32a commit 522f942
Showing 1 changed file with 97 additions and 91 deletions.
188 changes: 97 additions & 91 deletions Products/CMFPlone/tests/robot/test_controlpanel_actions.robot
Original file line number Diff line number Diff line change
@@ -1,137 +1,143 @@
*** 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 ***************************************************************
# hint: the `Sleep` Statement is needed for the `Disable autologin` and the commit in the DB, it takes a while

Scenario: Modify an existing action in Actions Control Panel
Given a logged-in administrator
and the actions control panel
When I modify an action title
Sleep 1
Then anonymous users can see the new action title
Given a logged-in administrator
and the actions control panel
When I modify an action title
and Sleep 1
Then anonymous users can see the new action title

Scenario: Reorder in Actions Control Panel
Given a logged-in administrator
and the actions control panel
When I change the actions order
Sleep 1
Then anonymous users can see the actions new ordering
Given a logged-in administrator
and the actions control panel
When I change the actions order
and Sleep 1
Then anonymous users can see the actions new ordering

Scenario: Create a new action in Actions Control Panel
Given a logged-in administrator
and the actions control panel
When I add a new action
Sleep 1
Then logged-in users can see the new action
Given a logged-in administrator
and the actions control panel
When I add a new action
and Sleep 1
Then logged-in users can see the new action

Scenario: Hide/show an action in Actions Control Panel
Given a logged-in administrator
and the actions control panel
When I hide an action
Sleep 1
Then anonymous users cannot see the action anymore
Given a logged-in administrator
and the actions control panel
When I unhide the action
Sleep 1
Then anonymous users can see the action again
Given a logged-in administrator
and the actions control panel
When I hide an action
and Sleep 1
Then anonymous users cannot see the action anymore
Given a logged-in administrator
and the actions control panel
When I unhide the action
and Sleep 1
Then anonymous users can see the action again

Scenario: Delete an action in Actions Control Panel
Given a logged-in administrator
and the actions control panel
When I delete an action
Sleep 1
Then anonymous users cannot see the action anymore
Given a logged-in administrator
and the actions control panel
When I delete an action
and Sleep 1
Then anonymous users cannot see the action anymore

*** Keywords *****************************************************************
*** Keywords ***

# --- GIVEN ------------------------------------------------------------------
# GIVEN

a logged-in administrator
Enable autologin as Manager
Enable autologin as Manager


the actions control panel
Go to ${PLONE_URL}/@@actions-controlpanel
Wait until page contains Portal actions
Go to ${PLONE_URL}/@@actions-controlpanel
Get Text //body contains Portal actions

# --- WHEN -------------------------------------------------------------------
# WHEN

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
Wait For Then Click Element css=.pattern-modal-buttons > button
Click //*[@id="content-core"]/section[2]/section/ol/li[1]/form/a
Get Text //body contains Action Settings
Type Text //input[@name="form.widgets.title"] A new site map
Click //div[contains(@class,'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
Wait For Then Click Element css=.pattern-modal-buttons > button
Click //*[@id="content-core"]/section[2]/section/ol/li[1]/form/a
Get Text //body contains Action Settings
Type Text //input[@name="form.widgets.position"] 3
Click //div[contains(@class,'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
Wait For Then Click Element css=.pattern-modal-buttons > button
Wait until page contains favorites
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
Wait For Then Click Element css=.pattern-modal-buttons > button
Click //*[@id="content-core"]/p[@class="addAction"]/a
Get Text //body contains New action
Select Options By //select[@name="form.widgets.category:list"] label User actions
Type Text //input[@name="form.widgets.id"] favorites
Click //div[contains(@class,'pattern-modal-buttons')]/button
Get Text //body contains favorites
Click //*[@id="content-core"]/section[6]/section/ol/li[8]/form/a
Get Text //body contains Action Settings
Type Text //input[@name="form.widgets.title"] My favorites
Type Text //input[@name="form.widgets.url_expr"] string:\${globals_view/navigationRootUrl}/favorites
Click //div[contains(@class,'pattern-modal-buttons')]/button

I delete an action
Click Button css=section:nth-child(3) li:first-child button[name=delete]
Handle alert

I hide an action
Click Button css=section:nth-child(3) li:first-child button[name=hide]
Click //*[@id="content-core"]/section[2]/section/ol/li[1]/form/button[@name="hide"]


I unhide the action
Click Button css=section:nth-child(3) li:first-child button[name=show]
Click //*[@id="content-core"]/section[2]/section/ol/li[1]/form/button[@name="show"]


# --- THEN -------------------------------------------------------------------
I delete an action
Handle Future Dialogs action=accept
Click //*[@id="content-core"]/section[2]/section/ol/li[1]/form/button[@name="delete"]


# THEN

anonymous users can see the new action title
Disable autologin
Go to ${PLONE_URL}
Wait until page contains Accessibility
Page Should Contain A new site map
Disable autologin
Go to ${PLONE_URL}
Get Text //body contains A new site map


anonymous users can see the actions new ordering
Disable autologin
Go to ${PLONE_URL}
Wait until page contains Accessibility
Page Should Contain Element xpath=//div[@id='portal-footer']//ul/li[1]/a/span[contains(text(), 'Accessibility')]
Page Should Contain Element xpath=//div[@id='portal-footer']//ul/li[3]/a/span[contains(text(), 'Site Map')]
Disable autologin
Go to ${PLONE_URL}
Get Element //div[@id='portal-footer']//ul/li[1]/a/span[contains(text(), 'Accessibility')]
Get Element //div[@id='portal-footer']//ul/li[3]/a/span[contains(text(), 'Site Map')]


logged-in users can see the new action
Disable autologin
Enable autologin as Contributor
Go to ${PLONE_URL}
Wait until page contains Accessibility
Page Should Contain My favorites
Disable autologin
Enable autologin as Contributor
Go to ${PLONE_URL}
Get Element Count //*[@id="personaltools-favorites"] should be 1
Get Text //*[@id="personaltools-favorites"] contains My favorites


anonymous users cannot see the action anymore
Disable autologin
Go to ${PLONE_URL}
Wait until page contains Accessibility
Page Should Not Contain Site Map
Disable autologin
Go to ${PLONE_URL}
Get Text //body not contains Site Map


anonymous users can see the action again
Disable autologin
Go to ${PLONE_URL}
Wait until page contains Accessibility
Page Should Contain Site Map
Disable autologin
Go to ${PLONE_URL}
Get Text //body contains Site Map

0 comments on commit 522f942

Please sign in to comment.