From fa08e7079eced2a2081db8b9f9b694e30e07bc4a Mon Sep 17 00:00:00 2001 From: VicDeo Date: Wed, 25 Sep 2019 18:09:53 +0300 Subject: [PATCH] Add one more test case --- .../features/webUIFiles/copyPrivateLinks.feature | 11 ++++++++--- tests/acceptance/helpers/webdavHelper.js | 9 +++++---- tests/acceptance/stepDefinitions/filesContext.js | 10 ++++++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/acceptance/features/webUIFiles/copyPrivateLinks.feature b/tests/acceptance/features/webUIFiles/copyPrivateLinks.feature index 79489889d7c..c3db3f373ac 100644 --- a/tests/acceptance/features/webUIFiles/copyPrivateLinks.feature +++ b/tests/acceptance/features/webUIFiles/copyPrivateLinks.feature @@ -8,6 +8,11 @@ Feature: copy current path as a permanent link And user "user1" has logged in using the webUI And the user has browsed to the files page - Scenario: Copy permalink to clipboard - When the user copies the permalink of the current folder using the webUI - Then the clipboard content should match current folder permalink + Scenario Outline: Copy permalink to clipboard + When the user browses to the folder on the files page + And the user copies the permalink of the current folder using the webUI + Then the clipboard content should match permalink of resource + Examples: + | folder_name | + | "/" | + | "simple-folder" | diff --git a/tests/acceptance/helpers/webdavHelper.js b/tests/acceptance/helpers/webdavHelper.js index e8c692fa0e9..6e68caf4507 100644 --- a/tests/acceptance/helpers/webdavHelper.js +++ b/tests/acceptance/helpers/webdavHelper.js @@ -174,12 +174,13 @@ exports.createFile = function (user, fileName, contents = '') { * @param {string} path * @param {string} userId * @param {array} requestedProps - * @param {number} folderDepth */ -exports.getProperties = function (path, userId, requestedProps, folderDepth = 1) { +exports.getProperties = function (path, userId, requestedProps) { return new Promise((resolve) => { - exports.propfind(`/files/${userId}${path}`, userId, userSettings.getPasswordForUser(userId), requestedProps, - folderDepth) + const trimmedPath = path.replace(/^\/+/, '') // remove a leading slash + const relativePath = `/files/${userId}/${trimmedPath}` + exports.propfind(relativePath, userId, userSettings.getPasswordForUser(userId), requestedProps, + 0) .then(str => { const response = JSON.parse(convert.xml2json(str, { compact: true }))['d:multistatus']['d:response'] const properties = {} diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index 151a5cf9588..669821f1e3a 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -475,12 +475,18 @@ Given('the user has created the following files', function (entryList) { return client }) +When('the user browses to the folder {string} on the files page', (folderName) => { + const targetFolder = folderName === '/' ? '' : folderName + return client + .page.filesPage() + .navigateAndWaitTillLoaded(targetFolder) +}) When('the user copies the permalink of the current folder using the webUI', function () { return client.page.filesPage().copyPermalinkFromFilesAppBar() }) -Then('the clipboard content should match current folder permalink', function () { +Then('the clipboard content should match permalink of resource {string}', function (folderName) { return client.getClipBoardContent(function (value) { - webdav.getProperties('/', client.globals.currentUser, ['oc:privatelink']) + webdav.getProperties(folderName, client.globals.currentUser, ['oc:privatelink']) .then(folderData => { assert.strictEqual(folderData['oc:privatelink'], value) })