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:
parent
6e41e0bda5
commit
1218cee069
|
@ -30,6 +30,71 @@ Feature: app-files
|
|||
Then I see that the file list contains a file named "farewell.txt"
|
||||
And I see that the file name shown in the details view is "farewell.txt"
|
||||
|
||||
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
|
||||
Given I am logged in
|
||||
And I share the link for "welcome.txt"
|
||||
|
|
|
@ -78,6 +78,49 @@ class FileListContext implements Context, ActorAwareInterface {
|
|||
$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
|
||||
*/
|
||||
public static function createMenuButton($fileListAncestor) {
|
||||
return Locator::forThe()->css("#controls .button.new")->
|
||||
descendantOf($fileListAncestor)->
|
||||
describedAs("Create menu button in file list");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
private static function createMenuItemFor($fileListAncestor, $newType) {
|
||||
return Locator::forThe()->xpath("//div[contains(concat(' ', normalize-space(@class), ' '), ' newFileMenu ')]//span[normalize-space() = '$newType']/ancestor::li")->
|
||||
descendantOf($fileListAncestor)->
|
||||
describedAs("Create $newType menu item in file list");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function createNewFolderMenuItem($fileListAncestor) {
|
||||
return self::createMenuItemFor($fileListAncestor, "New folder");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function createNewFolderMenuItemNameInput($fileListAncestor) {
|
||||
return Locator::forThe()->css(".filenameform input")->
|
||||
descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
|
||||
describedAs("Name input in create new folder menu item in file list");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
|
@ -179,6 +222,23 @@ class FileListContext implements Context, ActorAwareInterface {
|
|||
return self::fileActionsMenuItemFor("View in folder");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I create a new folder named :folderName
|
||||
*/
|
||||
public function iCreateANewFolderNamed($folderName) {
|
||||
$this->actor->find(self::createMenuButton($this->fileListAncestor), 10)->click();
|
||||
|
||||
$this->actor->find(self::createNewFolderMenuItem($this->fileListAncestor), 2)->click();
|
||||
$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
|
||||
*/
|
||||
|
@ -215,6 +275,27 @@ class FileListContext implements Context, ActorAwareInterface {
|
|||
$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
|
||||
*/
|
||||
|
|
|
@ -78,6 +78,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
|||
describedAs("Current section details view in Files app");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
public static function closeDetailsViewButton() {
|
||||
return Locator::forThe()->css(".icon-close")->
|
||||
descendantOf(self::currentSectionDetailsView())->
|
||||
describedAs("Close current section details view in Files app");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Locator
|
||||
*/
|
||||
|
@ -205,6 +214,18 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
|||
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
|
||||
*/
|
||||
|
@ -233,6 +254,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
|||
describedAs("Password protect working icon in the details view in Files app");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I close the details view
|
||||
*/
|
||||
public function iCloseTheDetailsView() {
|
||||
$this->actor->find(self::closeDetailsViewButton(), 10)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I open the input field for tags in the details view
|
||||
*/
|
||||
|
@ -291,6 +319,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
|
|||
$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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue