From b23289da1a9c7a6be87d2e421a44199fc64a986c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 31 Oct 2018 21:34:51 +0100 Subject: [PATCH] Adjust acceptance tests to changes in link shares MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although now it is possible to create several link shares the acceptance tests currently handles only the first link share; this first link share is now created by clicking an "Add new share" button instead of a checkbox. Besides that, the "Copy link" button has been moved from the menu to the row, next to the menu trigger. Signed-off-by: Daniel Calviño Sánchez --- .../features/bootstrap/FilesAppContext.php | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index 4b648bfc54..459028813b 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -188,7 +188,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @return Locator */ public static function shareLinkRow() { - return Locator::forThe()->id("shareLink")-> + return Locator::forThe()->css(".linkShareView .shareWithList:first-child")-> descendantOf(self::detailsView())-> describedAs("Share link row in the details view in Files app"); } @@ -196,13 +196,21 @@ class FilesAppContext implements Context, ActorAwareInterface { /** * @return Locator */ - public static function shareLinkCheckbox() { - // forThe()->checkbox("Enable") can not be used here; that would return - // the checkbox itself, but the element that the user interacts with is - // the label. - return Locator::forThe()->xpath("//label[normalize-space() = 'Enable']")-> + public static function shareLinkAddNewButton() { + // When there is no link share the "Add new share" item is shown instead + // of the menu button as a direct child of ".share-menu". + return Locator::forThe()->css(".share-menu > .new-share")-> descendantOf(self::shareLinkRow())-> - describedAs("Share link checkbox in the details view in Files app"); + describedAs("Add new share link button in the details view in Files app"); + } + + /** + * @return Locator + */ + public static function copyLinkButton() { + return Locator::forThe()->css("a.clipboard-button")-> + descendantOf(self::shareLinkRow())-> + describedAs("Copy link button in the details view in Files app"); } /** @@ -223,15 +231,6 @@ class FilesAppContext implements Context, ActorAwareInterface { describedAs("Share link menu in the details view in Files app"); } - /** - * @return Locator - */ - public static function copyUrlMenuItem() { - return Locator::forThe()->xpath("//a[normalize-space() = 'Copy link']")-> - descendantOf(self::shareLinkMenu())-> - describedAs("Copy link menu item in the share link menu in the details view in Files app"); - } - /** * @return Locator */ @@ -320,21 +319,19 @@ class FilesAppContext implements Context, ActorAwareInterface { public function iShareTheLinkFor($fileName) { $this->actor->find(FileListContext::shareActionForFile(self::currentSectionMainView(), $fileName), 10)->click(); - $this->actor->find(self::shareLinkCheckbox(), 5)->click(); + $this->actor->find(self::shareLinkAddNewButton(), 5)->click(); } /** * @Given I write down the shared link */ public function iWriteDownTheSharedLink() { - $this->showShareLinkMenuIfNeeded(); - - $this->actor->find(self::copyUrlMenuItem(), 2)->click(); + $this->actor->find(self::copyLinkButton(), 10)->click(); // Clicking on the menu item copies the link to the clipboard, but it is // not possible to access that value from the acceptance tests. Due to // this the value of the attribute that holds the URL is used instead. - $this->actor->getSharedNotebook()["shared link"] = $this->actor->find(self::copyUrlMenuItem(), 2)->getWrappedElement()->getAttribute("data-clipboard-text"); + $this->actor->getSharedNotebook()["shared link"] = $this->actor->find(self::copyLinkButton(), 2)->getWrappedElement()->getAttribute("data-clipboard-text"); } /**