]> source.dussan.org Git - nextcloud-server.git/commitdiff
Adjust acceptance tests to new OCA.Sidebar
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Wed, 16 Oct 2019 19:46:31 +0000 (21:46 +0200)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Tue, 29 Oct 2019 12:20:08 +0000 (13:20 +0100)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tests/acceptance/features/app-files-sharing-link.feature
tests/acceptance/features/app-files-tags.feature
tests/acceptance/features/bootstrap/FilesAppContext.php
tests/acceptance/features/bootstrap/FilesAppSharingContext.php

index c35338fea282d1e97eb2add381f826cd0626fa2b..38680f110d4e8f34b7fa9455e0de3e9a8d2c820a 100644 (file)
@@ -126,8 +126,7 @@ Feature: app-files-sharing-link
     Given I am logged in
     And I share the link for "welcome.txt"
     When I protect the shared link with the password "abcdef"
-    Then I see that the working icon for password protect is shown
-    And I see that the working icon for password protect is eventually not shown
+    Then I see that the password protect is disabled while loading
     And I see that the link share is password protected
     # As Talk is not enabled in the acceptance tests of the server the checkbox
     # is never shown.
index 5c0942472a8ac01395ebbe4a84556869d79b05f0..093ae37191212acd787dcdb3089c614384c21e8e 100644 (file)
@@ -19,15 +19,6 @@ Feature: app-files-tags
 #    When I open the input field for tags in the details view
 #    Then I see that the input field for tags in the details view is shown
 
-  Scenario: show the input field for tags in the details view after the sharing tab has loaded
-    Given I am logged in
-    And I open the details view for "welcome.txt"
-   And I see that the details view is open
-    And I open the "Sharing" tab in the details view
-    And I see that the "Sharing" tab in the details view is eventually loaded
-    When I open the input field for tags in the details view
-    Then I see that the input field for tags in the details view is shown
-
   Scenario: create tags using the Administration settings
     Given I am logged in as the admin
     And I visit the settings page
index 880303fe1d6c51e007ca2b8765255d9118724ba3..32b019161892461b288522b568b8a5738a83b6e3 100644 (file)
@@ -98,7 +98,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function fileNameInDetailsView() {
-               return Locator::forThe()->css(".fileName")->
+               return Locator::forThe()->css(".app-sidebar-header__title")->
                                descendantOf(self::detailsView())->
                                describedAs("File name in details view in Files app");
        }
@@ -107,7 +107,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function favoriteActionInFileDetailsInDetailsView() {
-               return Locator::forThe()->css(".action-favorite")->
+               return Locator::forThe()->css(".app-sidebar-header__star")->
                                descendantOf(self::fileDetailsInDetailsView())->
                                describedAs("Favorite action in file details in details view in Files app");
        }
@@ -143,7 +143,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        private static function fileDetailsInDetailsView() {
-               return Locator::forThe()->css(".file-details")->
+               return Locator::forThe()->css(".app-sidebar-header__desc")->
                                descendantOf(self::detailsView())->
                                describedAs("File details in details view in Files app");
        }
@@ -205,7 +205,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        private static function tabHeadersInDetailsView() {
-               return Locator::forThe()->css(".tabHeaders")->
+               return Locator::forThe()->css(".app-sidebar-tabs__nav")->
                                descendantOf(self::detailsView())->
                                describedAs("Tab headers in details view in Files app");
        }
@@ -214,7 +214,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function tabInDetailsViewNamed($tabName) {
-               return Locator::forThe()->xpath("//div[@id=//*[contains(concat(' ', normalize-space(@class), ' '), ' tabHeader ') and normalize-space() = '$tabName']/@data-tabid]")->
+               return Locator::forThe()->xpath("//div[contains(concat(' ', normalize-space(@class), ' '), ' app-sidebar-tabs__content ')]/section[@aria-labelledby = '$tabName' and @role = 'tabpanel']")->
                                descendantOf(self::detailsView())->
                                describedAs("Tab named $tabName in details view in Files app");
        }
@@ -223,7 +223,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function loadingIconForTabInDetailsViewNamed($tabName) {
-               return Locator::forThe()->css(".loading")->
+               return Locator::forThe()->css(".icon-loading")->
                                descendantOf(self::tabInDetailsViewNamed($tabName))->
                                describedAs("Loading icon for tab named $tabName in details view in Files app");
        }
