Skip to content

Instantly share code, notes, and snippets.

@jonpugh
Last active September 15, 2015 17:01
Show Gist options
  • Save jonpugh/f7486609d801ea61e96d to your computer and use it in GitHub Desktop.
Save jonpugh/f7486609d801ea61e96d to your computer and use it in GitHub Desktop.
A big test for access control
Feature: MyEngageNY: Community Content
Background:
Given users:
| name | mail | status | roles |
| group_owner | [email protected] | 1 | local test user |
| non_member | [email protected] | 1 | local test user |
| member_user | [email protected] | 1 | local test user |
| moderator | [email protected] | 1 | local test user |
| contentadmin| [email protected] | 1 | local test user, content administrator |
@api
Scenario: Admin Discussion Editing.
NYS_EDP-BUG-2424
System Admin is Editing a Discussion/Resource/Announcement in Community
Field doesn't keep the default value of the same Community
(Only happens as an admin editing a node in a group which you are not a member.)
# Create a community as a normal user
Given I am logged in as a user with the "local test user" role
Then I start a "public" community called "Content Edit Bug Community"
# Visit that community as an admin
Then I am logged in as a user with the "content administrator" role
When I visit the community "Content Edit Bug Community"
# Post a discussion in this community
Then I fill in "body[und][0][value]" with "This is not my community"
And I press "Post"
Then I should see "This is not my community" in the ".teaser" element
# Attempt to edit the discussion
When I click "Edit"
# Validate the correct default value for community field.
Then the select list "edit-og-group-ref-und-0-default" should be set to "Content Edit Bug Community"
@api
Scenario: Try to post empty content and an empty comment.
NYS_EDP-BUG-3388
NYS_EDP-BUG-3389
Does not validate blank space for the resource comments and creates one with empty comments
Given I am logged in as a user with the "local test user" role
When I start a "public" community called "Content Edit Bug Community"
Then I fill in "body[und][0][value]" with ""
And I press "Post"
Then I should see "Discussion field is required"
Then I fill in "body[und][0][value]" with "Hello World"
And I press "Post"
Then I should see "The discussion has been added."
When I fill in "comment_body[und][0][value]" with "<span><p> </p></span>"
And I press "Reply"
Then I should see "Empty values are not allowed!"
When I fill in "comment_body[und][0][value]" with "Comment Content"
And I press "Reply"
Then I should see "Comment Content"
@api
Scenario Outline: I can create content for my communities with proper visibility.
Given I am logged in as "group_owner"
And I start a "<type>" community called "<name>"
When I visit the community "<name>"
And I fill in "edit-body-und-0-value" with "<discussion text>"
And I press "Post"
Then I should see "The discussion has been added."
And I should not see "The discussion has been updated."
Then I should see "<discussion text>"
# Logged in users should be able to find public content on the community page
Given I am logged in as "non_member"
When I visit the community "<name>"
Then I <visibility> see "<discussion text>"
# Logged in users should be able to find public content in search results
When I search for "<discussion text>"
Then the "h3" element <visibility> contain "<discussion text>"
# Content admin users should always be able to find public and private content on the community page
# and in the search results.
Given I am logged in as "contentadmin"
When I visit the community "<name>"
Then I should see "<discussion text>"
When I search for "<discussion text>"
Then the "h3" element should contain "<discussion text>"
# Anonymous users should never be able to find community content in search results
Given I am an anonymous user
When I search for "<discussion text>"
Then the "h3" element should not contain "<discussion text>"
Examples:
| type | name | discussion text | visibility |
| public | My Test Community | Public Discussion (public) | should |
| invite | My Test Invite Community | Public Discussion (invite) | should |
| private | My Test Private Community | Private Discussion (private) | should not |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment