]> source.dussan.org Git - nextcloud-server.git/commitdiff
Handle single action unshare 27552/head
authorJulius Härtl <jus@bitgrid.net>
Wed, 9 Jun 2021 08:43:50 +0000 (10:43 +0200)
committerJulius Härtl <jus@bitgrid.net>
Tue, 29 Jun 2021 17:07:49 +0000 (19:07 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
tests/acceptance/features/bootstrap/FilesAppSharingContext.php

index 07ebbba1a36de67fe6219c33b72c9dac80204137..d8611ea5c05ac5c2ab4c3fb950add2dafe30244a 100644 (file)
@@ -218,6 +218,15 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
                                describedAs("Share link menu trigger in the details view in Files app");
        }
 
+       /**
+        * @return Locator
+        */
+       public static function shareLinkSingleUnshareAction() {
+               return Locator::forThe()->css(".sharing-entry__actions.icon-close")->
+                       descendantOf(self::shareLinkRow())->
+                       describedAs("Unshare link single action in the details view in Files app");
+       }
+
        /**
         * @return Locator
         */
@@ -503,10 +512,13 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @When I unshare the link share
         */
        public function iUnshareTheLink() {
-               $this->showShareLinkMenuIfNeeded();
-
-               $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 2);
-               $this->actor->find(self::unshareLinkButton($shareLinkMenuTriggerElement), 2)->click();
+               try {
+                       $this->actor->find(self::shareLinkSingleUnshareAction(), 2)->click();
+               } catch (NoSuchElementException $e) {
+                       $this->showShareLinkMenuIfNeeded();
+                       $shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 2);
+                       $this->actor->find(self::unshareLinkButton($shareLinkMenuTriggerElement), 2)->click();
+               }
        }
 
        /**