summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap/SettingsContext.php
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-10 22:16:10 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-11 01:35:27 +0100
commit22d949d9d9da89eb2395b1259c44db17d1db5856 (patch)
treee03153aa8f26c212a80573cdd861227e9568fed5 /tests/acceptance/features/bootstrap/SettingsContext.php
parenta1d79b2b2bd8bef37c30b5426c94724f9f9d6ab6 (diff)
downloadnextcloud-server-22d949d9d9da89eb2395b1259c44db17d1db5856.tar.gz
nextcloud-server-22d949d9d9da89eb2395b1259c44db17d1db5856.zip
Add acceptance tests for reshares when resharing is disabled
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance/features/bootstrap/SettingsContext.php')
-rw-r--r--tests/acceptance/features/bootstrap/SettingsContext.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php
index 60499c96bd1..2a3aeff2f2e 100644
--- a/tests/acceptance/features/bootstrap/SettingsContext.php
+++ b/tests/acceptance/features/bootstrap/SettingsContext.php
@@ -48,6 +48,25 @@ class SettingsContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function allowResharingCheckbox() {
+ // forThe()->checkbox("Allow resharing") 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() = 'Allow resharing']")->
+ describedAs("Allow resharing checkbox in Sharing section in Administration Sharing Settings");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function allowResharingCheckboxInput() {
+ return Locator::forThe()->checkbox("Allow resharing")->
+ describedAs("Allow resharing checkbox input in Sharing section in Administration Sharing Settings");
+ }
+
+ /**
+ * @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
@@ -131,6 +150,15 @@ class SettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @When I disable resharing
+ */
+ public function iDisableResharing() {
+ $this->iSeeThatResharingIsEnabled();
+
+ $this->actor->find(self::allowResharingCheckbox(), 2)->click();
+ }
+
+ /**
* @When I enable restricting username autocompletion to groups
*/
public function iEnableRestrictingUsernameAutocompletionToGroups() {
@@ -157,6 +185,22 @@ class SettingsContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that resharing is enabled
+ */
+ public function iSeeThatResharingIsEnabled() {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked());
+ }
+
+ /**
+ * @Then I see that resharing is disabled
+ */
+ public function iSeeThatResharingIsDisabled() {
+ PHPUnit_Framework_Assert::assertFalse(
+ $this->actor->find(self::allowResharingCheckboxInput(), 10)->isChecked());
+ }
+
+ /**
* @Then I see that username autocompletion is restricted to groups
*/
public function iSeeThatUsernameAutocompletionIsRestrictedToGroups() {