Skip to content

Commit

Permalink
Merge pull request #1310 from creative-commoners/pulls/1/group-title-…
Browse files Browse the repository at this point in the history
…test

MNT Add new behat test for Group title validation
  • Loading branch information
kinglozzer authored Jun 13, 2022
2 parents eb192f4 + b00e44c commit a014910
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 46 deletions.
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"

0 comments on commit a014910

Please sign in to comment.