index 5353f05c110db86def6847b47086eff790761229..6bebfc5b3d37e779b036cb72a717d24a56daf596 100644 (file)
@@ -31,7 +31,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function sharedByLabel() {
-               return Locator::forThe()->css(".reshare")->
+               return Locator::forThe()->css(".sharing-entry__reshare")->
                                descendantOf(FilesAppContext::detailsView())->
                                describedAs("Shared by label in the details view in Files app");
        }
@@ -40,16 +40,34 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function shareWithInput() {
-               return Locator::forThe()->css(".shareWithField")->
+               return Locator::forThe()->css(".sharing-input .multiselect__input")->
                                descendantOf(FilesAppContext::detailsView())->
                                describedAs("Share with input in the details view in Files app");
        }
 
+       /**
+        * @return Locator
+        */
+       public static function shareWithInputResults() {
+               return Locator::forThe()->css(".sharing-input .multiselect__content-wrapper")->
+                               descendantOf(FilesAppContext::detailsView())->
+                               describedAs("Share with input results list in the details view in Files app");
+       }
+
+       /**
+        * @return Locator
+        */
+       public static function shareWithInputResult($result) {
+               return Locator::forThe()->xpath("//li[contains(concat(' ', normalize-space(@class), ' '), ' multiselect__element ')]//span[normalize-space() = '$result']/ancestor::li")->
+                               descendantOf(self::shareWithInputResults())->
+                               describedAs("Share with input result from the results list in the details view in Files app");
+       }
+
        /**
         * @return Locator
         */
        public static function shareeList() {
-               return Locator::forThe()->css(".shareeListView")->
+               return Locator::forThe()->css(".sharing-sharee-list")->
                                descendantOf(FilesAppContext::detailsView())->
                                describedAs("Sharee list in the details view in Files app");
        }
@@ -60,7 +78,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
        public static function sharedWithRow($sharedWithName) {
                // "username" class is used for any type of share, not only for shares
                // with users.
-               return Locator::forThe()->xpath("//span[contains(concat(' ', normalize-space(@class), ' '), ' username ') and normalize-space() = '$sharedWithName']/ancestor::li")->
+               return Locator::forThe()->xpath("//li[contains(concat(' ', normalize-space(@class), ' '), ' sharing-entry ')]//h5[normalize-space() = '$sharedWithName']/ancestor::li")->
                                descendantOf(self::shareeList())->
                                describedAs("Shared with $sharedWithName row in the details view in Files app");
        }
@@ -69,7 +87,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function shareWithMenuButton($sharedWithName) {
-               return Locator::forThe()->css(".share-menu > .icon")->
+               return Locator::forThe()->css(".sharing-entry__actions > .action-item__menutoggle")->
                                descendantOf(self::sharedWithRow($sharedWithName))->
                                describedAs("Share with $sharedWithName menu button in the details view in Files app");
        }
@@ -78,7 +96,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function shareWithMenu($sharedWithName) {
-               return Locator::forThe()->css(".share-menu > .menu")->
+               return Locator::forThe()->css(".sharing-entry__actions > .action-item__menu")->
                                descendantOf(self::sharedWithRow($sharedWithName))->
                                describedAs("Share with $sharedWithName menu in the details view in Files app");
        }
@@ -108,7 +126,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function shareLinkRow() {
-               return Locator::forThe()->css(".linkShareView .shareWithList:first-child")->
+               return Locator::forThe()->css(".sharing-link-list .sharing-entry__link:first-child")->
                                descendantOf(FilesAppContext::detailsView())->
                                describedAs("Share link row in the details view in Files app");
        }
@@ -119,7 +137,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
        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")->
+               return Locator::forThe()->css(".action-item.icon-add")->
                                descendantOf(self::shareLinkRow())->
                                describedAs("Add new share link button in the details view in Files app");
        }
@@ -128,7 +146,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function copyLinkButton() {
-               return Locator::forThe()->css("a.clipboard-button")->
+               return Locator::forThe()->css("a.sharing-entry__copy")->
                                descendantOf(self::shareLinkRow())->
                                describedAs("Copy link button in the details view in Files app");
        }
