diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-10-16 15:20:56 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-02 15:30:22 +0300 |
commit | a784e1fcc12b75cb905429a8953840152e39bbbe (patch) | |
tree | d1118b55963596c0342e5f9596fca6cac08b8404 | |
parent | 376704e83413d093d596f1b9168daf24907189aa (diff) |
Test that "Password protect by Talk" is not shown if Talk is not enabled
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | tests/acceptance/features/app-files.feature | 4 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppContext.php | 44 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature index 70e085ca665..33bed4a3ef2 100644 --- a/tests/acceptance/features/app-files.feature +++ b/tests/acceptance/features/app-files.feature @@ -218,6 +218,10 @@ Feature: app-files When I protect the shared link with the password "abcdef" Then I see that the working icon for password protect is shown And I see that the working icon for password protect is eventually not shown + And I see that the link share is password protected + # As Talk is not enabled in the acceptance tests of the server the checkbox + # is never shown. + And I see that the checkbox to protect the password of the link share by Talk is not shown Scenario: access a shared link protected by password with a valid password Given I act as John diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index 459028813b5..03bf371095d 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -279,6 +279,15 @@ class FilesAppContext implements Context, ActorAwareInterface { /** * @return Locator */ + public static function passwordProtectCheckboxInput() { + return Locator::forThe()->checkbox("Password protect")-> + descendantOf(self::shareLinkMenu())-> + describedAs("Password protect checkbox input in the details view in Files app"); + } + + /** + * @return Locator + */ public static function passwordProtectField() { return Locator::forThe()->css(".linkPassText")->descendantOf(self::shareLinkMenu())-> describedAs("Password protect field in the details view in Files app"); @@ -293,6 +302,18 @@ class FilesAppContext implements Context, ActorAwareInterface { } /** + * @return Locator + */ + public static function passwordProtectByTalkCheckbox() { + // forThe()->checkbox("Password protect by Talk") 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() = 'Password protect by Talk']")-> + descendantOf(self::shareLinkMenu())-> + describedAs("Password protect by Talk checkbox in the details view in Files app"); + } + + /** * @Given I close the details view */ public function iCloseTheDetailsView() { @@ -538,6 +559,29 @@ class FilesAppContext implements Context, ActorAwareInterface { } /** + * @Then I see that the link share is password protected + */ + public function iSeeThatTheLinkShareIsPasswordProtected() { + $this->showShareLinkMenuIfNeeded(); + + PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectCheckboxInput(), 10)->isChecked(), "Password protect checkbox is checked"); + PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectField(), 10)->isVisible(), "Password protect field is visible"); + } + + /** + * @Then I see that the checkbox to protect the password of the link share by Talk is not shown + */ + public function iSeeThatTheCheckboxToProtectThePasswordOfTheLinkShareByTalkIsNotShown() { + $this->showShareLinkMenuIfNeeded(); + + try { + PHPUnit_Framework_Assert::assertFalse( + $this->actor->find(self::passwordProtectByTalkCheckbox())->isVisible()); + } catch (NoSuchElementException $exception) { + } + } + + /** * @Given I share the link for :fileName protected by the password :password */ public function iShareTheLinkForProtectedByThePassword($fileName, $password) { |