Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-11 00:16:10 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-11 03:35:27 +0300
commit22d949d9d9da89eb2395b1259c44db17d1db5856 (patch)
treee03153aa8f26c212a80573cdd861227e9568fed5 /tests/acceptance/features
parenta1d79b2b2bd8bef37c30b5426c94724f9f9d6ab6 (diff)
Add acceptance tests for reshares when resharing is disabled
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance/features')
-rw-r--r--tests/acceptance/features/app-files-sharing.feature104
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppSharingContext.php46
-rw-r--r--tests/acceptance/features/bootstrap/SettingsContext.php44
3 files changed, 194 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files-sharing.feature b/tests/acceptance/features/app-files-sharing.feature
index b6cde94455c..4f58d1d17ff 100644
--- a/tests/acceptance/features/app-files-sharing.feature
+++ b/tests/acceptance/features/app-files-sharing.feature
@@ -246,6 +246,110 @@ Feature: app-files-sharing
And I enter in the folder named "Shared folder"
Then I see that the file list contains a file named "Subfolder"
+ Scenario: sharer does not see resharing option for a folder if resharing is disabled in the settings after the share is created
+ Given I am logged in as the admin
+ 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"
+ When I visit the settings page
+ And I open the "Sharing" section of the "Administration" group
+ And I disable resharing
+ And I see that resharing is disabled
+ Then I open the Files app
+ And I open the details view for "Shared folder"
+ And I see that the details view is open
+ And I open the "Sharing" tab in the details view
+ And I see that the "Sharing" tab in the details view is eventually loaded
+ And I see that resharing for "user0" is not available
+
+ Scenario: sharee can not reshare a folder if resharing is disabled in the settings after the share is created
+ 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 visit the settings page
+ And I open the "Sharing" section of the "Administration" group
+ And I disable resharing
+ And I see that resharing is disabled
+ When I act as Jane
+ # The Files app is open again to reload the file list
+ And I open the Files app
+ Then I see that the file list contains a file named "Shared folder"
+ And I open the details view for "Shared folder"
+ And I see that the details view is open
+ And I open the "Sharing" tab in the details view
+ And I see that the "Sharing" tab in the details view is eventually loaded
+ And I see that the file is shared with me by "admin"
+ And I see that resharing the file is not allowed
+
+ Scenario: sharee can unshare a folder if resharing is disabled in the settings after the share is created
+ 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 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"
+ And I act as John
+ And I visit the settings page
+ And I open the "Sharing" section of the "Administration" group
+ And I disable resharing
+ And I see that resharing is disabled
+ When I act as Jane
+ # The Files app is open again to reload the file list
+ And I open the Files app
+ Then I see that the file list contains a file named "Shared folder"
+ And I open the details view for "Shared folder"
+ And I see that the details view is open
+ And I open the "Sharing" tab in the details view
+ And I see that the "Sharing" tab in the details view is eventually loaded
+ And I see that the file is shared with me by "admin"
+ And I unshare the share with "user1"
+ And I see that the file is not shared with "user1"
+
+ Scenario: resharee sees a folder created by the owner in a shared folder if resharing is disabled in the settings after the share is created
+ 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 Jim
+ And I am logged in as "user1"
+ 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 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"
+ And I act as John
+ And I visit the settings page
+ And I open the "Sharing" section of the "Administration" group
+ And I disable resharing
+ And I see that resharing is disabled
+ And I open the Files app
+ And I enter in the folder named "Shared folder"
+ And I create a new folder named "Subfolder"
+ And I see that the file list contains a file named "Subfolder"
+ When I act as Jim
+ # The Files app is open again to reload the file list
+ And I open the Files app
+ And I enter in the folder named "Shared folder"
+ Then I see that the file list contains a file named "Subfolder"
+
Scenario: sharee can not reshare a folder if the sharer disables it
Given I act as John
And I am logged in as the admin
diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
index 24ab36548eb..a75c0ddda32 100644
--- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
@@ -174,6 +174,15 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function unshareButton($sharedWithName, $shareWithMenuTriggerElement) {
+ return Locator::forThe()->xpath("//li[contains(concat(' ', normalize-space(@class), ' '), ' action ')]//button[normalize-space() = 'Unshare']")->
+ descendantOf(self::shareWithMenu($sharedWithName, $shareWithMenuTriggerElement))->
+ describedAs("Unshare button in the share with $sharedWithName menu in the details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
public static function shareLinkRow() {
return Locator::forThe()->css(".sharing-link-list .sharing-entry__link:first-child")->
descendantOf(FilesAppContext::detailsView())->
@@ -472,6 +481,16 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
}
/**
+ * @When I unshare the share with :shareWithName
+ */
+ public function iUnshareTheFileWith($shareWithName) {
+ $this->showShareWithMenuIfNeeded($shareWithName);
+
+ $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($shareWithName), 2);
+ $this->actor->find(self::unshareButton($shareWithName, $shareWithMenuTriggerElement), 2)->click();
+ }
+
+ /**
* @Then I see that the file is shared with me by :sharedByName
*/
public function iSeeThatTheFileIsSharedWithMeBy($sharedByName) {
@@ -488,6 +507,18 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that the file is not shared with :sharedWithName
+ */
+ public function iSeeThatTheFileIsNotSharedWith($sharedWithName) {
+ if (!WaitFor::elementToBeEventuallyNotShown(
+ $this->actor,
+ self::sharedWithRow($sharedWithName),
+ $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
+ PHPUnit_Framework_Assert::fail("The shared with $sharedWithName row is still shown after $timeout seconds");
+ }
+ }
+
+ /**
* @Then I see that resharing the file is not allowed
*/
public function iSeeThatResharingTheFileIsNotAllowed() {
@@ -564,6 +595,21 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that resharing for :sharedWithName is not available
+ */
+ public function iSeeThatResharingForIsNotAvailable($sharedWithName) {
+ $this->showShareWithMenuIfNeeded($sharedWithName);
+
+ $shareWithMenuTriggerElement = $this->actor->find(self::shareWithMenuTrigger($sharedWithName), 10);
+ if (!WaitFor::elementToBeEventuallyNotShown(
+ $this->actor,
+ self::canReshareCheckbox($sharedWithName, $shareWithMenuTriggerElement),
+ $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
+ PHPUnit_Framework_Assert::fail("The resharing checkbox for $sharedWithName is still shown after $timeout seconds");
+ }
+ }
+
+ /**
* @Then I see that :sharedWithName can reshare the share
*/
public function iSeeThatCanReshareTheShare($sharedWithName) {
diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php
index 60499c96bd1..2a3aeff2f2e 100644
--- a/tests/acceptance/features/bootstrap/SettingsContext.php
+++ b/tests/acceptance/features/bootstrap/SettingsContext.php
@@ -48,6 +48,25 @@ class SettingsContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function allowResharingCheckbox() {
+ // forThe()->checkbox("Allow resharing") can not be used here; that
+ // would return the checkbox itself, but the element that the user
+ // interacts with is the label.
+ return Locator::forThe()->xpath("//label[normalize-space() = 'Allow resharing']")->
+ describedAs("Allow resharing checkbox in Sharing section in Administration Sharing Settings");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function allowResharingCheckboxInput() {
+ return Locator::forThe()->checkbox("Allow resharing")->
+ describedAs("Allow resharing checkbox input in Sharing section in Administration Sharing Settings");
+ }
+
+ /**
+ * @return Locator
+ */
public static function restrictUsernameAutocompletionToGroupsCheckbox() {
// forThe()->checkbox("Restrict username...") can not be used here; that
// would return the checkbox itself, but the element that the user
@@ -131,6 +150,15 @@ class SettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @When I disable resharing
+ */
+ public function iDisableResharing() {
+ $this->iSeeThatResharingIsEnabled();
+
+ $this->actor->find(self::allowResharingCheckbox(), 2)->click();
+ }
+
+ /**
* @When I enable restricting username autocompletion to groups
*/
public function iEnableRestrictingUsernameAutocompletionToGroups() {
@@ -157,6 +185,22 @@ class SettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that resharing is enabled
+ */
+ public function iSeeThatResharingIsEnabled() {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked());
+ }
+
+ /**
+ * @Then I see that resharing is disabled
+ */
+ public function iSeeThatResharingIsDisabled() {
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked());
+ }
+
+ /**
* @Then I see that username autocompletion is restricted to groups
*/
public function iSeeThatUsernameAutocompletionIsRestrictedToGroups() {