]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add acceptance test for renaming a file with the details view open 7792/head
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 11 Jan 2018 03:30:52 +0000 (04:30 +0100)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 11 Jan 2018 12:30:04 +0000 (13:30 +0100)
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
tests/acceptance/features/app-files.feature
tests/acceptance/features/bootstrap/FilesAppContext.php

index 5a0a00955122f7884b889787ffbdfadccf4b4b88..0f7c0c532e8e4f9d11899c0f2bd57387d21ebc75 100644 (file)
@@ -23,6 +23,13 @@ Feature: app-files
     When I open the details view for "welcome.txt"
     Then I see that the details view for "All files" section is open
 
+  Scenario: rename a file with the details view open
+    Given I am logged in
+    And I open the details view for "welcome.txt"
+    When I rename "welcome.txt" to "farewell.txt"
+    Then I see that the file list contains a file named "farewell.txt"
+    And I see that the file name shown in the details view is "farewell.txt"
+
   Scenario: set a password to a shared link
     Given I am logged in
     And I share the link for "welcome.txt"
index 060e958e0e68f7fe8df6a61e58eb4b7cdfb93d5a..76921ba7383db269fa15e3e13c071b0983d1f46f 100644 (file)
@@ -77,6 +77,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
                                describedAs("Current section details view in Files app");
        }
 
+       /**
+        * @return Locator
+        */
+       public static function fileNameInCurrentSectionDetailsView() {
+               return Locator::forThe()->css(".fileName")->
+                               descendantOf(self::currentSectionDetailsView())->
+                               describedAs("File name in current section details view in Files app");
+       }
+
        /**
         * @return Locator
         */
@@ -256,6 +265,14 @@ class FilesAppContext implements Context, ActorAwareInterface {
                                describedAs("Main link for file $fileName in Files app");
        }
 
+       /**
+        * @return Locator
+        */
+       public static function renameInputForFile($fileName) {
+               return Locator::forThe()->css("input.filename")->descendantOf(self::rowForFile($fileName))->
+                               describedAs("Rename input for file $fileName in Files app");
+       }
+
        /**
         * @return Locator
         */
@@ -287,6 +304,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
                return self::fileActionsMenuItemFor("Details");
        }
 
+       /**
+        * @return Locator
+        */
+       public static function renameMenuItem() {
+               return self::fileActionsMenuItemFor("Rename");
+       }
+
        /**
         * @return Locator
         */
@@ -326,6 +350,17 @@ class FilesAppContext implements Context, ActorAwareInterface {
                $this->actor->find(self::tabHeaderInCurrentSectionDetailsViewNamed($tabName), 10)->click();
        }
 
+       /**
+        * @Given I rename :fileName1 to :fileName2
+        */
+       public function iRenameTo($fileName1, $fileName2) {
+               $this->actor->find(self::fileActionsMenuButtonForFile($fileName1), 10)->click();
+
+               $this->actor->find(self::renameMenuItem(), 2)->click();
+
+               $this->actor->find(self::renameInputForFile($fileName1), 10)->setValue($fileName2 . "\r");
+       }
+
        /**
         * @Given I mark :fileName as favorite
         */
@@ -436,6 +471,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
                }
        }
 
+       /**
+        * @Then I see that the file list contains a file named :fileName
+        */
+       public function iSeeThatTheFileListContainsAFileNamed($fileName) {
+               PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::rowForFile($fileName), 10));
+       }
+
        /**
         * @Then I see that :fileName is marked as favorite
         */
@@ -443,6 +485,14 @@ class FilesAppContext implements Context, ActorAwareInterface {
                PHPUnit_Framework_Assert::assertNotNull($this->actor->find(self::favoritedStateIconForFile($fileName), 10));
        }
 
+       /**
+        * @Then I see that the file name shown in the details view is :fileName
+        */
+       public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) {
+               PHPUnit_Framework_Assert::assertEquals(
+                               $this->actor->find(self::fileNameInCurrentSectionDetailsView(), 10)->getText(), $fileName);
+       }
+
        /**
         * @Then I see that the input field for tags in the details view is shown
         */