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
path: root/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-06-12 00:15:26 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-06-24 22:24:57 +0300
commit47222e9ad4ae55176200fbd31109ef3bf333ee7f (patch)
tree05ffbe5bbc75092f796adefe29197dc940783ed0 /tests
parentb2b02ff353064f3eaf3b55cca39bb876825789b8 (diff)
Add acceptance test for sharing a file without edit 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.feature20
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppSharingContext.php55
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 e3b0ec30cf8..45604470be1 100644
--- a/tests/acceptance/features/app-files-sharing.feature
+++ b/tests/acceptance/features/app-files-sharing.feature
@@ -294,3 +294,23 @@ Feature: app-files-sharing
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 the file is not allowed
+
+ Scenario: sharee can not reshare a file with edit 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 rename "welcome.txt" to "farewell.txt"
+ And I see that the file list contains a file named "farewell.txt"
+ And I share "farewell.txt" with "user0"
+ And I see that the file is shared with "user0"
+ And I set the share with "user0" as not editable
+ And I see that "user0" can not edit 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 "farewell.txt" with "user1"
+ 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
diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
index 92f558f5002..81b35ed8676 100644
--- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
@@ -125,6 +125,20 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function canEditCheckbox($sharedWithName) {
+ return self::permissionCheckboxFor($sharedWithName, 'Allow editing');
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function canEditCheckboxInput($sharedWithName) {
+ return self::permissionCheckboxInputFor($sharedWithName, 'Allow editing');
+ }
+
+ /**
+ * @return Locator
+ */
public static function canReshareCheckbox($sharedWithName) {
return self::permissionCheckboxFor($sharedWithName, 'Allow resharing');
}
@@ -374,6 +388,17 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
}
/**
+ * @When I set the share with :shareWithName as not editable
+ */
+ public function iSetTheShareWithAsNotEditable($shareWithName) {
+ $this->showShareWithMenuIfNeeded($shareWithName);
+
+ $this->iSeeThatCanEditTheShare($shareWithName);
+
+ $this->actor->find(self::canEditCheckbox($shareWithName), 2)->click();
+ }
+
+ /**
* @When I set the share with :shareWithName as not reshareable
*/
public function iSetTheShareWithAsNotReshareable($shareWithName) {
@@ -411,6 +436,36 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that :sharedWithName can not be allowed to edit the share
+ */
+ public function iSeeThatCanNotBeAllowedToEditTheShare($sharedWithName) {
+ $this->showShareWithMenuIfNeeded($sharedWithName);
+
+ PHPUnit_Framework_Assert::assertEquals(
+ $this->actor->find(self::canEditCheckboxInput($sharedWithName), 10)->getWrappedElement()->getAttribute("disabled"), "disabled");
+ }
+
+ /**
+ * @Then I see that :sharedWithName can edit the share
+ */
+ public function iSeeThatCanEditTheShare($sharedWithName) {
+ $this->showShareWithMenuIfNeeded($sharedWithName);
+
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::canEditCheckboxInput($sharedWithName), 10)->isChecked());
+ }
+
+ /**
+ * @Then I see that :sharedWithName can not edit the share
+ */
+ public function iSeeThatCanNotEditTheShare($sharedWithName) {
+ $this->showShareWithMenuIfNeeded($sharedWithName);
+
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::canEditCheckboxInput($sharedWithName), 10)->isChecked());
+ }
+
+ /**
* @Then I see that :sharedWithName can reshare the share
*/
public function iSeeThatCanReshareTheShare($sharedWithName) {