Skip to content

Commit

Permalink
Merge pull request #35736 from owncloud/webUI-test-shareOnlyWithMembe…
Browse files Browse the repository at this point in the history
…rshipGroups

Add webUI tests for share only with membership groups
  • Loading branch information
paurakhsharma authored Jul 3, 2019
2 parents fd8c3d7 + 82b2a2f commit bb93190
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,17 @@ public function theAdministratorEnablesExcludeGroupsFromSharingUsingTheWebui() {
);
}

/**
* @When the administrator enables restrict users to only share with groups they are member of using the webUI
*
* @return void
*/
public function theAdministratorEnablesRestrictUsersToOnlyShareWithGroupsTheyAreMemberOfUsingTheWebui() {
$this->adminSharingSettingsPage->restrictUserToOnlyShareWithMembershipGroup(
$this->getSession()
);
}

/**
* @When the administrator adds group :group to the exclude group from sharing list using the webUI
* @Given the administrator has added group :group to the exclude group from sharing list from the admin sharing settings page
Expand Down
24 changes: 21 additions & 3 deletions tests/acceptance/features/lib/AdminSharingSettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
* Admin Sharing Settings page.
*/
class AdminSharingSettingsPage extends SharingSettingsPage {

/**
*
* @var string $path
*/
protected $path = '/index.php/settings/admin?sectionid=sharing';

protected $shareApiCheckboxXpath = '//label[@for="shareAPIEnabled"]';
protected $shareApiCheckboxId = 'shareAPIEnabled';
protected $publicShareCheckboxXpath = '//label[@for="allowLinks"]';
Expand All @@ -59,8 +59,10 @@ class AdminSharingSettingsPage extends SharingSettingsPage {
protected $onlyShareWithGroupMembersCheckboxId = 'onlyShareWithGroupMembers';
protected $excludeGroupFromSharingCheckboxXpath = '//label[@for="shareapiExcludeGroups"]';
protected $excludeGroupFromSharingCheckboxId = 'shareapiExcludeGroups';

protected $excludeGroupsFromSharingListFieldXpath = '//p[@id="selectExcludedGroups"]//input[contains(@class,"select2-input")]';

protected $onlyShareWithMembershipGroupsCheckboxXpath = '//label[@for="onlyShareWithMembershipGroups"]';
protected $onlyShareWithMembershipGroupsCheckboxId = 'onlyShareWithMembershipGroups';
protected $excludeGroupFromSharesFieldXpath = '//div[@id="files_sharing"]//input[contains(@class,"select2-input")]';
protected $groupListXpath = '//div[@id="select2-drop"]//li[contains(@class, "select2-result")]';
protected $groupListDropDownXpath = "//div[@id='select2-drop']";
Expand Down Expand Up @@ -276,6 +278,22 @@ public function enableExcludeGroupFromSharing(Session $session) {
);
}

/**
* enable restrict users to only share with groups they are member of
*
* @param Session $session
*
* @return void
*/
public function restrictUserToOnlyShareWithMembershipGroup(Session $session) {
$this->toggleCheckbox(
$session,
"enables",
$this->onlyShareWithMembershipGroupsCheckboxXpath,
$this->onlyShareWithMembershipGroupsCheckboxId
);
}

/**
* add group to group sharing blacklist
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,40 @@ Feature: Sharing files and folders with internal groups
| group_id1 | group_id2 | group_id3 |
| case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP |
| Case-Sensitive-Group | CASE-SENSITIVE-GROUP | case-sensitive-group |
| CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group |
| CASE-SENSITIVE-GROUP | case-sensitive-group | Case-Sensitive-Group |

Scenario: sharer should not be able to share a folder to a group which he/she is not member of when share with groups they are member of is enabled
Given group "grp2" has been created
And user "user1" has created folder "/simple-folder"
And the administrator has browsed to the admin sharing settings page
When the administrator enables restrict users to only share with groups they are member of using the webUI
And the user re-logs in as "user1" using the webUI
And the user opens the share dialog for folder "simple-folder"
And the user types "grp2" in the share-with-field
Then a tooltip with the text "No users or groups found for grp2" should be shown near the share-with-field on the webUI

Scenario: sharer should not be able to share a file to a group which he/she is not member of when share with groups they are member of is enabled
Given group "grp2" has been created
And user "user1" has uploaded file with content "some content" to "lorem.txt"
And the administrator has browsed to the admin sharing settings page
When the administrator enables restrict users to only share with groups they are member of using the webUI
And the user re-logs in as "user1" using the webUI
And the user opens the share dialog for file "lorem.txt"
And the user types "grp2" in the share-with-field
Then a tooltip with the text "No users or groups found for grp2" should be shown near the share-with-field on the webUI

Scenario: sharer should be able to share a folder to his/her own group when only share with groups they are member of is enabled
Given user "user1" has created folder "/simple-folder"
And the administrator has browsed to the admin sharing settings page
When the administrator enables restrict users to only share with groups they are member of using the webUI
And the user re-logs in as "user1" using the webUI
And the user shares folder "simple-folder" with group "grp1" using the webUI
Then as "user2" folder "/simple-folder" should exist

Scenario: sharer should be able to share a file to his/her own group when only share with groups they are member of is enabled
Given user "user1" has uploaded file with content "some content" to "lorem.txt"
And the administrator has browsed to the admin sharing settings page
When the administrator enables restrict users to only share with groups they are member of using the webUI
And the user re-logs in as "user1" using the webUI
And the user shares file "lorem.txt" with group "grp1" using the webUI
Then as "user2" file "/lorem.txt" should exist
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,32 @@ Feature: Sharing files and folders with internal users
| user_id1 | user_id2 | user_id3 |
| Brand-New-User | brand-new-user | BRAND-NEW-USER |
| brand-new-user | BRAND-NEW-USER | Brand-New-User |
| BRAND-NEW-USER | Brand-New-User | brand-new-user |
| BRAND-NEW-USER | Brand-New-User | brand-new-user |

Scenario: sharer should be able to share a folder to a user when only share with groups they are member of is enabled
Given these users have been created with default attributes and without skeleton files:
| username |
| user1 |
| user2 |
And group "grp1" has been created
And user "user1" has been added to group "grp1"
And user "user1" has created folder "/simple-folder"
And the administrator has browsed to the admin sharing settings page
When the administrator enables restrict users to only share with groups they are member of using the webUI
And the user re-logs in as "user1" using the webUI
And the user shares folder "simple-folder" with user "User Two" using the webUI
Then as "user2" folder "/simple-folder" should exist

Scenario: sharer should be able to share a file to a user when only share with groups they are member of is enabled
Given these users have been created with default attributes and without skeleton files:
| username |
| user1 |
| user2 |
And group "grp1" has been created
And user "user1" has been added to group "grp1"
And user "user1" has uploaded file with content "some content" to "lorem.txt"
And the administrator has browsed to the admin sharing settings page
When the administrator enables restrict users to only share with groups they are member of using the webUI
And the user re-logs in as "user1" using the webUI
And the user shares file "lorem.txt" with user "User Two" using the webUI
Then as "user2" file "/lorem.txt" should exist

0 comments on commit bb93190

Please sign in to comment.