Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-02-19 20:46:49 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-11 15:04:54 +0300
commit1218cee069bb1e2f083eda56be41364fe1ee766a (patch)
tree3c8e1c91e07cf308168d06dd7f356a4828d2f74b /tests
parent6e41e0bda5f39063b566f0598f14bcf650d9d3e0 (diff)
Add acceptance tests for creation of subfolders in public shared folders
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/features/app-files.feature65
-rw-r--r--tests/acceptance/features/bootstrap/FileListContext.php81
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php35
3 files changed, 181 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature
index 0f7c0c532e8..648d928684b 100644
--- a/tests/acceptance/features/app-files.feature
+++ b/tests/acceptance/features/app-files.feature
@@ -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"
diff --git a/tests/acceptance/features/bootstrap/FileListContext.php b/tests/acceptance/features/bootstrap/FileListContext.php
index 5c832f08af1..3410198a500 100644
--- a/tests/acceptance/features/bootstrap/FileListContext.php
+++ b/tests/acceptance/features/bootstrap/FileListContext.php
@@ -81,6 +81,49 @@ class FileListContext implements Context, ActorAwareInterface {
/**
* @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
+ */
public static function rowForFile($fileListAncestor, $fileName) {
return Locator::forThe()->xpath("//*[@id = 'fileList']//span[contains(concat(' ', normalize-space(@class), ' '), ' nametext ') and normalize-space() = '$fileName']/ancestor::tr")->
descendantOf($fileListAncestor)->
@@ -180,6 +223,23 @@ class FileListContext implements Context, ActorAwareInterface {
}
/**
+ * @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
*/
public function iOpenTheDetailsViewFor($fileName) {
@@ -216,6 +276,27 @@ class FileListContext implements Context, ActorAwareInterface {
}
/**
+ * @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
*/
public function iSeeThatTheFileListContainsAFileNamed($fileName) {
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index 7bdcc951c18..50997d98b0f 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -81,6 +81,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @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
+ */
public static function fileNameInCurrentSectionDetailsView() {
return Locator::forThe()->css(".fileName")->
descendantOf(self::currentSectionDetailsView())->
@@ -208,6 +217,18 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @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
+ */
public static function passwordProtectCheckbox() {
// forThe()->checkbox("Password protect") can not be used here; that
// would return the checkbox itself, but the element that the user
@@ -234,6 +255,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @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
*/
public function iOpenTheInputFieldForTagsInTheDetailsView() {
@@ -292,6 +320,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @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
*/
public function iProtectTheSharedLinkWithThePassword($password) {