' +
@@ -156,6 +160,7 @@
this.$('.localShareView').toggleClass('hidden', !$target.hasClass('subtab-localshare'));
var $linkShareView = this.$('.linkShareView');
+ var $linkListView = this.$('.linkListView');
if ($linkShareView.length) {
$linkShareView.toggleClass('hidden', !$target.hasClass('subtab-publicshare'));
@@ -166,7 +171,7 @@
itemModel: this.model
});
this.linkShareView.render();
- $linkShareView.append(this.linkShareView.$el);
+ $linkListView.html(this.linkShareView.$el);
}
}
},
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 04c58ae704ff..271ec48c10d6 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -35,6 +35,7 @@ describe('OC.Share.ShareDialogView', function() {
var configModel;
var shareModel;
var fileInfoModel;
+ var fileList;
var dialog;
beforeEach(function() {
@@ -963,11 +964,55 @@ describe('OC.Share.ShareDialogView', function() {
expect(dialog.$('.tabsContainer>.tab:eq(1)').hasClass('hidden')).toEqual(false);
});
it('creates link share view only after selecting tab', function() {
- expect(dialog.$('.linkShareView').is(':empty')).toEqual(true);
+ expect(dialog.$('.linkListView').is(':empty')).toEqual(true);
dialog.$('.subTabHeaders>.subTabHeader:eq(1)').click();
- expect(dialog.$('.linkShareView').is(':empty')).toEqual(false);
+ expect(dialog.$('.linkListView').is(':empty')).toEqual(false);
});
});
+ describe('shareTree', function() {
+ beforeEach(function() {
+ dialog.render();
+
+ $('#testArea').append('')
+ fileList = new OCA.Files.FileList($('#filelist'));
+ fileList._setShareTreeCache({
+ '/folder' : {
+ name: "folder",
+ shares : [{
+ share_type: 0,
+ share_with_displayname: "Demo user",
+ }, {
+ share_type: 1,
+ share_with_displayname: "Demo group",
+ }, {
+ share_type: 3,
+ share_with_displayname: "Demo link #1",
+ }, {
+ share_type: 3,
+ share_with_displayname: "Demo link #2",
+ }, {
+ share_type: 4,
+ share_with_displayname: "Demo guest",
+ }, {
+ share_type: 6,
+ share_with_displayname: "Demo remote user",
+ }]
+ }
+ });
+ })
+ afterEach(function() {
+ fileList.destroy();
+ $('#filelist').remove()
+ });
+ it('renders parent user/groups shares', function() {
+ fileList._setShareTreeUserGroupView()
+ expect(dialog.$el.find('#shareTreeUserGroupList li').length).toEqual(4);
+ })
+ it('renders parent link shares', function() {
+ fileList._setShareTreeLinkView()
+ expect(dialog.$el.find('#shareTreeLinkList li').length).toEqual(2);
+ })
+ });
});
diff --git a/tests/acceptance/features/bootstrap/WebUISharingContext.php b/tests/acceptance/features/bootstrap/WebUISharingContext.php
index f3053ffd6a4f..badbf6d9d816 100644
--- a/tests/acceptance/features/bootstrap/WebUISharingContext.php
+++ b/tests/acceptance/features/bootstrap/WebUISharingContext.php
@@ -1601,4 +1601,68 @@ public function tearDownScenario() {
);
}
}
+
+ /**
+ * @Then /^(file|folder) "([^"]*)" should have share indicator on the webUI$/
+ *
+ * @param string $fileOrFolder
+ * @param string $filename name of resource
+ *
+ * @return void
+ * @throws Exception
+ */
+ public function folderShouldHaveShareIndicatorOnTheWebUI($fileOrFolder, $filename) {
+ $isMarked = $this->filesPage->isShareIndicatorPresent(
+ $filename
+ );
+ Assert::assertEquals(true, $isMarked, "Expected: " . $fileOrFolder . " to be marked as shared but found: " . \strval($isMarked));
+ }
+
+ /**
+ * @Then /^(file|folder) "([^"]*)" should not have share indicator on the webUI$/
+ *
+ * @param string $fileOrFolder
+ * @param string $filename name of resource
+ *
+ * @return void
+ * @throws Exception
+ */
+ public function folderShouldNotHaveShareIndicatorOnTheWebUI($fileOrFolder, $filename) {
+ $isMarked = $this->filesPage->isShareIndicatorPresent(
+ $filename
+ );
+ Assert::assertEquals(false, $isMarked, "Expected: " . $fileOrFolder . " not to be marked as shared but found: " . \strval($isMarked));
+ }
+
+ /**
+ * @Then following resources should have share indicators on the webUI
+ *
+ * @param TableNode $resourceTable
+ *
+ * @return void
+ * @throws Exception
+ */
+ public function followingResourcesShouldHaveShareIndicatorOnTheWebUI(TableNode $resourceTable) {
+ $elementRows = $resourceTable->getRows();
+ $elements = $this->featureContext->simplifyArray($elementRows);
+ foreach ($elements as $element) {
+ $this->folderShouldHaveShareIndicatorOnTheWebUI(null, $element);
+ }
+ }
+
+ /**
+ * @Then following resources should not have share indicators on the webUI
+ *
+ * @param TableNode $resourceTable table headings: must be: |name|
+ *
+ * @return void
+ * @throws Exception
+ */
+ public function followingResourcesShouldNotHaveShareIndicatorOnTheWebUI(TableNode $resourceTable) {
+ $elementRows = $resourceTable->getRows();
+ $elements = $this->featureContext->simplifyArray($elementRows);
+ foreach ($elements as $element) {
+ $this->folderShouldNotHaveShareIndicatorOnTheWebUI(null, $element);
+ }
+ }
}
diff --git a/tests/acceptance/features/lib/FilesPage.php b/tests/acceptance/features/lib/FilesPage.php
index 82415dcdd8cc..64bdc106813d 100644
--- a/tests/acceptance/features/lib/FilesPage.php
+++ b/tests/acceptance/features/lib/FilesPage.php
@@ -43,6 +43,7 @@ class FilesPage extends FilesPageBasic {
protected $deleteAllSelectedBtnXpath = ".//*[@id='app-content-files']//*[@class='delete-selected']";
protected $homePageIconXpath = "//div[@class='breadcrumb']//img[@alt='Home']";
protected $folderBreadCrumbXpath = "//div[@class='breadcrumb']//a[contains(@href,'%s')]";
+ protected $resourceSharedIndicatorXpath = "//table[@id='filestable']//span[normalize-space(.)='%s']/../..//div[contains(@class, 'sharetree-item')]";
/**
*
@@ -399,4 +400,17 @@ public function browseToFolder($folderName) {
public function waitForUploadProgressbarToFinish() {
$this->filesPageCRUDFunctions->waitForUploadProgressbarToFinish();
}
+
+ /**
+ * checks whether given resource is marked as shared or not
+ *
+ * @param $fileName
+ *
+ * @return bool
+ */
+ public function isShareIndicatorPresent($fileName) {
+ $resourceMarkedSharedXpath = \sprintf($this->resourceSharedIndicatorXpath, $fileName);
+ $markedElement = $this->find("xpath", $resourceMarkedSharedXpath);
+ return $markedElement !== null;
+ }
}
diff --git a/tests/acceptance/features/lib/SharedByLinkPage.php b/tests/acceptance/features/lib/SharedByLinkPage.php
index 13857140cebc..6900586046a2 100644
--- a/tests/acceptance/features/lib/SharedByLinkPage.php
+++ b/tests/acceptance/features/lib/SharedByLinkPage.php
@@ -37,7 +37,7 @@ class SharedByLinkPage extends FilesPageCRUD {
protected $path = '/index.php/apps/files/?view=sharinglinks';
protected $fileNamesXpath = "//span[contains(@class,'nametext') and not(contains(@class,'innernametext'))]";
protected $fileNameMatchXpath = "//span[contains(@class,'nametext') and not(contains(@class,'innernametext')) and .=%s]";
- protected $fileListXpath = ".//div[@id='app-content-sharinglinks']//tbody[@id='fileList']";
+ protected $fileListXpath = ".//div[@id='app-content']//tbody[@id='fileList' and count(*) >= 1]";
protected $emptyContentXpath = ".//div[@id='app-content-sharinglinks']//div[@id='emptycontent']";
protected $deleteAllSelectedBtnXpath = ".//*[@id='app-content-files']//*[@class='delete-selected']";
/**
diff --git a/tests/acceptance/features/lib/SharedWithOthersPage.php b/tests/acceptance/features/lib/SharedWithOthersPage.php
index eba44c258292..6d18761e72f9 100644
--- a/tests/acceptance/features/lib/SharedWithOthersPage.php
+++ b/tests/acceptance/features/lib/SharedWithOthersPage.php
@@ -39,7 +39,7 @@ class SharedWithOthersPage extends FilesPageBasic {
protected $path = '/index.php/apps/files/?view=sharingout';
protected $fileNamesXpath = "//span[contains(@class,'nametext') and not(contains(@class,'innernametext'))]";
protected $fileNameMatchXpath = "//span[contains(@class,'nametext') and not(contains(@class,'innernametext')) and .=%s]";
- protected $fileListXpath = ".//div[@id='app-content-sharingout']//tbody[@id='fileList']";
+ protected $fileListXpath = ".//div[contains(@id, 'app-content')]//tbody[@id='fileList' and count(*) >= 1]";
protected $emptyContentXpath = ".//div[@id='app-content-sharingout']//div[@id='emptycontent']";
protected $filePathInRowXpath = ".//div[@id='app-content-sharingout']//tbody[@id='fileList']//tr";
protected $deleteAllSelectedBtnXpath = ".//*[@id='app-content-files']//*[@class='delete-selected']";
diff --git a/tests/acceptance/features/lib/SharedWithYouPage.php b/tests/acceptance/features/lib/SharedWithYouPage.php
index 8ba6560b013f..f713b3ae9617 100644
--- a/tests/acceptance/features/lib/SharedWithYouPage.php
+++ b/tests/acceptance/features/lib/SharedWithYouPage.php
@@ -28,7 +28,7 @@
* Shared with you page.
*/
class SharedWithYouPage extends FilesPageBasic {
-
+
/**
*
* @var string $path
@@ -36,30 +36,30 @@ class SharedWithYouPage extends FilesPageBasic {
protected $path = '/index.php/apps/files/?view=sharingin';
protected $fileNamesXpath = "//span[contains(@class,'nametext') and not(contains(@class,'innernametext'))]";
protected $fileNameMatchXpath = "//span[contains(@class,'nametext') and not(contains(@class,'innernametext')) and .=%s]";
- protected $fileListXpath = ".//div[@id='app-content-sharingin']//tbody[@id='fileList']";
+ protected $fileListXpath = ".//div[@id='app-content']//tbody[@id='fileList' and count(*) >= 1]";
protected $emptyContentXpath = ".//div[@id='app-content-sharingin']//div[@id='emptycontent']";
-
+
/**
* @return string
*/
protected function getFileListXpath() {
return $this->fileListXpath;
}
-
+
/**
* @return string
*/
protected function getFileNamesXpath() {
return $this->fileNamesXpath;
}
-
+
/**
* @return string
*/
protected function getFileNameMatchXpath() {
return $this->fileNameMatchXpath;
}
-
+
/**
* @return string
*/
@@ -95,7 +95,7 @@ public function declineFile(
) {
$this->initAjaxCounters($session);
$this->resetSumStartedAjaxRequests($session);
-
+
for ($counter = 0; $counter < $maxRetries; $counter++) {
$row = $this->findFileRowByName($name, $session);
try {
diff --git a/tests/acceptance/features/webUISharingInternalUsers/shareWithUsers.feature b/tests/acceptance/features/webUISharingInternalUsers/shareWithUsers.feature
index 266673d59091..92e8bd3f07d4 100644
--- a/tests/acceptance/features/webUISharingInternalUsers/shareWithUsers.feature
+++ b/tests/acceptance/features/webUISharingInternalUsers/shareWithUsers.feature
@@ -659,3 +659,193 @@ Feature: Sharing files and folders with internal users
And the option to delete file "lorem.txt" should not be available on the webUI
When the user shares file "lorem.txt" with user "User Three" using the webUI
Then as "user3" file "lorem.txt" should exist
+
+ Scenario: Create share with internal users and view those shared resources in files page and shared-with-others page
+ Given these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user2" has logged in using the webUI
+ When the user shares folder "simple-folder" with user "User One" using the webUI
+ And the user shares file "lorem.txt" with user "User One" using the webUI
+ Then folder "simple-folder" should not have share indicator on the webUI
+ And file "lorem.txt" should not have share indicator on the webUI
+ When the user opens folder "simple-folder" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user opens folder "simple-empty-folder" using the webUI
+ And the user uploads file "new-lorem.txt" using the webUI
+ And the user creates a folder with the name "XYZ" using the webUI
+ Then file "new-lorem.txt" should have share indicator on the webUI
+ And folder "XYZ" should have share indicator on the webUI
+ When the user browses to the shared-with-others page
+ Then following resources should not have share indicators on the webUI
+ | simple-folder |
+ | lorem.txt |
+ When the user opens folder "simple-folder" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+
+ Scenario: Create share for a folder within a group and view the shared folder in files page and shared-with-others page
+ Given these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And group "grp1" has been created
+ And user "user1" has been added to group "grp1"
+ And user "user2" has logged in using the webUI
+ When the user shares folder "simple-folder" with group "grp1" using the webUI
+ And the user opens folder "simple-folder" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user opens folder "simple-empty-folder" using the webUI
+ And the user uploads file "new-lorem.txt" using the webUI
+ And the user creates a folder with the name "XYZ" using the webUI
+ Then file "new-lorem.txt" should have share indicator on the webUI
+ And folder "XYZ" should have share indicator on the webUI
+ When the user browses to the shared-with-others page
+ Then following resources should not have share indicators on the webUI
+ | simple-folder |
+
+ Scenario: user receives a share from another user and view that received share in files page and shared-wih-you page when auto-accept-share is enabled
+ Given the setting "Automatically accept new incoming local user shares" in the section "Sharing" has been enabled
+ And these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user1" has logged in using the webUI
+ And the user has shared folder "simple-folder" with user "User Two" using the webUI
+ And the user re-logs in as "user2" using the webUI
+ When the user opens folder "simple-folder (2)" using the webUI
+ Then following resources should not have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user browses to the shared-with-you page
+ Then following resources should not have share indicators on the webUI
+ | simple-folder (2) |
+ When the user opens folder "simple-folder (2)" using the webUI
+ Then following resources should not have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+
+ Scenario: user creates a public link for a folder and views the shared folder from files page, shared-with-others page
+ and shared-by-link page
+ Given these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ And user "user1" has logged in using the webUI
+ When the user creates a new public link for folder "simple-folder" using the webUI
+ And the user closes the share dialog
+ And the user opens folder "simple-folder" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user browses to the shared-with-others page
+ And the user opens folder "simple-folder" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user browses to the shared-by-link page
+ And the user opens folder "simple-folder" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+
+ Scenario: resharing by public link and view the shared resource from different pages
+ Given these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user1" has shared folder "/simple-folder" with user "user2" with permissions "share,read"
+ And user "user2" has logged in using the webUI
+ When the user creates a new public link for folder "simple-folder (2)" using the webUI with
+ | name | Public link |
+ And the user closes the share dialog
+ And the user opens folder "simple-folder (2)" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user browses to the shared-with-you page
+ And the user opens folder "simple-folder (2)" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user browses to the shared-by-link page
+ And the user opens folder "simple-folder (2)" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+ When the user browses to the shared-with-others page
+ And the user opens folder "simple-folder (2)" using the webUI
+ Then following resources should have share indicators on the webUI
+ | simple-empty-folder |
+ | lorem.txt |
+ | block-aligned.txt |
+ | testavatar.png |
+ | testapp.zip |
+
+ Scenario: shares a sub folder and view the received share form files page and shared-with-you page
+ Given these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user1" has uploaded file "filesForUpload/lorem.txt" to "simple-folder/simple-empty-folder/lorem.txt"
+ And user "user1" has shared folder "/simple-folder/simple-empty-folder" with user "user2"
+ And user "user2" has logged in using the webUI
+ When the user opens folder "simple-empty-folder (2)" using the webUI
+ Then file "lorem.txt" should not have share indicator on the webUI
+ When the user browses to the shared-with-you page
+ And the user opens folder "simple-empty-folder (2)" using the webUI
+ Then file "lorem.txt" should not have share indicator on the webUI
+
+ Scenario: shares a sub folder and view the shared resource form files page and shared-with-others page
+ Given these users have been created with default attributes and skeleton files:
+ | username |
+ | user1 |
+ | user2 |
+ And user "user1" has uploaded file "filesForUpload/lorem.txt" to "simple-folder/simple-empty-folder/lorem.txt"
+ And user "user1" has shared folder "/simple-folder/simple-empty-folder" with user "user2" with permissions "share,read"
+ And user "user1" has logged in using the webUI
+ When the user opens folder "simple-folder" using the webUI
+ Then folder "simple-empty-folder" should not have share indicator on the webUI
+ When the user opens folder "simple-empty-folder" using the webUI
+ Then file "lorem.txt" should have share indicator on the webUI
+ When the user browses to the shared-with-others page
+ And the user opens folder "simple-empty-folder" using the webUI
+ Then file "lorem.txt" should have share indicator on the webUI