diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-06-12 00:16:34 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-06-24 22:22:39 +0300 |
commit | 244a7e16f3a1c66021626f585387607912116fa5 (patch) | |
tree | fbe3ca885f3defb587fcb65d5ccf211efa287ba8 /tests | |
parent | ae3af29646a561f56656bbd248c195a8339d6c3f (diff) |
Add acceptance test for sharing a folder without create permission
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/features/app-files-sharing.feature | 20 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppSharingContext.php | 55 |
2 files changed, 75 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files-sharing.feature b/tests/acceptance/features/app-files-sharing.feature index 45604470be1..19a3af51713 100644 --- a/tests/acceptance/features/app-files-sharing.feature +++ b/tests/acceptance/features/app-files-sharing.feature @@ -314,3 +314,23 @@ Feature: app-files-sharing Then I see that the file is shared with "user1" And I see that "user1" can not edit the share And I see that "user1" can not be allowed to edit the share + + Scenario: sharee can not reshare a folder with create permission if the sharer disables it + Given I act as John + And I am logged in as the admin + And I act as Jane + And I am logged in + And I act as John + And I create a new folder named "Shared folder" + And I see that the file list contains a file named "Shared folder" + And I share "Shared folder" with "user0" + And I see that the file is shared with "user0" + And I set the share with "user0" as not creatable + And I see that "user0" can not create in the share + When I act as Jane + # The Files app is open again to reload the file list + And I open the Files app + And I share "Shared folder" with "user1" + Then I see that the file is shared with "user1" + And I see that "user1" can not create in the share + And I see that "user1" can not be allowed to create in the share diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php index 3f047e9f624..80d21a0faf9 100644 --- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php @@ -138,6 +138,20 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function canCreateCheckbox($sharedWithName) { + return self::permissionCheckboxFor($sharedWithName, 'Allow creating'); + } + + /** + * @return Locator + */ + public static function canCreateCheckboxInput($sharedWithName) { + return self::permissionCheckboxInputFor($sharedWithName, 'Allow creating'); + } + + /** + * @return Locator + */ public static function canReshareCheckbox($sharedWithName) { return self::permissionCheckboxFor($sharedWithName, 'Allow resharing'); } @@ -398,6 +412,17 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { } /** + * @When I set the share with :shareWithName as not creatable + */ + public function iSetTheShareWithAsNotCreatable($shareWithName) { + $this->showShareWithMenuIfNeeded($shareWithName); + + $this->iSeeThatCanCreateInTheShare($shareWithName); + + $this->actor->find(self::canCreateCheckbox($shareWithName), 2)->click(); + } + + /** * @When I set the share with :shareWithName as not reshareable */ public function iSetTheShareWithAsNotReshareable($shareWithName) { @@ -465,6 +490,36 @@ class FilesAppSharingContext implements Context, ActorAwareInterface { } /** + * @Then I see that :sharedWithName can not be allowed to create in the share + */ + public function iSeeThatCanNotBeAllowedToCreateInTheShare($sharedWithName) { + $this->showShareWithMenuIfNeeded($sharedWithName); + + PHPUnit_Framework_Assert::assertEquals( + $this->actor->find(self::canCreateCheckboxInput($sharedWithName), 10)->getWrappedElement()->getAttribute("disabled"), "disabled"); + } + + /** + * @Then I see that :sharedWithName can create in the share + */ + public function iSeeThatCanCreateInTheShare($sharedWithName) { + $this->showShareWithMenuIfNeeded($sharedWithName); + + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::canCreateCheckboxInput($sharedWithName), 10)->isChecked()); + } + + /** + * @Then I see that :sharedWithName can not create in the share + */ + public function iSeeThatCanNotCreateInTheShare($sharedWithName) { + $this->showShareWithMenuIfNeeded($sharedWithName); + + PHPUnit_Framework_Assert::assertFalse( + $this->actor->find(self::canCreateCheckboxInput($sharedWithName), 10)->isChecked()); + } + + /** * @Then I see that :sharedWithName can reshare the share */ public function iSeeThatCanReshareTheShare($sharedWithName) { |