@@ -137,7 +155,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function shareLinkMenuButton() {
-               return Locator::forThe()->css(".share-menu > .icon")->
+               return Locator::forThe()->css(".sharing-entry__actions .action-item__menutoggle")->
                                descendantOf(self::shareLinkRow())->
                                describedAs("Share link menu button in the details view in Files app");
        }
@@ -146,7 +164,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function shareLinkMenu() {
-               return Locator::forThe()->css(".share-menu > .menu")->
+               return Locator::forThe()->css(".sharing-entry__actions .action-item__menu")->
                                descendantOf(self::shareLinkRow())->
                                describedAs("Share link menu in the details view in Files app");
        }
@@ -209,16 +227,16 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
         * @return Locator
         */
        public static function passwordProtectField() {
-               return Locator::forThe()->css(".linkPassText")->descendantOf(self::shareLinkMenu())->
+               return Locator::forThe()->css(".share-link-password input.action-input__input")->descendantOf(self::shareLinkMenu())->
                                describedAs("Password protect field in the details view in Files app");
        }
 
        /**
         * @return Locator
         */
-       public static function passwordProtectWorkingIcon() {
-               return Locator::forThe()->css(".linkPassMenu .icon-loading-small")->descendantOf(self::shareLinkMenu())->
-                               describedAs("Password protect working icon in the details view in Files app");
+       public static function disabledPasswordProtectField() {
+               return Locator::forThe()->css(".share-link-password input.action-input__input[disabled]")->descendantOf(self::shareLinkMenu())->
+                               describedAs("Disabled password protect field in the details view in Files app");
        }
 
        /**
@@ -257,7 +275,12 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
        public function iShareWith($fileName, $shareWithName) {
                $this->actor->find(FileListContext::shareActionForFile(FilesAppContext::currentSectionMainView(), $fileName), 10)->click();
 
-               $this->actor->find(self::shareWithInput(), 5)->setValue($shareWithName . "\r");
+               $this->actor->find(self::shareWithInput(), 5)->setValue($shareWithName);
+               // "setValue()" ends sending a tab, which unfocuses the input and causes
+               // the results to be hidden, so the input needs to be clicked to show
+               // the results again.
+               $this->actor->find(self::shareWithInput())->click();
+               $this->actor->find(self::shareWithInputResult($shareWithName), 5)->click();
        }
 
        /**
@@ -269,7 +292,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
                // 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::copyLinkButton(), 2)->getWrappedElement()->getAttribute("data-clipboard-text");
+               $this->actor->getSharedNotebook()["shared link"] = $this->actor->find(self::copyLinkButton(), 2)->getWrappedElement()->getAttribute("href");
        }
 
        /**
@@ -412,21 +435,16 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
        }
 
        /**
-        * @Then I see that the working icon for password protect is shown
+        * @Then I see that the password protect is disabled while loading
         */
-       public function iSeeThatTheWorkingIconForPasswordProtectIsShown() {
-               PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::passwordProtectWorkingIcon(), 10));
-       }
+       public function iSeeThatThePasswordProtectIsDisabledWhileLoading() {
+               PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::disabledPasswordProtectField(), 10));
 
-       /**
-        * @Then I see that the working icon for password protect is eventually not shown
-        */
-       public function iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown() {
                if (!WaitFor::elementToBeEventuallyNotShown(
                                $this->actor,
-                               self::passwordProtectWorkingIcon(),
+                               self::disabledPasswordProtectField(),
                                $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
-                       PHPUnit_Framework_Assert::fail("The working icon for password protect is still shown after $timeout seconds");
+                       PHPUnit_Framework_Assert::fail("The password protect field is still disabled after $timeout seconds");
                }
        }
 
@@ -477,8 +495,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
        public function iShareTheLinkForProtectedByThePassword($fileName, $password) {
                $this->iShareTheLinkFor($fileName);
                $this->iProtectTheSharedLinkWithThePassword($password);
-               $this->iSeeThatTheWorkingIconForPasswordProtectIsShown();
-               $this->iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown();
+               $this->iSeeThatThePasswordProtectIsDisabledWhileLoading();
        }
 
        private function showShareLinkMenuIfNeeded() {