summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-04-04 10:33:04 +0200
committerGitHub <noreply@github.com>2020-04-04 10:33:04 +0200
commit4a292126e57fb07282075d9e3cc0b479d7f0c377 (patch)
tree59d5303763554f578896d7022a105a9da0ddddea /tests/acceptance/features
parent0e53be44d5b20c02906eede1154e87a2bafe21b2 (diff)
parent4ec370016f8679925ddb87c77bc58467511d21d8 (diff)
downloadnextcloud-server-4a292126e57fb07282075d9e3cc0b479d7f0c377.tar.gz
nextcloud-server-4a292126e57fb07282075d9e3cc0b479d7f0c377.zip
Merge pull request #20139 from nextcloud/unify-default-value-for-restricting-user-enumeration-with-settings
Unify default value for restricting user enumeration with settings
Diffstat (limited to 'tests/acceptance/features')
-rw-r--r--tests/acceptance/features/bootstrap/SettingsContext.php44
-rw-r--r--tests/acceptance/features/header.feature11
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php
index 82b22c43338..5f9a724e771 100644
--- a/tests/acceptance/features/bootstrap/SettingsContext.php
+++ b/tests/acceptance/features/bootstrap/SettingsContext.php
@@ -49,6 +49,25 @@ class SettingsContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function restrictUsernameAutocompletionToGroupsCheckbox() {
+ // forThe()->checkbox("Restrict username...") can not be used here; that
+ // would return the checkbox itself, but the element that the user
+ // interacts with is the label.
+ return Locator::forThe()->xpath("//label[normalize-space() = 'Restrict username autocompletion to users within the same groups']")->
+ describedAs("Restrict username autocompletion to groups checkbox in Sharing section in Administration Sharing Settings");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function restrictUsernameAutocompletionToGroupsCheckboxInput() {
+ return Locator::forThe()->checkbox("Restrict username autocompletion to users within the same groups")->
+ describedAs("Restrict username autocompletion to groups checkbox input in Sharing section in Administration Sharing Settings");
+ }
+
+ /**
+ * @return Locator
+ */
public static function systemTagsSelectTagButton() {
return Locator::forThe()->id("s2id_systemtag")->
describedAs("Select tag button in system tags section in Administration Settings");
@@ -113,6 +132,15 @@ class SettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @When I enable restricting username autocompletion to groups
+ */
+ public function iEnableRestrictingUsernameAutocompletionToGroups() {
+ $this->iSeeThatUsernameAutocompletionIsNotRestrictedToGroups();
+
+ $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckbox(), 2)->click();
+ }
+
+ /**
* @When I create the tag :tag in the settings
*/
public function iCreateTheTagInTheSettings($tag) {
@@ -130,6 +158,22 @@ class SettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that username autocompletion is restricted to groups
+ */
+ public function iSeeThatUsernameAutocompletionIsRestrictedToGroups() {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked());
+ }
+
+ /**
+ * @Then I see that username autocompletion is not restricted to groups
+ */
+ public function iSeeThatUsernameAutocompletionIsNotRestrictedToGroups() {
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::restrictUsernameAutocompletionToGroupsCheckboxInput(), 10)->isChecked());
+ }
+
+ /**
* @Then I see that shares are not accepted by default
*/
public function iSeeThatSharesAreNotAcceptedByDefault() {
diff --git a/tests/acceptance/features/header.feature b/tests/acceptance/features/header.feature
index 04d5963668d..94b08e8f6d9 100644
--- a/tests/acceptance/features/header.feature
+++ b/tests/acceptance/features/header.feature
@@ -28,6 +28,17 @@ Feature: header
And I see that the contact "user0" in the Contacts menu is shown
And I see that the contact "admin" in the Contacts menu is not shown
+ Scenario: users from other groups are not seen in the contacts menu when autocompletion is restricted within the same group
+ Given I am logged in as the admin
+ And I visit the settings page
+ And I open the "Sharing" section of the "Administration" group
+ And I enable restricting username autocompletion to groups
+ And I see that username autocompletion is restricted to groups
+ When I open the Contacts menu
+ Then I see that the Contacts menu is shown
+ And I see that the contact "user0" in the Contacts menu is not shown
+ And I see that the contact "admin" in the Contacts menu is not shown
+
Scenario: just added users are seen in the contacts menu
Given I am logged in as the admin
And I open the User settings