Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add acceptance test for sharing a file without edit permission
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Jun 11, 2020
commit 573bf4d667ed09254655cf634716de954dc1112a
20 changes: 20 additions & 0 deletions tests/acceptance/features/app-files-sharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
55 changes: 55 additions & 0 deletions tests/acceptance/features/bootstrap/FilesAppSharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ public static function permissionCheckboxInputFor($sharedWithName, $itemText) {
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
*/
Expand Down Expand Up @@ -372,6 +386,17 @@ public function iSetThePasswordOfTheSharedLinkAsNotProtectedByTalk() {
$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
*/
Expand Down Expand Up @@ -409,6 +434,36 @@ public function iSeeThatResharingTheFileIsNotAllowed() {
$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
*/
Expand Down