Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add acceptance tests for marking a file as favorite in the details view
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Nov 22, 2018
commit 94645ed75446ad4437eecf5aa342675fd0aa287b
19 changes: 19 additions & 0 deletions tests/acceptance/features/app-files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
61 changes: 61 additions & 0 deletions tests/acceptance/features/bootstrap/FilesAppContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,33 @@ public static function fileNameInDetailsView() {
describedAs("File name in details view in Files app");
}

/**
* @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
*/
Expand Down Expand Up @@ -372,6 +399,24 @@ public function iWriteDownTheSharedLink() {
$this->actor->getSharedNotebook()["shared link"] = $this->actor->find(self::copyLinkButton(), 2)->getWrappedElement()->getAttribute("data-clipboard-text");
}

/**
* @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
*/
Expand Down Expand Up @@ -500,6 +545,22 @@ public function iSeeThatTheFileNameShownInTheDetailsViewIs($fileName) {
$this->actor->find(self::fileNameInDetailsView(), 10)->getText(), $fileName);
}

/**
* @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
*/
Expand Down