Add acceptance test for sharing a file without edit permission
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
e815b13265
commit
ae3af29646
|
@ -294,3 +294,23 @@ Feature: app-files-sharing
|
|||
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 resharing the file is not allowed
|
||||
|
||||
Scenario: sharee can not reshare a file with edit permission if the sharer disables it
|
||||
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 act as John
|
||||
And I rename "welcome.txt" to "farewell.txt"
|
||||
And I see that the file list contains a file named "farewell.txt"
|
||||
And I share "farewell.txt" with "user0"
|
||||
And I see that the file is shared with "user0"
|
||||
And I set the share with "user0" as not editable
|
||||
And I see that "user0" can not edit the share
|
||||
When I act as Jane
|
||||
# The Files app is open again to reload the file list
|
||||
And I open the Files app
|
||||
And I share "farewell.txt" with "user1"
|
||||
Then I see that the file is shared with "user1"
|
||||
And I see that "user1" can not edit the share
|
||||
And I see that "user1" can not be allowed to edit the share
|
||||
|
|
|
@ -121,6 +121,20 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
|
|||
describedAs("$itemText checkbox input in the share with $sharedWithName menu in the details view in Files app");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function canEditCheckbox($sharedWithName) {
|
||||
return self::permissionCheckboxFor($sharedWithName, 'Allow editing');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function canEditCheckboxInput($sharedWithName) {
|
||||
return self::permissionCheckboxInputFor($sharedWithName, 'Allow editing');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
|
@ -372,6 +386,17 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
|
|||
$this->actor->find(self::passwordProtectByTalkCheckbox(), 2)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I set the share with :shareWithName as not editable
|
||||
*/
|
||||
public function iSetTheShareWithAsNotEditable($shareWithName) {
|
||||
$this->showShareWithMenuIfNeeded($shareWithName);
|
||||
|
||||
$this->iSeeThatCanEditTheShare($shareWithName);
|
||||
|
||||
$this->actor->find(self::canEditCheckbox($shareWithName), 2)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I set the share with :shareWithName as not reshareable
|
||||
*/
|
||||
|
@ -409,6 +434,36 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
|
|||
$this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("placeholder"), "Resharing is not allowed");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that :sharedWithName can not be allowed to edit the share
|
||||
*/
|
||||
public function iSeeThatCanNotBeAllowedToEditTheShare($sharedWithName) {
|
||||
$this->showShareWithMenuIfNeeded($sharedWithName);
|
||||
|
||||
PHPUnit_Framework_Assert::assertEquals(
|
||||
$this->actor->find(self::canEditCheckboxInput($sharedWithName), 10)->getWrappedElement()->getAttribute("disabled"), "disabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that :sharedWithName can edit the share
|
||||
*/
|
||||
public function iSeeThatCanEditTheShare($sharedWithName) {
|
||||
$this->showShareWithMenuIfNeeded($sharedWithName);
|
||||
|
||||
PHPUnit_Framework_Assert::assertTrue(
|
||||
$this->actor->find(self::canEditCheckboxInput($sharedWithName), 10)->isChecked());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that :sharedWithName can not edit the share
|
||||
*/
|
||||
public function iSeeThatCanNotEditTheShare($sharedWithName) {
|
||||
$this->showShareWithMenuIfNeeded($sharedWithName);
|
||||
|
||||
PHPUnit_Framework_Assert::assertFalse(
|
||||
$this->actor->find(self::canEditCheckboxInput($sharedWithName), 10)->isChecked());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I see that :sharedWithName can reshare the share
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue