From 964fd27666192beb7929342f10ae27cef3455d8b Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Wed, 9 Jun 2021 10:43:50 +0200 Subject: Handle single action unshare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../features/bootstrap/FilesAppSharingContext.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/acceptance/features') diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php index e3b63476fff..d71b0196dbb 100644 --- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php @@ -220,6 +220,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 */ @@ -505,10 +514,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(); + } } /** -- cgit v1.2.3