diff options
Diffstat (limited to 'tests/acceptance')
-rw-r--r-- | tests/acceptance/features/access-levels.feature | 20 | ||||
-rw-r--r-- | tests/acceptance/features/app-files.feature | 16 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppContext.php | 122 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/SettingsMenuContext.php | 38 | ||||
-rw-r--r-- | tests/acceptance/features/core/ElementWrapper.php | 2 |
5 files changed, 178 insertions, 20 deletions
diff --git a/tests/acceptance/features/access-levels.feature b/tests/acceptance/features/access-levels.feature index 57998899a57..80170296675 100644 --- a/tests/acceptance/features/access-levels.feature +++ b/tests/acceptance/features/access-levels.feature @@ -1,11 +1,10 @@ Feature: access-levels - Scenario: regular users can not see admin-level items in the Settings menu + Scenario: regular users cannot see admin-level items in the Settings menu Given I am logged in When I open the Settings menu Then I see that the Settings menu is shown - And I see that the "Personal" item in the Settings menu is shown - And I see that the "Admin" item in the Settings menu is not shown + And I see that the "Settings" item in the Settings menu is shown And I see that the "Users" item in the Settings menu is not shown And I see that the "Help" item in the Settings menu is shown And I see that the "Log out" item in the Settings menu is shown @@ -14,8 +13,19 @@ Feature: access-levels Given I am logged in as the admin When I open the Settings menu Then I see that the Settings menu is shown - And I see that the "Personal" item in the Settings menu is shown - And I see that the "Admin" item in the Settings menu is shown + And I see that the "Settings" item in the Settings menu is shown And I see that the "Users" item in the Settings menu is shown And I see that the "Help" item in the Settings menu is shown And I see that the "Log out" item in the Settings menu is shown + + Scenario: regular users cannot see admin-level items on the Settings page + Given I am logged in + When I visit the settings page + Then I see that the "Personal" settings panel is shown + And I see that the "Administration" settings panel is not shown + + Scenario: admin users can see admin-level items on the Settings page + Given I am logged in as the admin + When I visit the settings page + Then I see that the "Personal" settings panel is shown + And I see that the "Administration" settings panel is shown 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..52f69c66796 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,23 @@ 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) { + if (!$this->waitForElementToBeEventuallyNotShown(self::loadingIconForTabInCurrentSectionDetailsViewNamed($tabName), $timeout = 10)) { + 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() { @@ -354,20 +448,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @Then I see that the working icon for password protect is eventually not shown */ public function iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown() { - $timeout = 10; - $timeoutStep = 1; - - $actor = $this->actor; - $passwordProtectWorkingIcon = self::passwordProtectWorkingIcon(); - - $workingIconNotFoundCallback = function() use ($actor, $passwordProtectWorkingIcon) { - try { - return !$actor->find($passwordProtectWorkingIcon)->isVisible(); - } catch (NoSuchElementException $exception) { - return true; - } - }; - if (!Utils::waitFor($workingIconNotFoundCallback, $timeout, $timeoutStep)) { + if (!$this->waitForElementToBeEventuallyNotShown(self::passwordProtectWorkingIcon(), $timeout = 10)) { PHPUnit_Framework_Assert::fail("The working icon for password protect is still shown after $timeout seconds"); } } @@ -382,4 +463,17 @@ class FilesAppContext implements Context, ActorAwareInterface { $this->iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown(); } + private function waitForElementToBeEventuallyNotShown($elementLocator, $timeout = 10, $timeoutStep = 1) { + $actor = $this->actor; + + $elementNotFoundCallback = function() use ($actor, $elementLocator) { + try { + return !$actor->find($elementLocator)->isVisible(); + } catch (NoSuchElementException $exception) { + return true; + } + }; + + return Utils::waitFor($elementNotFoundCallback, $timeout, $timeoutStep); + } } diff --git a/tests/acceptance/features/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php index 1ff5d94e98f..401575c78f0 100644 --- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php +++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php @@ -67,6 +67,15 @@ class SettingsMenuContext implements Context, ActorAwareInterface { } /** + * @param string $itemText + * @return Locator + */ + private static function settingsPanelFor($itemText) { + return Locator::forThe()->xpath("//div[@id = 'app-navigation']//ul//li[@class = 'settings-caption' and normalize-space() = '$itemText']")-> + describedAs($itemText . " item in Settings panel"); + } + + /** * @When I open the Settings menu */ public function iOpenTheSettingsMenu() { @@ -83,6 +92,14 @@ class SettingsMenuContext implements Context, ActorAwareInterface { } /** + * @When I visit the settings page + */ + public function iVisitTheSettingsPage() { + $this->iOpenTheSettingsMenu(); + $this->actor->find(self::menuItemFor('Settings'), 2)->click(); + } + + /** * @When I log out */ public function iLogOut() { @@ -120,4 +137,25 @@ class SettingsMenuContext implements Context, ActorAwareInterface { } } + /** + * @Then I see that the :itemText settings panel is shown + */ + public function iSeeThatTheItemSettingsPanelIsShown($itemText) { + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible() + ); + } + + /** + * @Then I see that the :itemText settings panel is not shown + */ + public function iSeeThatTheItemSettingsPanelIsNotShown($itemText) { + try { + PHPUnit_Framework_Assert::assertFalse( + $this->actor->find(self::settingsPanelFor($itemText), 10)->isVisible() + ); + } catch (NoSuchElementException $exception) { + } + } + } diff --git a/tests/acceptance/features/core/ElementWrapper.php b/tests/acceptance/features/core/ElementWrapper.php index 6b730903f6c..f6ce176817b 100644 --- a/tests/acceptance/features/core/ElementWrapper.php +++ b/tests/acceptance/features/core/ElementWrapper.php @@ -119,7 +119,7 @@ class ElementWrapper { /** * Returns whether the wrapped element is visible or not. * - * @return boolbean true if the wrapped element is visible, false otherwise. + * @return bool true if the wrapped element is visible, false otherwise. */ public function isVisible() { $commandCallback = function() { |