From 9386f24ab0a1b795f53f68ee064bde6756150217 Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Fri, 20 Mar 2020 19:51:09 +0100 Subject: Add acceptance test for accepting an incoming share MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- .../features/bootstrap/SettingsContext.php | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests/acceptance/features/bootstrap') diff --git a/tests/acceptance/features/bootstrap/SettingsContext.php b/tests/acceptance/features/bootstrap/SettingsContext.php index edbb6a94d15..82b22c43338 100644 --- a/tests/acceptance/features/bootstrap/SettingsContext.php +++ b/tests/acceptance/features/bootstrap/SettingsContext.php @@ -27,6 +27,25 @@ class SettingsContext implements Context, ActorAwareInterface { use ActorAware; + /** + * @return Locator + */ + public static function acceptSharesByDefaultCheckbox() { + // forThe()->checkbox("Accept user...") 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() = 'Accept user and group shares by default']")-> + describedAs("Accept shares by default checkbox in Sharing section in Personal Sharing Settings"); + } + + /** + * @return Locator + */ + public static function acceptSharesByDefaultCheckboxInput() { + return Locator::forThe()->checkbox("Accept user and group shares by default")-> + describedAs("Accept shares by default checkbox input in Sharing section in Personal Sharing Settings"); + } + /** * @return Locator */ @@ -84,6 +103,15 @@ class SettingsContext implements Context, ActorAwareInterface { describedAs("Reset button in system tags section in Administration Settings"); } + /** + * @When I disable accepting the shares by default + */ + public function iDisableAcceptingTheSharesByDefault() { + $this->iSeeThatSharesAreAcceptedByDefault(); + + $this->actor->find(self::acceptSharesByDefaultCheckbox(), 2)->click(); + } + /** * @When I create the tag :tag in the settings */ @@ -93,6 +121,22 @@ class SettingsContext implements Context, ActorAwareInterface { $this->actor->find(self::systemTagsCreateOrUpdateButton())->click(); } + /** + * @Then I see that shares are accepted by default + */ + public function iSeeThatSharesAreAcceptedByDefault() { + PHPUnit_Framework_Assert::assertTrue( + $this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked()); + } + + /** + * @Then I see that shares are not accepted by default + */ + public function iSeeThatSharesAreNotAcceptedByDefault() { + PHPUnit_Framework_Assert::assertFalse( + $this->actor->find(self::acceptSharesByDefaultCheckboxInput(), 10)->isChecked()); + } + /** * @Then I see that the button to select tags is shown */ -- cgit v1.2.3