Add acceptance tests for folders that can not be reshared
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
708e40e303
commit
fca154d1e0
|
@ -484,6 +484,55 @@ Feature: app-files
|
||||||
And I enter in the folder named "Shared folder"
|
And I enter in the folder named "Shared folder"
|
||||||
Then I see that the file list contains a file named "Subfolder"
|
Then I see that the file list contains a file named "Subfolder"
|
||||||
|
|
||||||
|
Scenario: sharee can not reshare a folder 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 create a new folder named "Shared folder"
|
||||||
|
And I see that the file list contains a file named "Shared folder"
|
||||||
|
And I share "Shared folder" with "user0"
|
||||||
|
And I see that the file is shared with "user0"
|
||||||
|
And I set the share with "user0" as not reshareable
|
||||||
|
And I see that "user0" can not reshare the share
|
||||||
|
When I act as Jane
|
||||||
|
# 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 "Shared folder"
|
||||||
|
And I open the details view for "Shared folder"
|
||||||
|
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"
|
||||||
|
And I see that resharing the file is not allowed
|
||||||
|
|
||||||
|
Scenario: sharee can not reshare a subfolder if the sharer disables it for the parent folder
|
||||||
|
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 create a new folder named "Shared folder"
|
||||||
|
And I see that the file list contains a file named "Shared folder"
|
||||||
|
And I share "Shared folder" with "user0"
|
||||||
|
And I see that the file is shared with "user0"
|
||||||
|
And I set the share with "user0" as not reshareable
|
||||||
|
And I see that "user0" can not reshare the share
|
||||||
|
And I enter in the folder named "Shared folder"
|
||||||
|
And I create a new folder named "Subfolder"
|
||||||
|
And I see that the file list contains a file named "Subfolder"
|
||||||
|
When I act as Jane
|
||||||
|
# The Files app is open again to reload the file list
|
||||||
|
And I open the Files app
|
||||||
|
And I enter in the folder named "Shared folder"
|
||||||
|
Then I see that the file list contains a file named "Subfolder"
|
||||||
|
And I open the details view for "Subfolder"
|
||||||
|
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 resharing the file is not allowed
|
||||||
|
|
||||||
Scenario: marking a file as favorite causes the file list to be sorted again
|
Scenario: marking a file as favorite causes the file list to be sorted again
|
||||||
Given I am logged in
|
Given I am logged in
|
||||||
And I create a new folder named "A name alphabetically lower than welcome.txt"
|
And I create a new folder named "A name alphabetically lower than welcome.txt"
|
||||||
|
|
|
@ -266,6 +266,45 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
||||||
describedAs("Shared with $sharedWithName row in the details view in Files app");
|
describedAs("Shared with $sharedWithName row in the details view in Files app");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Locator
|
||||||
|
*/
|
||||||
|
public static function shareWithMenuButton($sharedWithName) {
|
||||||
|
return Locator::forThe()->css(".share-menu > .icon")->
|
||||||
|
descendantOf(self::sharedWithRow($sharedWithName))->
|
||||||
|
describedAs("Share with $sharedWithName menu button in the details view in Files app");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Locator
|
||||||
|
*/
|
||||||
|
public static function shareWithMenu($sharedWithName) {
|
||||||
|
return Locator::forThe()->css(".share-menu > .menu")->
|
||||||
|
descendantOf(self::sharedWithRow($sharedWithName))->
|
||||||
|
describedAs("Share with $sharedWithName menu in the details view in Files app");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Locator
|
||||||
|
*/
|
||||||
|
public static function canReshareCheckbox($sharedWithName) {
|
||||||
|
// forThe()->checkbox("Can reshare") 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() = 'Can reshare']")->
|
||||||
|
descendantOf(self::shareWithMenu($sharedWithName))->
|
||||||
|
describedAs("Can reshare checkbox in the share with $sharedWithName menu in the details view in Files app");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Locator
|
||||||
|
*/
|
||||||
|
public static function canReshareCheckboxInput($sharedWithName) {
|
||||||
|
return Locator::forThe()->checkbox("Can reshare")->
|
||||||
|
descendantOf(self::shareWithMenu($sharedWithName))->
|
||||||
|
describedAs("Can reshare checkbox input in the share with $sharedWithName menu in the details view in Files app");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Locator
|
* @return Locator
|
||||||
*/
|
*/
|
||||||
|
@ -470,6 +509,17 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
||||||
$this->actor->find(self::passwordProtectField(), 2)->setValue($password . "\r");
|
$this->actor->find(self::passwordProtectField(), 2)->setValue($password . "\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I set the share with :shareWithName as not reshareable
|
||||||
|
*/
|
||||||
|
public function iSetTheShareWithAsNotReshareable($shareWithName) {
|
||||||
|
$this->showShareWithMenuIfNeeded($shareWithName);
|
||||||
|
|
||||||
|
$this->iSeeThatCanReshareTheShare($shareWithName);
|
||||||
|
|
||||||
|
$this->actor->find(self::canReshareCheckbox($shareWithName), 2)->click();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then I see that the current page is the Files app
|
* @Then I see that the current page is the Files app
|
||||||
*/
|
*/
|
||||||
|
@ -608,6 +658,36 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
||||||
$this->actor->find(self::sharedWithRow($sharedWithName), 10)->isVisible());
|
$this->actor->find(self::sharedWithRow($sharedWithName), 10)->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I see that resharing the file is not allowed
|
||||||
|
*/
|
||||||
|
public function iSeeThatResharingTheFileIsNotAllowed() {
|
||||||
|
PHPUnit_Framework_Assert::assertEquals(
|
||||||
|
$this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("disabled"), "disabled");
|
||||||
|
PHPUnit_Framework_Assert::assertEquals(
|
||||||
|
$this->actor->find(self::shareWithInput(), 10)->getWrappedElement()->getAttribute("placeholder"), "Resharing is not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I see that :sharedWithName can reshare the share
|
||||||
|
*/
|
||||||
|
public function iSeeThatCanReshareTheShare($sharedWithName) {
|
||||||
|
$this->showShareWithMenuIfNeeded($sharedWithName);
|
||||||
|
|
||||||
|
PHPUnit_Framework_Assert::assertTrue(
|
||||||
|
$this->actor->find(self::canReshareCheckboxInput($sharedWithName), 10)->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I see that :sharedWithName can not reshare the share
|
||||||
|
*/
|
||||||
|
public function iSeeThatCanNotReshareTheShare($sharedWithName) {
|
||||||
|
$this->showShareWithMenuIfNeeded($sharedWithName);
|
||||||
|
|
||||||
|
PHPUnit_Framework_Assert::assertFalse(
|
||||||
|
$this->actor->find(self::canReshareCheckboxInput($sharedWithName), 10)->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then I see that the working icon for password protect is shown
|
* @Then I see that the working icon for password protect is shown
|
||||||
*/
|
*/
|
||||||
|
@ -650,4 +730,17 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function showShareWithMenuIfNeeded($shareWithName) {
|
||||||
|
// In some cases the share menu is hidden after clicking on an action of
|
||||||
|
// the menu. Therefore, if the menu is visible, wait a little just in
|
||||||
|
// case it is in the process of being hidden due to a previous action,
|
||||||
|
// in which case it is shown again.
|
||||||
|
if (WaitFor::elementToBeEventuallyNotShown(
|
||||||
|
$this->actor,
|
||||||
|
self::shareWithMenu($shareWithName),
|
||||||
|
$timeout = 2 * $this->actor->getFindTimeoutMultiplier())) {
|
||||||
|
$this->actor->find(self::shareWithMenuButton($shareWithName), 10)->click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue