Skip to content

Commit

Permalink
Fixed failing test on public link share
Browse files Browse the repository at this point in the history
  • Loading branch information
Talank committed Jul 29, 2020
1 parent f8dc393 commit 265bde5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ Feature: Share by public link
And the public uses the webUI to access the last public link created by user "user1" with password "qwertyui"
Then file "lorem.txt" should be listed on the webUI

@skipOnOCIS @skip @issue-3830
@skipOnOCIS @issue-3830
Scenario: user edits the password of an already existing public link and tries to access with old password
Given user "user1" has shared folder "simple-folder" with link with "read, update, create, delete" permissions and password "pass123"
And user "user1" has created a public link with following settings
Expand Down
22 changes: 18 additions & 4 deletions tests/acceptance/stepDefinitions/sharingContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const _ = require('lodash')
const path = require('../helpers/path')
const util = require('util')
const { COLLABORATOR_PERMISSION_ARRAY, calculateDate } = require('../helpers/sharingHelper')
let timeOfLastShareOperation = Date.now()

/**
*
Expand Down Expand Up @@ -107,6 +108,17 @@ Given(
}
)

/**
* makes sure share operations are carried out maximum once a second to avoid same stime
*/
const waitBetweenShareOperations = async function() {
const timeSinceLastShare = Date.now() - timeOfLastShareOperation
if (timeSinceLastShare <= 1001) {
await client.pause(1001 - timeSinceLastShare)
}
timeOfLastShareOperation = Date.now()
}

/**
* creates a new share
*
Expand Down Expand Up @@ -500,8 +512,9 @@ 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}',
function(sharer, elementToShare, permissions, password) {
return shareFileFolder(
async function(sharer, elementToShare, permissions, password) {
await waitBetweenShareOperations()
await shareFileFolder(
elementToShare,
sharer,
null,
Expand Down Expand Up @@ -544,11 +557,12 @@ Given(
}
)

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

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

0 comments on commit 265bde5

Please sign in to comment.