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

MNT Add new behat test for Group title validation #1310

Merged
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
47 changes: 47 additions & 0 deletions tests/behat/features/manage-groups.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@javascript @retry
Feature: Manage groups
As a site administrator
I want to create and manage user groups on my site
So that I can control access to the CMS

Background:
Given a "group" "BOB group"
And a "group" "Jane group" with permissions "View draft content"
And the "page" "My page"
And I am logged in with "ADMIN" permissions
And I go to "/admin/security"

Scenario: I can create a new group with permissions
# Create a user group
When I click the "Groups" CMS tab
And I press the "Add Group" button
And I fill in "Group name" with "MyGroup"
And I press the "Create" button
Then I should not see "Validation Error"

# Assign various permissions to the group
And I click the "Permissions" CMS tab
And I check "View draft content"
And I press the "Save" button
Then I should not see "Validation Error"

Scenario: Group cannot have a blank name
When I click the "Groups" CMS tab
And I press the "Add Group" button
And I fill in "Group name" with ""
And I press the "Create" button
Then I should see "Validation Error"

Scenario: Members of a group without permissions cannot view draft content
Given I go to "/Security/login"
And I press the "Log in as someone else" button
And I am logged in with "BOB" permissions
When I go to "/my-page?stage=Stage"
Then I should not see "My page"

Scenario: Members of a group with relevant permissions can view draft content
Given I go to "/Security/login"
And I press the "Log in as someone else" button
And I am logged in with "Jane" permissions
When I go to "/my-page?stage=Stage"
Then I should see "My page"
46 changes: 0 additions & 46 deletions tests/behat/features/manage-users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -131,49 +131,3 @@ Feature: Manage users
And I press the "Delete" button, confirming the dialog
Then I should see "[email protected]"
And I should not see "[email protected]"

Scenario: User group

Given the "group" "BOB group"
And the "page" "My page" has the "Content" "<p>My content</p>"

# Login to create BOB member
When I go to "/Security/login"
And I press the "Log in as someone else" button
And I am logged in with "BOB" permissions

# BOB cannot view draft content
When I go to "/my-page?stage=Stage"
Then I should not see "My page"

# Log back in as ADMIN
When I go to "/Security/login"
And I press the "Log in as someone else" button
And I am logged in with "ADMIN" permissions

# Create a user group
And I go to "/admin/security"
And I click the "Groups" CMS tab
And I press the "Add Group" button
And I fill in "Group name" with "MyGroup"
And I press the "Create" button

# Assign various permissions to the group
And I click the "Permissions" CMS tab
And I check "View draft content"
And I press the "Save" button

# Users that belong to that group have permissions applied
And I click the "Members" CMS tab
And I fill in "Form_ItemEditForm_gridfield_relationsearch" with "BOB"
And I click on the ".ui-menu-item > a" element
And I click on the "#Form_ItemEditForm_action_gridfield_relationadd" element

# Log back in as BOB
Given I go to "/Security/login"
And I press the "Log in as someone else" button
And I am logged in with "BOB" permissions

# BOB can now view draft content
When I go to "/my-page?stage=Stage"
Then I should see "My page"