Skip to content

Commit

Permalink
feat(robot): use playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Oct 6, 2023
1 parent 1505482 commit 137b805
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 57 deletions.
16 changes: 16 additions & 0 deletions plone/app/discussion/tests/robot/keywords.robot
Original file line number Diff line number Diff line change
@@ -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
Fill 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
51 changes: 22 additions & 29 deletions plone/app/discussion/tests/robot/test_discussion.robot
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ***

Expand All @@ -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
42 changes: 14 additions & 28 deletions plone/app/discussion/tests/robot/test_moderation.robot
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -43,42 +43,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 page contains element name=form.select.BulkAction
Select from list by value xpath://select[@name='form.select.BulkAction'] delete
Select Checkbox name=check_all
Click Button Apply
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
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

0 comments on commit 137b805

Please sign in to comment.