Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROD-29886: Behat tests for visibilities and comments #3985

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/behat/features/capabilities/comment/comments-hidden.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@api
Feature: Comments settings
As a manager I want to hide comments
on a topic
so that users can't see the comment on the content

Scenario: I add a comment on a topic
Given I am logged in as a user with the contentmanager role

When I go to "/node/add/topic"
And I fill in "Title" with "Topic with comments"
And I fill in the "edit-body-0-value" WYSIWYG editor with "Topic description"
And I check the box "News"
And I press "Create topic"
And I should see "Topic Topic with comments has been created."
And I should see "Topic with comments" in the "Hero block"
And I should see "Topic description" in the "Main content"
And I fill in the following:
| Add a comment | This is a test comment |
And I press "Comment"

Then I should see the success message "Your comment has been posted."
And I should see the heading "Comments (1)" in the "Main content"
And I should see "This is a test comment" in the "Main content"

# Scenario: I hide comments on the topic
And I am editing the topic "Topic with comments"
And I fill in "Title" with "Topic with hidden comments"
And I click radio button "Hidden"
And I press "Save"
And I should see "Topic Topic with hidden comments has been updated."
And I should see "Topic with hidden comments" in the "Hero block"
And I should not see "This is a test comment" in the "Main content"
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@api
Feature: Validate access and visibility of events for Anonymous user and content manager

Background:
Given I enable the module "social_group_flexible_group"
And events with non-anonymous author:
| title | body | field_event_date | field_event_date_end | field_content_visibility |
| Public event | Body description text. | 2035-01-01T11:00:00 | 2035-01-02T18:00:00 | public |
| Community event | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | community |
#Create event with different visibility in a flexible group
And groups with non-anonymous owner:
| label | field_group_description | field_flexible_group_visibility | field_group_allowed_visibility |type |
| Flexible group for event| Description of Flexible group | public | public,community,group |flexible_group |
And events with non-anonymous author:
| title | body | field_event_date | field_event_date_end | group | field_content_visibility |
| Public event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-02T18:00:00 | Flexible group for event | public |
| Community event in group| Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | Flexible group for event | community |
| Secret event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | Flexible group for event | group |

Scenario: Anonymous user should only see public events
Given I am an anonymous user

When I am on "/community-events"

Then I should see "Public event"
And I should not see "Community event"
And I should see "Public event in group"
And I should not see "Community event in group"
And I should not see "Secret event in group"

And I open the "event" node with title "Public event"
And I should see "Public event"

And I open the "event" node with title "Public event in group"
And I should see "Public event in group"

And I open the "event" node with title "Community event"
And I should not see "Community event"
And I should see "Access denied"

And I open the "event" node with title "Community event in group"
And I should not see "Community event in group"
And I should see "Access denied"

And I open the "event" node with title "Secret event in group"
And I should not see "Secret event in group"
And I should see "Access denied"

Scenario: Content manager should see all events
Given I am logged in as a user with the contentmanager role

When I am on "/community-events"

Then I should see "Public event"
And I should see "Community event"
And I should see "Public event in group"
And I should see "Community event in group"
And I should see "Secret event in group"

And I open the "event" node with title "Public event"
And I should see "Public event"

And I open the "event" node with title "Public event in group"
And I should see "Public event in group"

And I open the "event" node with title "Community event"
And I should see "Community event"

And I open the "event" node with title "Community event in group"
And I should see "Community event in group"

And I open the "event" node with title "Secret event in group"
And I should see "Secret event in group"
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@api
Feature: Validate access and visibility of events for Authenticated User (AU)

Background:
Given events with non-anonymous author:
| title | body | field_event_date | field_event_date_end | field_content_visibility |
| Public event | Body description text. | 2035-01-01T11:00:00 | 2035-01-02T18:00:00 | public |
| Community event | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | community |
And I enable the module "social_group_flexible_group"
And groups with non-anonymous owner:
| label | field_group_description | field_flexible_group_visibility | field_group_allowed_visibility |type |
| Flexible group for event | Description of Flexible group | public | public,community,group |flexible_group |
And events with non-anonymous author:
| title | body | field_event_date | field_event_date_end | group | field_content_visibility |
| Public event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-02T18:00:00 | Flexible group for event | public |
| Community event in group| Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | Flexible group for event | community |
|Secret event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | Flexible group for event | group |

