Add acceptance test for accepting an incoming share

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2020-03-20 19:51:09 +01:00
parent 887e740434
commit 9386f24ab0
2 changed files with 71 additions and 0 deletions

View File

@ -20,6 +20,33 @@ Feature: app-files-sharing
And I see that the "Sharing" tab in the details view is eventually loaded
And I see that the file is shared with me by "admin"
Scenario: share a file with another user that needs to accept shares
Given I act as John
And I am logged in as the admin
And I act as Jane
And I am logged in
And I visit the settings page
And I open the "Sharing" section
And I disable accepting the shares by default
And I see that shares are not accepted by default
And I act as John
And I rename "welcome.txt" to "farewell.txt"
And I see that the file list contains a file named "farewell.txt"
When I share "farewell.txt" with "user0"
And I see that the file is shared with "user0"
And I act as Jane
And I open the Files app
And I see that the file list does not contain a file named "farewell.txt"
And I accept the share for "/farewell.txt" in the notifications
# The Files app is open again to reload the file list
And I open the Files app
Then I see that the file list contains a file named "farewell.txt"
And I open the details view for "farewell.txt"
And I see that the details view is open
And I open the "Sharing" tab in the details view
And I see that the "Sharing" tab in the details view is eventually loaded
And I see that the file is shared with me by "admin"
Scenario: share a file with another user who already has a file with that name
Given I act as John
And I am logged in as the admin

View File

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