diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-06-09 03:02:33 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2017-06-09 03:02:33 +0200 |
commit | be02b3df28ca9e2f45316594c2caaa680e74f676 (patch) | |
tree | 65c8055640246b9630f88baa22a826b95298e745 /tests/acceptance | |
parent | 3678be045ee03af574875952f071704a6a4c6000 (diff) | |
download | nextcloud-server-be02b3df28ca9e2f45316594c2caaa680e74f676.tar.gz nextcloud-server-be02b3df28ca9e2f45316594c2caaa680e74f676.zip |
Add acceptance tests for showing the input field for tags
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 | 16 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppContext.php | 107 |
2 files changed, 123 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature index 6779b37e145..8d32508513a 100644 --- a/tests/acceptance/features/app-files.feature +++ b/tests/acceptance/features/app-files.feature @@ -52,3 +52,19 @@ Feature: app-files And I authenticate with password "fedcba" Then I see that the current page is the Authenticate page for the shared link I wrote down And I see that a wrong password for the shared file message is shown + + Scenario: show the input field for tags 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 for "All files" section is open + When I open the input field for tags in the details view + Then I see that the input field for tags in the details view is shown + + Scenario: show the input field for tags in the details view after the sharing tab has loaded + Given I am logged in + And I open the details view for "welcome.txt" + And I see that the details view for "All files" section is open + And I open the "Sharing" tab in the details view + And I see that the "Sharing" tab in the details view is eventually loaded + When I open the input field for tags in the details view + Then I see that the input field for tags in the details view is shown diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index 5916fd4bec6..9d8e05a1325 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -105,6 +105,69 @@ class FilesAppContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function fileDetailsInCurrentSectionDetailsViewWithText($fileDetailsText) { + return Locator::forThe()->xpath("//span[normalize-space() = '$fileDetailsText']")-> + descendantOf(self::fileDetailsInCurrentSectionDetailsView())-> + describedAs("File details with text \"$fileDetailsText\" in current section details view in Files app"); + } + + /** + * @return Locator + */ + private static function fileDetailsInCurrentSectionDetailsView() { + return Locator::forThe()->css(".file-details")-> + descendantOf(self::currentSectionDetailsView())-> + describedAs("File details in current section details view in Files app"); + } + + /** + * @return Locator + */ + public static function inputFieldForTagsInCurrentSectionDetails() { + return Locator::forThe()->css(".systemTagsInfoView")-> + descendantOf(self::currentSectionDetailsView())-> + describedAs("Input field for tags in current section details view in Files app"); + } + + /** + * @return Locator + */ + public static function tabHeaderInCurrentSectionDetailsViewNamed($tabHeaderName) { + return Locator::forThe()->xpath("//li[normalize-space() = '$tabHeaderName']")-> + descendantOf(self::tabHeadersInCurrentSectionDetailsView())-> + describedAs("Tab header named $tabHeaderName in current section details view in Files app"); + } + + /** + * @return Locator + */ + private static function tabHeadersInCurrentSectionDetailsView() { + return Locator::forThe()->css(".tabHeaders")-> + descendantOf(self::currentSectionDetailsView())-> + describedAs("Tab headers in current section details view in Files app"); + } + + /** + * @return Locator + */ + public static function tabInCurrentSectionDetailsViewNamed($tabName) { + return Locator::forThe()->xpath("//div[@id=//*[contains(concat(' ', normalize-space(@class), ' '), ' tabHeader ') and normalize-space() = '$tabName']/@data-tabid]")-> + descendantOf(self::currentSectionDetailsView())-> + describedAs("Tab named $tabName in current section details view in Files app"); + } + + /** + * @return Locator + */ + public static function loadingIconForTabInCurrentSectionDetailsViewNamed($tabName) { + return Locator::forThe()->css(".loading")-> + descendantOf(self::tabInCurrentSectionDetailsViewNamed($tabName))-> + describedAs("Loading icon for tab named $tabName in current section details view in Files app"); + } + + /** + * @return Locator + */ public static function shareLinkCheckbox() { // forThe()->checkbox("Share link") can not be used here; that would // return the checkbox itself, but the element that the user interacts @@ -247,6 +310,20 @@ class FilesAppContext implements Context, ActorAwareInterface { } /** + * @Given I open the input field for tags in the details view + */ + public function iOpenTheInputFieldForTagsInTheDetailsView() { + $this->actor->find(self::fileDetailsInCurrentSectionDetailsViewWithText("Tags"), 10)->click(); + } + + /** + * @Given I open the :tabName tab in the details view + */ + public function iOpenTheTabInTheDetailsView($tabName) { + $this->actor->find(self::tabHeaderInCurrentSectionDetailsViewNamed($tabName), 10)->click(); + } + + /** * @Given I mark :fileName as favorite */ public function iMarkAsFavorite($fileName) { @@ -344,6 +421,36 @@ class FilesAppContext implements Context, ActorAwareInterface { } /** + * @Then I see that the input field for tags in the details view is shown + */ + public function iSeeThatTheInputFieldForTagsInTheDetailsViewIsShown() { + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::inputFieldForTagsInCurrentSectionDetails(), 10)->isVisible()); + } + + /** + * @When I see that the :tabName tab in the details view is eventually loaded + */ + public function iSeeThatTheTabInTheDetailsViewIsEventuallyLoaded($tabName) { + $timeout = 10; + $timeoutStep = 1; + + $actor = $this->actor; + $loadingIcon = self::loadingIconForTabInCurrentSectionDetailsViewNamed($tabName); + + $loadingIconNotFoundCallback = function() use ($actor, $loadingIcon) { + try { + return !$actor->find($loadingIcon)->isVisible(); + } catch (NoSuchElementException $exception) { + return true; + } + }; + if (!Utils::waitFor($loadingIconNotFoundCallback, $timeout, $timeoutStep)) { + PHPUnit_Framework_Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds"); + } + } + + /** * @Then I see that the working icon for password protect is shown */ public function iSeeThatTheWorkingIconForPasswordProtectIsShown() { |