Scenario: Unverified user should only see public events
Given I disable that the registered users to be verified immediately
And I am logged in as an "authenticated user"

When I am on "/community-events"

Then I should see "Public event"
And I should not see "Community event"
And I should see "Public event in group"
And I should not see "Community event in group"
And I should not see "Secret event in group"

And I open the "event" node with title "Public event"
And I should see "Public event"

And I open the "event" node with title "Public event in group"
And I should see "Public event in group"

And I open the "event" node with title "Community event"
And I should not see "Community event"
And I should see "Access denied"
And I should see "You are not authorized to access this page."

And I open the "event" node with title "Community event in group"
And I should not see "Community event in group"
And I should see "Access denied"
And I should see "You are not authorized to access this page."

And I open the "event" node with title "Secret event in group"
And I should not see "Secret event in group"
And I should see "Access denied"
And I should see "You are not authorized to access this page."
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@api
Feature: Validate access and visibility of events for Verified User (VU)

Background:
Given I enable the module "social_group_flexible_group"
And events with non-anonymous author:
| title | body | field_event_date | field_event_date_end | field_content_visibility |
| Public event | Body description text. | 2035-01-01T11:00:00 | 2035-01-02T18:00:00 | public |
| Community event | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | community |
And groups with non-anonymous owner:
| label | field_group_description | field_flexible_group_visibility | field_group_allowed_visibility |type |
| Flexible group for event | Description of Flexible group | public | public,community,group |flexible_group |
And events with non-anonymous author:
| title | body | field_event_date | field_event_date_end | group | field_content_visibility |
| Public event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-02T18:00:00 | Flexible group for event | public |
| Community event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | Flexible group for event | community |
|Secret event in group | Body description text. | 2035-01-01T11:00:00 | 2035-01-01T18:00:00 | Flexible group for event | group |
And users:
| name | mail | status |
| Group Member | group_member@example.com | 1 |
#Add a user to the group
And I am logged in as a user with the sitemanager role
And I am on "/all-groups"
And I click "Flexible group for event"
And I click "Manage members"
And I click the group member dropdown
And I click "Add directly"
And I fill in select2 input ".form-type-select" with "Group Member" and select "Group Member"
And I wait for AJAX to finish
And I press "Save"
And I should see "1 new member joined the group."

Scenario: Verified user should see public and community events
Given I am logged in as a user with the verified role

When I am on "/community-events"

Then I should see "Public event"
And I should see "Community event"
And I should see "Public event in group"
And I should see "Community event in group"
And I should not see "Secret event in group"

And I open the "event" node with title "Public event"
And I should see "Public event"

And I open the "event" node with title "Public event in group"
And I should see "Public event in group"

And I open the "event" node with title "Community event"
And I should see "Community event"

And I open the "event" node with title "Community event in group"
And I should see "Community event in group"

And I open the "event" node with title "Secret event in group"
And I should not see "Secret event in group"
And I should see "Access denied"
And I should see "You are not authorized to access this page."

Scenario: Verified user group member should see all events of the group
Given I am logged in as "Group Member"

When I am on "/community-events"

Then I should see "Public event"
And I should see "Community event"
And I should see "Public event in group"
And I should see "Community event in group"
And I should see "Secret event in group"

And I open the "event" node with title "Public event"
And I should see "Public event"

And I open the "event" node with title "Public event in group"
And I should see "Public event in group"

And I open the "event" node with title "Community event"
And I should see "Community event"

And I open the "event" node with title "Community event in group"
And I should see "Community event in group"

And I open the "event" node with title "Secret event in group"
And I should see "Secret event in group"
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@api
Feature: Validate access and visibility of topics for Anonymous user and content manager

