Skip to content

Commit

Permalink
Add one more test case
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Sep 26, 2019
1 parent fc853ec commit fa08e70
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
11 changes: 8 additions & 3 deletions tests/acceptance/features/webUIFiles/copyPrivateLinks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 <folder_name> 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 <folder_name>
Examples:
| folder_name |
| "/" |
| "simple-folder" |
9 changes: 5 additions & 4 deletions tests/acceptance/helpers/webdavHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
10 changes: 8 additions & 2 deletions tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit fa08e70

Please sign in to comment.