aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-01-11 04:30:52 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-01-11 04:30:52 +0100
commitdab4a70bcf75878cf1542d010f5894e5c7e272ea (patch)
tree6ff8645804adc0f32a517919b46b38de15e546ae
parentf29c1cf13ae4f5dd38c7476c55ff5e23916bd6f4 (diff)
downloadnextcloud-server-dab4a70bcf75878cf1542d010f5894e5c7e272ea.tar.gz
nextcloud-server-dab4a70bcf75878cf1542d010f5894e5c7e272ea.zip
Add acceptance test for renaming a file with the details view open
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r--tests/acceptance/features/app-files.feature7
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php50
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature
index 2cb43611b9a..ef3d07ae499 100644
--- a/tests/acceptance/features/app-files.feature
+++ b/tests/acceptance/features/app-files.feature
@@ -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: open the menu in a public shared link
Given I act as John
And I am logged in
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index 4951dc43f1d..117f3b54fb8 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -89,6 +89,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @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
+ */
public static function fileDetailsInCurrentSectionDetailsViewWithText($fileDetailsText) {
return Locator::forThe()->xpath("//span[normalize-space() = '$fileDetailsText']")->
descendantOf(self::fileDetailsInCurrentSectionDetailsView())->
@@ -319,6 +328,14 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @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
+ */
public static function shareActionForFile($fileName) {
return Locator::forThe()->css(".action-share")->descendantOf(self::rowForFile($fileName))->
describedAs("Share action for file $fileName in Files app");
@@ -350,6 +367,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function renameMenuItem() {
+ return self::fileActionsMenuItemFor("Rename");
+ }
+
+ /**
+ * @return Locator
+ */
public static function addToFavoritesMenuItem() {
return self::fileActionsMenuItemFor("Add to favorites");
}
@@ -418,6 +442,17 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @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
*/
public function iMarkAsFavorite($fileName) {
@@ -543,6 +578,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 :fileName1 precedes :fileName2 in the file list
*/
public function iSeeThatPrecedesInTheFileList($fileName1, $fileName2) {
@@ -564,6 +606,14 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @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
*/
public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() {