summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-25 01:07:51 +0200
committerGitHub <noreply@github.com>2017-10-25 01:07:51 +0200
commit1978867a11a9baf1ec50555264e65bcfd679c7e8 (patch)
tree6a41c13f05e5ebc4cb32250669e5a66f8f3fe52b /tests
parent5d84daa167ca7d631175f54fc949d3f78e854978 (diff)
parent065ab6bfff47b4e869b76dacf3b077fd0aff8ad5 (diff)
downloadnextcloud-server-1978867a11a9baf1ec50555264e65bcfd679c7e8.tar.gz
nextcloud-server-1978867a11a9baf1ec50555264e65bcfd679c7e8.zip
Merge pull request #6709 from nextcloud/show-checkbox-where-the-favourite-icon-is-now
Show checkbox where the favourite icon is now
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/features/app-files.feature16
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php48
2 files changed, 57 insertions, 7 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature
index 37e01bcada2..ac2d05fac2c 100644
--- a/tests/acceptance/features/app-files.feature
+++ b/tests/acceptance/features/app-files.feature
@@ -145,6 +145,14 @@ Feature: app-files
Given I am logged in
And I create a new folder named "A name alphabetically lower than welcome.txt"
And I see that "A name alphabetically lower than welcome.txt" precedes "welcome.txt" in the file list
+ # To mark the file as favorite the file actions menu has to be shown but, as
+ # the details view is opened automatically when the folder is created,
+ # clicking on the menu trigger could fail if it is covered by the details
+ # view due to its opening animation. Instead of ensuring that the animations
+ # of the contents and the details view have both finished it is easier to
+ # close the details view and wait until it is closed before continuing.
+ And I close the details view
+ And I see that the details view is closed
When I mark "welcome.txt" as favorite
Then I see that "welcome.txt" is marked as favorite
And I see that "welcome.txt" precedes "A name alphabetically lower than welcome.txt" in the file list
@@ -153,6 +161,14 @@ Feature: app-files
Given I am logged in
And I create a new folder named "A name alphabetically lower than welcome.txt"
And I see that "A name alphabetically lower than welcome.txt" precedes "welcome.txt" in the file list
+ # To mark the file as favorite the file actions menu has to be shown but, as
+ # the details view is opened automatically when the folder is created,
+ # clicking on the menu trigger could fail if it is covered by the details
+ # view due to its opening animation. Instead of ensuring that the animations
+ # of the contents and the details view have both finished it is easier to
+ # close the details view and wait until it is closed before continuing.
+ And I close the details view
+ And I see that the details view is closed
And I mark "welcome.txt" as favorite
And I see that "welcome.txt" is marked as favorite
And I see that "welcome.txt" precedes "A name alphabetically lower than welcome.txt" in the file list
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index bb088c0a2c3..338823a9478 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -80,6 +80,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function closeDetailsViewButton() {
+ return Locator::forThe()->css(".icon-close")->
+ descendantOf(self::currentSectionDetailsView())->
+ describedAs("Close 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())->
@@ -278,16 +287,16 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
- public static function favoriteActionForFile($fileName) {
- return Locator::forThe()->css(".action-favorite")->descendantOf(self::rowForFile($fileName))->
- describedAs("Favorite action for file $fileName in Files app");
+ public static function favoriteMarkForFile($fileName) {
+ return Locator::forThe()->css(".favorite-mark")->descendantOf(self::rowForFile($fileName))->
+ describedAs("Favorite mark for file $fileName in Files app");
}
/**
* @return Locator
*/
public static function notFavoritedStateIconForFile($fileName) {
- return Locator::forThe()->css(".icon-star")->descendantOf(self::favoriteActionForFile($fileName))->
+ return Locator::forThe()->css(".icon-star")->descendantOf(self::favoriteMarkForFile($fileName))->
describedAs("Not favorited state icon for file $fileName in Files app");
}
@@ -295,7 +304,7 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @return Locator
*/
public static function favoritedStateIconForFile($fileName) {
- return Locator::forThe()->css(".icon-starred")->descendantOf(self::favoriteActionForFile($fileName))->
+ return Locator::forThe()->css(".icon-starred")->descendantOf(self::favoriteMarkForFile($fileName))->
describedAs("Favorited state icon for file $fileName in Files app");
}
@@ -341,6 +350,20 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function addToFavoritesMenuItem() {
+ return self::fileActionsMenuItemFor("Add to favorites");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function removeFromFavoritesMenuItem() {
+ return self::fileActionsMenuItemFor("Remove from favorites");
+ }
+
+ /**
+ * @return Locator
+ */
public static function viewFileInFolderMenuItem() {
return self::fileActionsMenuItemFor("View in folder");
}
@@ -374,6 +397,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @Given I close the details view
+ */
+ public function iCloseTheDetailsView() {
+ $this->actor->find(self::closeDetailsViewButton(), 10)->click();
+ }
+
+ /**
* @Given I open the input field for tags in the details view
*/
public function iOpenTheInputFieldForTagsInTheDetailsView() {
@@ -393,7 +423,9 @@ class FilesAppContext implements Context, ActorAwareInterface {
public function iMarkAsFavorite($fileName) {
$this->iSeeThatIsNotMarkedAsFavorite($fileName);
- $this->actor->find(self::favoriteActionForFile($fileName), 10)->click();
+ $this->actor->find(self::fileActionsMenuButtonForFile($fileName), 10)->click();
+
+ $this->actor->find(self::addToFavoritesMenuItem(), 2)->click();
}
/**
@@ -402,7 +434,9 @@ class FilesAppContext implements Context, ActorAwareInterface {
public function iUnmarkAsFavorite($fileName) {
$this->iSeeThatIsMarkedAsFavorite($fileName);
- $this->actor->find(self::favoriteActionForFile($fileName), 10)->click();
+ $this->actor->find(self::fileActionsMenuButtonForFile($fileName), 10)->click();
+
+ $this->actor->find(self::removeFromFavoritesMenuItem(), 2)->click();
}
/**