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-09 14:26:58 +0300
commite9f50736775bee7dc13819d125057a556fa97121 (patch)
tree1d3f8dbc0c588973bb67b41245167d7bc6a821a6 /tests
parent4337de755900aaf0644f6877f1337007265658e3 (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.php37
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php19
3 files changed, 121 insertions, 0 deletions
diff --git a/tests/acceptance/features/app-files.feature b/tests/acceptance/features/app-files.feature
index ef3d07ae499..7ca7a42e9e6 100644
--- a/tests/acceptance/features/app-files.feature
+++ b/tests/acceptance/features/app-files.feature
@@ -41,6 +41,71 @@ Feature: app-files
And I open the Share menu
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
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 236adafcbf8..bc225e3f9b1 100644
--- a/tests/acceptance/features/bootstrap/FileListContext.php
+++ b/tests/acceptance/features/bootstrap/FileListContext.php
@@ -81,6 +81,15 @@ 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)->
@@ -256,6 +265,13 @@ class FileListContext implements Context, ActorAwareInterface {
}
/**
+ * @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) {
@@ -307,6 +323,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 42ca284881c..50997d98b0f 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -217,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
@@ -308,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) {