Background:
Given I enable the module "social_group_flexible_group"
And topics with non-anonymous author:
| title | field_topic_type | status | field_content_visibility | body |
| This is a topic for public | Blog | 1 | public | Testing public visibility |
| This is a topic for community | Blog | 1 | community | Testing community visibility |
And groups with non-anonymous owner:
| label | field_group_description | field_flexible_group_visibility | field_group_allowed_visibility |type |
| Flexible group for topic | Description of Flexible group | public | public,community,group |flexible_group |
And topics with non-anonymous author:
| title | body | group | field_content_visibility | field_topic_type |
| This is a public topic in group | Descriptions | Flexible group for topic | public | Blog |
| This is a community topic in group | Descriptions | Flexible group for topic | community | Blog |
| This is a secret topic in group | Descriptions | Flexible group for topic | group | Blog |

Scenario: Anonymous user should only see public topics
Given I am an anonymous user

When I am on "/all-topics"

Then I should see "This is a topic for public"
And I should not see "This is a topic for community"
And I should see "This is a public topic in group"
And I should not see "This is a community topic in group"
And I should not see "This is a secret topic in group"

And I open the "topic" node with title "This is a topic for community"
And I should not see "This is a topic for community"
And I should see "Access denied"

And I open the "topic" node with title "This is a community topic in group"
And I should not see "This is a community topic in group"
And I should see "Access denied"

And I open the "topic" node with title "This is a secret topic in group"
And I should not see "This is a secret topic in group"
And I should see "Access denied"

And I open the "topic" node with title "This is a topic for public"
And I should see "This is a topic for public"

And I open the "topic" node with title "This is a public topic in group"
And I should see "This is a public topic in group"

Scenario: Content manager should see all topics
Given I am logged in as a user with the contentmanager role

When I am on "/all-topics"

Then I should see "This is a topic for public"
And I should see "This is a topic for community"
And I should see "This is a public topic in group"
And I should see "This is a community topic in group"
And I should see "This is a secret topic in group"

And I open the "topic" node with title "This is a topic for public"
And I should see "This is a topic for public"

And I open the "topic" node with title "This is a public topic in group"
And I should see "This is a public topic in group"

And I open the "topic" node with title "This is a topic for community"
And I should see "This is a topic for community"

And I open the "topic" node with title "This is a community topic in group"
And I should see "This is a community topic in group"

And I open the "topic" node with title "This is a secret topic in group"
And I should see "This is a secret topic in group"
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@api
Feature: Validate access and visibility of topics for Authenticated User (AU)

Background:
Given I enable the module "social_group_flexible_group"
And topics with non-anonymous author:
| title | field_topic_type | status | field_content_visibility | body |
| This is a topic for public | Blog | 1 | public | Testing public visibility |
| This is a topic for community | Blog | 1 | community | Testing community visibility |
And groups with non-anonymous owner:
| label | field_group_description | field_flexible_group_visibility | field_group_allowed_visibility |type |
| Flexible group for topic| Description of Flexible group | public | public,community,group |flexible_group |
And topics with non-anonymous author:
| title | body | group | field_content_visibility | field_topic_type |
| This is a public topic in group | Descriptions | Flexible group for topic | public | Blog |
| This is a community topic in group| Descriptions | Flexible group for topic | community | Blog |
| This is a secret topic in group | Descriptions | Flexible group for topic | group | Blog |

Scenario: Unverified user should only see public topics
Given I disable that the registered users to be verified immediately
And I am logged in as an "authenticated user"

When I am on "/all-topics"

Then I should see "This is a topic for public"
And I should not see "This is a topic for community"
And I should see "This is a public topic in group"
And I should not see "This is a community topic in group"
And I should not see "This is a secret topic in group"

And I open the "topic" node with title "This is a topic for community"
And I should not see "This is a topic for community"
And I should see "Access denied"
And I should see "You are not authorized to access this page."

And I open the "topic" node with title "This is a community topic in group"
And I should not see "This is a community topic in group"
And I should see "Access denied"
And I should see "You are not authorized to access this page."

And I open the "topic" node with title "This is a secret topic in group"
And I should not see "This is a secret topic in group"
And I should see "Access denied"
And I should see "You are not authorized to access this page."

And I open the "topic" node with title "This is a topic for public"
And I should see "This is a topic for public"

And I open the "topic" node with title "This is a public topic in group"
And I should see "This is a public topic in group"
Loading
Loading