summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-11-22 18:56:15 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-11-23 15:13:08 +0100
commitaa695dca0dfa10e00e71021a906e45b3256d9e99 (patch)
tree0ac1a1e83923d1187de0ca7833c3405a41824b12 /tests/acceptance/features/bootstrap
parent75c373705408339dc71e5ba6775737b896dd5034 (diff)
downloadnextcloud-server-aa695dca0dfa10e00e71021a906e45b3256d9e99.tar.gz
nextcloud-server-aa695dca0dfa10e00e71021a906e45b3256d9e99.zip
Add acceptance tests for sharing a file with another user
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance/features/bootstrap')
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index a5d2c636f3e..a0d877a1aa9 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -45,6 +45,23 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ private static function appMenu() {
+ return Locator::forThe()->id("appmenu")->
+ describedAs("App menu in header");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function filesItemInAppMenu() {
+ return Locator::forThe()->xpath("/li[@data-id = 'files']")->
+ descendantOf(self::appMenu())->
+ describedAs("Files item in app menu in header");
+ }
+
+ /**
+ * @return Locator
+ */
public static function mainViewForSection($section) {
$sectionId = self::sections()[$section];
@@ -214,6 +231,44 @@ class FilesAppContext implements Context, ActorAwareInterface {
/**
* @return Locator
*/
+ public static function sharedByLabel() {
+ return Locator::forThe()->css(".reshare")->
+ descendantOf(self::detailsView())->
+ describedAs("Shared by label in the details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function shareWithInput() {
+ return Locator::forThe()->css(".shareWithField")->
+ descendantOf(self::detailsView())->
+ describedAs("Share with input in the details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function shareeList() {
+ return Locator::forThe()->css(".shareeListView")->
+ descendantOf(self::detailsView())->
+ describedAs("Sharee list in the details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
+ public static function sharedWithRow($sharedWithName) {
+ // "username" class is used for any type of share, not only for shares
+ // with users.
+ return Locator::forThe()->xpath("//span[contains(concat(' ', normalize-space(@class), ' '), ' username ') and normalize-space() = '$sharedWithName']/ancestor::li")->
+ descendantOf(self::shareeList())->
+ describedAs("Shared with $sharedWithName row in the details view in Files app");
+ }
+
+ /**
+ * @return Locator
+ */
public static function shareLinkRow() {
return Locator::forThe()->css(".linkShareView .shareWithList:first-child")->
descendantOf(self::detailsView())->
@@ -350,6 +405,13 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @Given I open the Files app
+ */
+ public function iOpenTheFilesApp() {
+ $this->actor->find(self::filesItemInAppMenu(), 10)->click();
+ }
+
+ /**
* @Given I close the details view
*/
public function iCloseTheDetailsView() {
@@ -388,6 +450,15 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @Given I share :fileName with :shareWithName
+ */
+ public function iShareWith($fileName, $shareWithName) {
+ $this->actor->find(FileListContext::shareActionForFile(self::currentSectionMainView(), $fileName), 10)->click();
+
+ $this->actor->find(self::shareWithInput(), 5)->setValue($shareWithName . "\r");
+ }
+
+ /**
* @Given I write down the shared link
*/
public function iWriteDownTheSharedLink() {
@@ -622,6 +693,22 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
/**
+ * @Then I see that the file is shared with me by :sharedByName
+ */
+ public function iSeeThatTheFileIsSharedWithMeBy($sharedByName) {
+ PHPUnit_Framework_Assert::assertEquals(
+ $this->actor->find(self::sharedByLabel(), 10)->getText(), "Shared with you by $sharedByName");
+ }
+
+ /**
+ * @Then I see that the file is shared with :sharedWithName
+ */
+ public function iSeeThatTheFileIsSharedWith($sharedWithName) {
+ PHPUnit_Framework_Assert::assertTrue(
+ $this->actor->find(self::sharedWithRow($sharedWithName), 10)->isVisible());
+ }
+
+ /**
* @Then I see that the download of the link share is hidden
*/
public function iSeeThatTheDownloadOfTheLinkShareIsHidden() {