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>
This commit is contained in:
Daniel Calviño Sánchez 2018-10-16 14:20:56 +02:00
parent 376704e834
commit a784e1fcc1
2 changed files with 48 additions and 0 deletions

View File

@ -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

View File

@ -276,6 +276,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
describedAs("Password protect checkbox in the details view in Files app");
}
/**
* @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
*/
@ -292,6 +301,18 @@ class FilesAppContext implements Context, ActorAwareInterface {
describedAs("Password protect working icon in the details view in Files app");
}
/**
* @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
*/
@ -537,6 +558,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
*/