diff options
Diffstat (limited to 'tests/acceptance/features/bootstrap/FilesAppSharingContext.php')
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppSharingContext.php | 46 |
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) { |