diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-22 05:25:12 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-22 05:25:12 +0100 |
commit | 94645ed75446ad4437eecf5aa342675fd0aa287b (patch) | |
tree | 77fb5b16ae71c2042643a30bce462ebff49d5cfd /tests/acceptance | |
parent | 139e2218d17a5d43265a7c101046f0d597e01dee (diff) | |
download | nextcloud-server-94645ed75446ad4437eecf5aa342675fd0aa287b.tar.gz nextcloud-server-94645ed75446ad4437eecf5aa342675fd0aa287b.zip |
Add acceptance tests for marking a file as favorite in the details view
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance')
-rw-r--r-- | tests/acceptance/features/app-files.feature | 19 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppContext.php | 61 |
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature index 33bed4a3ef2..c85cdc32b94 100644 --- a/tests/acceptance/features/app-files.feature +++ b/tests/acceptance/features/app-files.feature @@ -292,3 +292,22 @@ Feature: app-files When I unmark "welcome.txt" as favorite Then I see that "welcome.txt" is not marked as favorite And I see that "A name alphabetically lower than welcome.txt" precedes "welcome.txt" in the file list + + Scenario: mark a file as favorite in the details view + Given I am logged in + And I open the details view for "welcome.txt" + And I see that the details view is open + When I mark the file as favorite in the details view + Then I see that "welcome.txt" is marked as favorite + And I see that the file is marked as favorite in the details view + + Scenario: unmark a file as favorite in the details view + 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 mark the file as favorite in the details view + And I see that "welcome.txt" is marked as favorite + And I see that the file is marked as favorite in the details view + When I unmark the file as favorite in the details view + Then I see that "welcome.txt" is not marked as favorite + And I see that the file is not marked as favorite in the details view diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index d9ac6431716..a5d2c636f3e 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -89,6 +89,33 @@ class FilesAppContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function favoriteActionInFileDetailsInDetailsView() { + return Locator::forThe()->css(".action-favorite")-> + descendantOf(self::fileDetailsInDetailsView())-> + describedAs("Favorite action in file details in details view in Files app"); + } + + /** + * @return Locator + */ + public static function notFavoritedStateIconInFileDetailsInDetailsView() { + return Locator::forThe()->css(".icon-star")-> + descendantOf(self::favoriteActionInFileDetailsInDetailsView())-> + describedAs("Not favorited state icon in file details in details view in Files app"); + } + + /** + * @return Locator + */ + public static function favoritedStateIconInFileDetailsInDetailsView() { + return Locator::forThe()->css(".icon-starred")-> + descendantOf(self::favoriteActionInFileDetailsInDetailsView())-> + describedAs("Favorited state icon in file details in details view in Files app"); + } + + /** + * @return Locator + */ public static function fileDetailsInDetailsViewWithText($fileDetailsText) { return Locator::forThe()->xpath("//span[normalize-space() = '$fileDetailsText']")-> descendantOf(self::fileDetailsInDetailsView())-> @@ -373,6 +400,24 @@ class FilesAppContext implements Context, ActorAwareInterface { } /** + * @When I mark the file as favorite in the details view + */ + public function iMarkTheFileAsFavoriteInTheDetailsView() { + $this->iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView(); + + $this->actor->find(self::favoriteActionInFileDetailsInDetailsView(), 10)->click(); + } + + /** + * @When I unmark the file as favorite in the details view + */ + public function iUnmarkTheFileAsFavoriteInTheDetailsView() { + $this->iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView(); + + $this->actor->find(self::favoriteActionInFileDetailsInDetailsView(), 10)->click(); + } + + /** * @When I check the tag :tag in the dropdown for tags in the details view */ public function iCheckTheTagInTheDropdownForTagsInTheDetailsView($tag) { @@ -501,6 +546,22 @@ class FilesAppContext implements Context, ActorAwareInterface { } /** + * @Then I see that the file is marked as favorite in the details view + */ + public function iSeeThatTheFileIsMarkedAsFavoriteInTheDetailsView() { + PHPUnit_Framework_Assert::assertNotNull( + $this->actor->find(self::favoritedStateIconInFileDetailsInDetailsView(), 10)); + } + + /** + * @Then I see that the file is not marked as favorite in the details view + */ + public function iSeeThatTheFileIsNotMarkedAsFavoriteInTheDetailsView() { + PHPUnit_Framework_Assert::assertNotNull( + $this->actor->find(self::notFavoritedStateIconInFileDetailsInDetailsView(), 10)); + } + + /** * @Then I see that the input field for tags in the details view is shown */ public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() { |