diff --git a/news/3813.feature b/news/3813.feature new file mode 100644 index 00000000..539757b0 --- /dev/null +++ b/news/3813.feature @@ -0,0 +1,3 @@ +Update robot framework tests to use +`robotframework-browser` (`playwright` integration on robotframework). +[gforcada] diff --git a/plone/app/discussion/tests/robot/keywords.robot b/plone/app/discussion/tests/robot/keywords.robot new file mode 100644 index 00000000..331bae6d --- /dev/null +++ b/plone/app/discussion/tests/robot/keywords.robot @@ -0,0 +1,16 @@ +*** Keywords *** + +I enable discussion on the document + Go To ${PLONE_URL}/my-document/edit + Get Text body contains Settings + Click .autotoc-nav >> "Settings" + Select Options By id=formfield-form-widgets-IAllowDiscussion-allow_discussion >> select text Yes + Click "Save" + +I add a comment + Type Text id=form-widgets-comment-text This is a comment + Click css=button[name="form.buttons.comment"] + +I can see that the comment is gone + Go To ${PLONE_URL}/my-document/view + Get Element Count css=.comment-body == 0 diff --git a/plone/app/discussion/tests/robot/test_allow_discussion.robot b/plone/app/discussion/tests/robot/test_allow_discussion.robot index d2ed6117..e9c7389e 100644 --- a/plone/app/discussion/tests/robot/test_allow_discussion.robot +++ b/plone/app/discussion/tests/robot/test_allow_discussion.robot @@ -1,16 +1,14 @@ -*** 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 -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: Allow comments for Link Type Given a logged-in manager @@ -18,49 +16,62 @@ Scenario: Allow comments for Link Type and the types control panel When I select 'Link' in types dropdown and Allow discussion - Then Wait until page contains Content Settings + Then Wait For Condition Text //body contains Content Settings + When I add new Link 'my_link' - Then Link 'my_link' should have comments enabled + Then Link 'my_link' should have comments enabled -*** Keywords ***************************************************************** +*** Keywords *** -# --- GIVEN ------------------------------------------------------------------ +# GIVEN a logged-in manager - Enable autologin as Manager + Enable autologin as Manager the types control panel - Go to ${PLONE_URL}/@@content-controlpanel - Wait until page contains Content Settings + Go to ${PLONE_URL}/@@content-controlpanel + Wait For Condition Text //body contains Content Settings Globally enabled comments - Go to ${PLONE_URL}/@@discussion-settings - Wait until page contains Discussion settings - Select checkbox name=form.widgets.globally_enabled:list - Click button Save - + Go to ${PLONE_URL}/@@discussion-settings + Wait For Condition Text //body contains Discussion settings + Check Checkbox //input[@name="form.widgets.globally_enabled:list"] + Click //button[@name="form.buttons.save"] -# --- WHEN ------------------------------------------------------------------- +# WHEN I select '${content_type}' in types dropdown - Select from list by label name=type_id ${content_type} - Wait until page contains Globally addable + Select Options By //select[@name="type_id"] label ${content_type} + Wait For Condition Text //body contains Globally addable Allow discussion - Select checkbox name=allow_discussion:boolean - Click Button Save + Check Checkbox //input[@name="allow_discussion:boolean"] + Click //button[@name="form.button.Save"] I add new Link '${id}' - Go to ${PLONE_URL} - Wait until page contains Plone site - Create content type=Link id=${id} title=${id} remoteUrl=http://www.starzel.de + Go to ${PLONE_URL} + Wait For Condition Text //body contains Plone site + Create content + ... type=Link + ... id=${id} + ... title=${id} + ... remoteUrl=http://www.starzel.de -# --- THEN ------------------------------------------------------------------- +# THEN Link '${id}' should have comments enabled - Go to ${PLONE_URL}/${id} - Wait until page contains ${id} - Page should contain element xpath=//div[@id="commenting"] + Go to ${PLONE_URL}/${id} + Wait For Condition Text //body contains ${id} + Get Element Count //div[@id="commenting"] should be 1 + +# 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 \ No newline at end of file diff --git a/plone/app/discussion/tests/robot/test_discussion.robot b/plone/app/discussion/tests/robot/test_discussion.robot index 54b8f4a1..28160575 100644 --- a/plone/app/discussion/tests/robot/test_discussion.robot +++ b/plone/app/discussion/tests/robot/test_discussion.robot @@ -1,23 +1,13 @@ -# ============================================================================ -# Test basic discussion features (adding, replying, deleting) -# ============================================================================ -# -# $ bin/robot-server plone.app.discussion.testing.PLONE_APP_DISCUSSION_ROBOT_TESTING -# $ bin/robot src/plone.app.discussion/src/plone/app/discussion/tests/robot/test_discussion.robot -# -# ============================================================================ - *** Settings *** -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 Test Setup Run Keywords Plone test setup Test Teardown Run keywords Plone test teardown - *** Test Cases *** Enable Discussion on a Document @@ -35,11 +25,16 @@ Add Comment to a Document Reply to a comment on a Document Given a logged-in Site Administrator and a document with discussion enabled + and I add a comment + When I reply to a comment + Then I can see the reply Delete Comment from a Document Given a logged-in Site Administrator and a document with discussion enabled - + and I add a comment + When I delete the comment + Then I can see that the comment is gone *** Keywords *** @@ -58,28 +53,26 @@ a document with discussion enabled # When -I enable discussion on the document - Go To ${PLONE_URL}/my-document/edit - Wait until page contains Settings - Click Link Settings - Wait until element is visible name=form.widgets.IAllowDiscussion.allow_discussion:list - Select From List By Value name=form.widgets.IAllowDiscussion.allow_discussion:list True - Click Button Save - -I add a comment - Wait until page contains element id=form-widgets-comment-text - Input Text id=form-widgets-comment-text This is a comment - Click Button Comment +I reply to a comment + Click "Reply" + Fill Text css=div[id^=formfield-form-widgets-new] > textarea My reply text + Click css=.discussion button[name="form.buttons.comment"] +I delete the comment + Click css=button[name="form.button.DeleteComment"] # Then I can see a comment form on the document Go To ${PLONE_URL}/my-document/view - Wait until page contains My Document - Page should contain Add comment - Page should contain element id=form-widgets-comment-text + Get Text h1 == My Document + Get Text legend == Add comment + Get Element id=form-widgets-comment-text I can see the comment below the document Go To ${PLONE_URL}/my-document/view - Page should contain This is a comment + Get Text css=.comment-body > p == This is a comment + +I can see the reply + Go To ${PLONE_URL}/my-document/view + Get Text css=.level-1 .comment-body > p == My reply text diff --git a/plone/app/discussion/tests/robot/test_moderation.robot b/plone/app/discussion/tests/robot/test_moderation.robot index ce231e39..4401bf08 100644 --- a/plone/app/discussion/tests/robot/test_moderation.robot +++ b/plone/app/discussion/tests/robot/test_moderation.robot @@ -1,7 +1,7 @@ *** Settings *** -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 @@ -16,7 +16,7 @@ Add a Comment to a Document and bulk delete it and workflow multiple enabled and a document with discussion enabled When I add a comment and delete it - Then I can not see the comment below the document + Then I can see that the comment is gone Last history entry is shown Given a logged-in Site Administrator @@ -49,49 +49,28 @@ a document with discussion enabled # When -I enable discussion on the document - Go To ${PLONE_URL}/my-document/edit - Wait until page contains Settings - Click Link Settings - Wait until element is visible name=form.widgets.IAllowDiscussion.allow_discussion:list - Select From List By Value name=form.widgets.IAllowDiscussion.allow_discussion:list True - Click Button Save - -I add a comment - Wait until page contains element id=form-widgets-comment-text - Input Text id=form-widgets-comment-text This is a comment - Click Button Comment - I add a comment and delete it - Wait until page contains element id=form-widgets-comment-text - Input Text id=form-widgets-comment-text This is a comment - Click Button Comment + Fill Text id=form-widgets-comment-text This is a comment + Click css=button[name="form.buttons.comment"] Go To ${PLONE_URL}/@@moderate-comments?review_state=all - Wait Until Element Is Visible css=option[value=delete] - Wait Until Keyword Succeeds 5x 1s Select And Check xpath://select[@name='form.select.BulkAction'] delete - Wait Until Element Is Visible css=[name=check_all] - Wait Until Element Is Enabled css=[name=check_all] - Wait Until Element Is Visible css=[name="paths:list"] - Wait Until Element Is Enabled css=[name="paths:list"] - Wait for Condition return jQuery._data( jQuery('[name=check_all]')[0], "events" )?.click?.length == 2 - Select Checkbox name=check_all - Wait Until Element Is Visible css=[name="paths:list"]:checked - Wait For Then Click Element css=button[name="form.button.BulkAction"] - Wait Until Page Does Not Contain This is a comment + Get Text body contains Bulk Actions + Select Options By select[name="form.select.BulkAction"] text Delete + Check Checkbox input[name="check_all"] + Click "Apply" + Get Element Count table > tbody > tr == 0.0 workflow multiple enabled Go To ${PLONE_URL}/@@content-controlpanel?type_id=Discussion%20Item&new_workflow=comment_review_workflow - Execute Javascript window.scroll(0, 2000) - Click Button Save + Click "Save" # Then I can not see the comment below the document Go To ${PLONE_URL}/my-document/view - Wait until page contains My Document + Get Text body contains My Document Page should not contain This is a comment I can see the last history entry in moderation view Go To ${PLONE_URL}/@@moderate-comments?review_state=all - Wait until page contains element name=form.select.BulkAction - Page should contain Create + Get Text body contains Bulk Actions + Get Text table contains Create