Skip to content

Commit

Permalink
Add acceptance test steps to be used from Talk acceptance tests
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 38371c4 commit aa6fc9e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tests/acceptance/features/bootstrap/FilesAppContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ public static function passwordProtectByTalkCheckbox() {
describedAs("Password protect by Talk checkbox in the details view in Files app");
}

/**
* @return Locator
*/
public static function passwordProtectByTalkCheckboxInput() {
return Locator::forThe()->checkbox("Password protect by Talk")->
descendantOf(self::shareLinkMenu())->
describedAs("Password protect by Talk checkbox input in the details view in Files app");
}

/**
* @Given I close the details view
*/
Expand Down Expand Up @@ -418,6 +427,28 @@ public function iProtectTheSharedLinkWithThePassword($password) {
$this->actor->find(self::passwordProtectField(), 2)->setValue($password . "\r");
}

/**
* @When I set the password of the shared link as protected by Talk
*/
public function iSetThePasswordOfTheSharedLinkAsProtectedByTalk() {
$this->showShareLinkMenuIfNeeded();

$this->iSeeThatThePasswordOfTheLinkShareIsNotProtectedByTalk();

$this->actor->find(self::passwordProtectByTalkCheckbox(), 2)->click();
}

/**
* @When I set the password of the shared link as not protected by Talk
*/
public function iSetThePasswordOfTheSharedLinkAsNotProtectedByTalk() {
$this->showShareLinkMenuIfNeeded();

$this->iSeeThatThePasswordOfTheLinkShareIsProtectedByTalk();

$this->actor->find(self::passwordProtectByTalkCheckbox(), 2)->click();
}

/**
* @Then I see that the current page is the Files app
*/
Expand Down Expand Up @@ -571,6 +602,24 @@ public function iSeeThatTheLinkShareIsPasswordProtected() {
PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectField(), 10)->isVisible(), "Password protect field is visible");
}

/**
* @Then I see that the password of the link share is protected by Talk
*/
public function iSeeThatThePasswordOfTheLinkShareIsProtectedByTalk() {
$this->showShareLinkMenuIfNeeded();

PHPUnit_Framework_Assert::assertTrue($this->actor->find(self::passwordProtectByTalkCheckboxInput(), 10)->isChecked());
}

/**
* @Then I see that the password of the link share is not protected by Talk
*/
public function iSeeThatThePasswordOfTheLinkShareIsNotProtectedByTalk() {
$this->showShareLinkMenuIfNeeded();

PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::passwordProtectByTalkCheckboxInput(), 10)->isChecked());
}

/**
* @Then I see that the checkbox to protect the password of the link share by Talk is not shown
*/
Expand Down

0 comments on commit aa6fc9e

Please sign in to comment.