summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-10 22:16:10 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-11 01:35:27 +0100
commit22d949d9d9da89eb2395b1259c44db17d1db5856 (patch)
treee03153aa8f26c212a80573cdd861227e9568fed5 /tests/acceptance/features/bootstrap/FilesAppSharingContext.php
parenta1d79b2b2bd8bef37c30b5426c94724f9f9d6ab6 (diff)
downloadnextcloud-server-22d949d9d9da89eb2395b1259c44db17d1db5856.tar.gz
nextcloud-server-22d949d9d9da89eb2395b1259c44db17d1db5856.zip
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/bootstrap/FilesAppSharingContext.php')
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppSharingContext.php46
1 files changed, 46 insertions, 0 deletions
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) {