Skip to content

Commit

Permalink
improve sharing steps to be able to define the roles
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it authored and Lukas Hirt committed Jul 19, 2019
1 parent a65a115 commit a43ddc8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ Feature: Sharing files and folders with internal groups
@smokeTest @yetToImplement
Scenario: share a folder with an internal group
Given user "user3" has logged in using the webUI
When the user shares folder "simple-folder" with group "grp1" using the webUI
And the user selects role 'Viewer'
And the user confirms the share
And the user shares file "testimage.jpg" with group "grp1" using the webUI
And the user selects role 'Viewer'
And the user confirms the share
When the user shares folder "simple-folder" with group "grp1" as "Viewer" using the webUI
And the user shares file "testimage.jpg" with group "grp1" as "Viewer" using the webUI
And the user re-logs in as "user1" using the webUI
Then folder "simple-folder (2)" should be listed on the webUI
# And folder "simple-folder (2)" should be marked as shared with "grp1" by "User Three" on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ Feature: Sharing files and folders with internal users
@smokeTest
Scenario: share a file & folder with another internal user
Given 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 selects role 'Viewer'
And the user confirms the share
And the user shares file "testimage.jpg" with user "User One" using the webUI
And the user selects role 'Viewer'
And the user confirms the share
When the user shares folder "simple-folder" with user "User One" as "Viewer" using the webUI
And the user shares file "testimage.jpg" with user "User One" as "Viewer" using the webUI
And the user re-logs in as "user1" using the webUI
Then folder "simple-folder (2)" should be listed on the webUI
# And folder "simple-folder (2)" should be marked as shared by "User Two" on the webUI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
* @param {string} sharee
* @param {boolean} shareWithGroup
*/
shareWithUserOrGroup: async function (sharee, shareWithGroup = false) {
shareWithUserOrGroup: async function (sharee, shareWithGroup = false, role) {
this.enterAutoComplete(sharee)
// We need waitForElementPresent here.
// waitForElementVisible would break even with 'abortOnFailure: false' if the element is not present
Expand Down Expand Up @@ -43,6 +43,8 @@ module.exports = {
})

return this
.selectRoleForNewCollaborator(role)
.confirmShare()
},
/**
*
Expand Down
19 changes: 11 additions & 8 deletions tests/acceptance/stepDefinitions/sharingContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,35 @@ const userSettings = require('../helpers/userSettings')
* @param {string} file
* @param {string} sharee
* @param {boolean} shareWithGroup
* @param {string} role
*/
const userSharesFileOrFolderWithUserOrGroup = function (file, sharee, shareWithGroup = false) {
const userSharesFileOrFolderWithUserOrGroup = function (file, sharee, shareWithGroup, role) {
return client.page
.FilesPageElement
.sharingDialog()
.closeSharingDialog()
.openSharingDialog(file)
.shareWithUserOrGroup(sharee, shareWithGroup)
.shareWithUserOrGroup(sharee, shareWithGroup, role)
}

/**
*
* @param {string} file
* @param {string} sharee
* @param {string} role
*/
const userSharesFileOrFolderWithUser = function (file, sharee) {
return userSharesFileOrFolderWithUserOrGroup(file, sharee)
const userSharesFileOrFolderWithUser = function (file, sharee, role) {
return userSharesFileOrFolderWithUserOrGroup(file, sharee, false, role)
}

/**
*
* @param {string} file
* @param {string} sharee
* @param {string} role
*/
const userSharesFileOrFolderWithGroup = function (file, sharee) {
return userSharesFileOrFolderWithUserOrGroup(file, sharee, true)
const userSharesFileOrFolderWithGroup = function (file, sharee, role) {
return userSharesFileOrFolderWithUserOrGroup(file, sharee, true, role)
}

/**
Expand Down Expand Up @@ -84,9 +87,9 @@ When('the user types {string} in the share-with-field', function (input) {
return client.page.FilesPageElement.sharingDialog().enterAutoComplete(input)
})

When('the user shares file/folder {string} with group {string} using the webUI', userSharesFileOrFolderWithGroup)
When('the user shares file/folder {string} with group {string} as {string} using the webUI', userSharesFileOrFolderWithGroup)

When('the user shares file/folder {string} with user {string} using the webUI', userSharesFileOrFolderWithUser)
When('the user shares file/folder {string} with user {string} as {string} using the webUI', userSharesFileOrFolderWithUser)

Then('all users and groups that contain the string {string} in their name should be listed in the autocomplete list on the webUI', function (pattern) {
return client.page.FilesPageElement.sharingDialog().getShareAutocompleteItemsList()
Expand Down

0 comments on commit a43ddc8

Please sign in to comment.