Add acceptance tests for creation of subfolders in public shared folders

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-02-19 18:46:49 +01:00
parent 4337de7559
commit e9f5073677
3 changed files with 121 additions and 0 deletions

View File

@ -41,6 +41,71 @@ Feature: app-files
And I open the Share menu And I open the Share menu
Then I see that the Share menu is shown Then I see that the Share menu is shown
Scenario: creation is not possible by default in a public shared folder
Given I act as John
And I am logged in
And I create a new folder named "Shared folder"
# To share the link the "Share" inline action has to be clicked but, as the
# details view is opened automatically when the folder is created, clicking
# on the inline action could fail if it is covered by the details view due
# to its opening animation. Instead of ensuring that the animations of the
# contents and the details view have both finished it is easier to close the
# details view and wait until it is closed before continuing.
And I close the details view
And I see that the details view is closed
And I share the link for "Shared folder"
And I write down the shared link
When I act as Jane
And I visit the shared link I wrote down
And I see that the current page is the shared link I wrote down
And I see that the file list is eventually loaded
Then I see that it is not possible to create new files
Scenario: create folder in a public editable shared folder
Given I act as John
And I am logged in
And I create a new folder named "Editable shared folder"
# To share the link the "Share" inline action has to be clicked but, as the
# details view is opened automatically when the folder is created, clicking
# on the inline action could fail if it is covered by the details view due
# to its opening animation. Instead of ensuring that the animations of the
# contents and the details view have both finished it is easier to close the
# details view and wait until it is closed before continuing.
And I close the details view
And I see that the details view is closed
And I share the link for "Editable shared folder"
And I set the shared link as editable
And I write down the shared link
When I act as Jane
And I visit the shared link I wrote down
And I see that the current page is the shared link I wrote down
And I create a new folder named "Subfolder"
Then I see that the file list contains a file named "Subfolder"
Scenario: owner sees folder created in the public page of an editable shared folder
Given I act as John
And I am logged in
And I create a new folder named "Editable shared folder"
# To share the link the "Share" inline action has to be clicked but, as the
# details view is opened automatically when the folder is created, clicking
# on the inline action could fail if it is covered by the details view due
# to its opening animation. Instead of ensuring that the animations of the
# contents and the details view have both finished it is easier to close the
# details view and wait until it is closed before continuing.
And I close the details view
And I see that the details view is closed
And I share the link for "Editable shared folder"
And I set the shared link as editable
And I write down the shared link
And I act as Jane
And I visit the shared link I wrote down
And I see that the current page is the shared link I wrote down
And I create a new folder named "Subfolder"
And I see that the file list contains a file named "Subfolder"
When I act as John
And I enter in the folder named "Editable shared folder"
Then I see that the file list contains a file named "Subfolder"
Scenario: set a password to a shared link Scenario: set a password to a shared link
Given I am logged in Given I am logged in
And I share the link for "welcome.txt" And I share the link for "welcome.txt"

View File

@ -78,6 +78,15 @@ class FileListContext implements Context, ActorAwareInterface {
$this->fileListAncestorsByActor[$actor->getName()] = $fileListAncestor; $this->fileListAncestorsByActor[$actor->getName()] = $fileListAncestor;
} }
/**
* @return Locator
*/
public static function mainWorkingIcon($fileListAncestor) {
return Locator::forThe()->css(".mask.icon-loading")->
descendantOf($fileListAncestor)->
describedAs("Main working icon in file list");
}
/** /**
* @return Locator * @return Locator
*/ */
@ -255,6 +264,13 @@ class FileListContext implements Context, ActorAwareInterface {
$this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName . "\r"); $this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName . "\r");
} }
/**
* @Given I enter in the folder named :folderName
*/
public function iEnterInTheFolderNamed($folderName) {
$this->actor->find(self::mainLinkForFile($this->fileListAncestor, $folderName), 10)->click();
}
/** /**
* @Given I open the details view for :fileName * @Given I open the details view for :fileName
*/ */
@ -306,6 +322,27 @@ class FileListContext implements Context, ActorAwareInterface {
$this->actor->find(self::viewFileInFolderMenuItem(), 2)->click(); $this->actor->find(self::viewFileInFolderMenuItem(), 2)->click();
} }
/**
* @Then I see that the file list is eventually loaded
*/
public function iSeeThatTheFileListIsEventuallyLoaded() {
if (!WaitFor::elementToBeEventuallyNotShown(
$this->actor,
self::mainWorkingIcon($this->fileListAncestor),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The main working icon for the file list is still shown after $timeout seconds");
}
}
/**
* @Then I see that it is not possible to create new files
*/
public function iSeeThatItIsNotPossibleToCreateNewFiles() {
// Once a file list is loaded the "Create" menu button is always in the
// DOM, so it is checked if it is visible or not.
PHPUnit_Framework_Assert::assertFalse($this->actor->find(self::createMenuButton($this->fileListAncestor))->isVisible());
}
/** /**
* @Then I see that the file list contains a file named :fileName * @Then I see that the file list contains a file named :fileName
*/ */

View File

@ -214,6 +214,18 @@ class FilesAppContext implements Context, ActorAwareInterface {
describedAs("Share link field in the details view in Files app"); describedAs("Share link field in the details view in Files app");
} }
/**
* @return Locator
*/
public static function allowUploadAndEditingRadioButton() {
// forThe()->radio("Allow upload and editing") can not be used here;
// that would return the radio button itself, but the element that the
// user interacts with is the label.
return Locator::forThe()->xpath("//label[normalize-space() = 'Allow upload and editing']")->
descendantOf(self::currentSectionDetailsView())->
describedAs("Allow upload and editing radio button in the details view in Files app");
}
/** /**
* @return Locator * @return Locator
*/ */
@ -307,6 +319,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
$this->actor->find(self::itemInDropdownForTag($tag), 10)->click(); $this->actor->find(self::itemInDropdownForTag($tag), 10)->click();
} }
/**
* @When I set the shared link as editable
*/
public function iSetTheSharedLinkAsEditable() {
$this->actor->find(self::allowUploadAndEditingRadioButton(), 10)->click();
}
/** /**
* @When I protect the shared link with the password :password * @When I protect the shared link with the password :password
*/ */