summaryrefslogtreecommitdiffstats
path: root/tests/acceptance
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-20 16:24:07 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 12:38:05 +0200
commit26ca5635451b50b49c68bda995678d09516a41eb (patch)
treed8fcbbc61e83da029cc588bb801df96087c1e33e /tests/acceptance
parent8a8e78d439a18fa643b64e49a372a64b7d450fb4 (diff)
downloadnextcloud-server-26ca5635451b50b49c68bda995678d09516a41eb.tar.gz
nextcloud-server-26ca5635451b50b49c68bda995678d09516a41eb.zip
Fix and extend acceptance tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests/acceptance')
-rw-r--r--tests/acceptance/features/access-levels.feature20
-rw-r--r--tests/acceptance/features/bootstrap/SettingsMenuContext.php39
-rw-r--r--tests/acceptance/features/core/ElementWrapper.php2
3 files changed, 55 insertions, 6 deletions
diff --git a/tests/acceptance/features/access-levels.feature b/tests/acceptance/features/access-levels.feature
index 57998899a57..91d6ba48e4e 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 amdin-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 amdin-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/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php
index 1ff5d94e98f..29b959fa92a 100644
--- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php
+++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php
@@ -67,12 +67,22 @@ 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() {
$this->actor->find(self::settingsMenuButton(), 10)->click();
}
+
/**
* @When I open the User settings
*/
@@ -83,6 +93,14 @@ class SettingsMenuContext implements Context, ActorAwareInterface {
}
/**
+ * @When I visit the settings page
+ */
+ public function iVisitTheSettingsPage() {
+ $this->iOpenTheSettingsMenu();
+ $this->actor->find(self::menuItemFor('Settings'), 20)->click();
+ }
+
+ /**
* @When I log out
*/
public function iLogOut() {
@@ -120,4 +138,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() {