Skip to content

Commit

Permalink
last share time is updated after the share operation is compete
Browse files Browse the repository at this point in the history
  • Loading branch information
Talank committed Jul 31, 2020
1 parent b63a8a6 commit 928b9bf
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/acceptance/stepDefinitions/sharingContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ const waitBetweenShareOperations = async function() {
if (timeSinceLastShare <= 1001) {
await client.pause(1001 - timeSinceLastShare)
}
}

/**
* update time in which the last share operation was carried out
*/
const updateTimeOfLastShareOperation = function() {
timeOfLastShareOperation = Date.now()
}

Expand All @@ -132,7 +138,7 @@ const waitBetweenShareOperations = async function() {
* @param {string} extraParams.password Password of the share (public links)
* @param {string} extraParams.expireDate Expiry date of the share
*/
const shareFileFolder = function(
const shareFileFolder = async function(
elementToShare,
sharer,
receiver = null,
Expand All @@ -141,6 +147,7 @@ const shareFileFolder = function(
name = null,
extraParams = {}
) {
await waitBetweenShareOperations()
const params = new URLSearchParams()
elementToShare = path.resolve(elementToShare)
const permissions = sharingHelper.humanReadablePermissionsToBitmask(permissionString)
Expand All @@ -159,12 +166,13 @@ const shareFileFolder = function(
}
}
const url = 'apps/files_sharing/api/v1/shares'
return httpHelper
await httpHelper
.postOCS(url, sharer, params)
.then(res => res.json())
.then(function(json) {
httpHelper.checkOCSStatus(json, 'Could not create share. Message: ' + json.ocs.meta.message)
})
await updateTimeOfLastShareOperation()
}
/**
* create any share using dataTable
Expand Down Expand Up @@ -512,9 +520,8 @@ Given('user {string} has shared file/folder {string} with link with {string} per

Given(
'user {string} has shared file/folder {string} with link with {string} permissions and password {string}',
async function(sharer, elementToShare, permissions, password) {
await waitBetweenShareOperations()
await shareFileFolder(
function(sharer, elementToShare, permissions, password) {
return shareFileFolder(
elementToShare,
sharer,
null,
Expand Down Expand Up @@ -557,12 +564,11 @@ Given(
}
)

Given('user {string} has created a public link with following settings', async function(
Given('user {string} has created a public link with following settings', function(
sharer,
dataTable
) {
await waitBetweenShareOperations()
await createPublicLink(sharer, dataTable.rowsHash())
return createPublicLink(sharer, dataTable.rowsHash())
})

Given('the administrator has excluded group {string} from receiving shares', async function(group) {
Expand Down

0 comments on commit 928b9bf

Please sign in to comment.