Skip to content

Commit

Permalink
Test that "Password protect by Talk" is not shown if Talk is not enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Nov 1, 2018
1 parent f3addeb commit 9abd506
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/acceptance/features/app-files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 44 additions & 0 deletions tests/acceptance/features/bootstrap/FilesAppContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ public static function passwordProtectCheckbox() {
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
*/
Expand All @@ -293,6 +302,18 @@ public static function passwordProtectWorkingIcon() {
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
*/
Expand Down Expand Up @@ -540,6 +561,29 @@ public function iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown() {
}
}

/**
* @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
*/
Expand Down

0 comments on commit 9abd506

Please sign in to comment.