Skip to content

Commit

Permalink
Check if collaborators quickAction is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasHirt committed Jun 16, 2020
1 parent 507b37a commit fa0a463
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/files/src/components/FilesLists/QuickActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {
computed: {
filteredActions() {
return filterObject(this.actions, (key, value) => {
return value.displayed(this.item) === true
return value.displayed({ item: this.item, store: this.$store }) === true
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/quickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function openNewCollaboratorsPanel(ctx) {
})
}

function canShare(item) {
return item.canShare()
function canShare(ctx) {
return ctx.store.state.user.capabilities.files_sharing.api_enabled && ctx.item.canShare()
}

export default {
Expand Down
19 changes: 16 additions & 3 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,22 @@ module.exports = {
* @return {Promise<module.exports.commands>}
*/
isSharingButtonPresent: async function(resource) {
await this.waitForFileVisible(resource)
await filesRow.openFileActionsMenu(resource).isSharingBtnPresent()
return this
const sharingBtnSelector = util.format(
filesRow.elements.quickAction.selector,
'collaborators'
)
const resourceRowSelector = this.getFileRowSelectorByFileName(resource)
let isPresent = true

await this.api.elements(
this.elements.shareButtonInFileRow.locateStrategy,
resourceRowSelector + sharingBtnSelector,
result => {
isPresent = result.value.length > 0
}
)

return isPresent
},
/**
* @return {Promise<*>}
Expand Down
5 changes: 2 additions & 3 deletions tests/acceptance/stepDefinitions/sharingContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,8 @@ Then('it should not be possible to share file/folder {string} using the webUI',
const appSideBar = client.page.FilesPageElement.appSideBar()
const filesList = client.page.FilesPageElement.filesList()
// assumes current webUI state as no sidebar open for any resource
// TODO: Bring back when implementing collaborators quick action
// const state = await filesList.isSharingButtonPresent(resource)
// assert.ok(!state, `Error: Sharing button for resource ${resource} is not in disabled state`)
const state = await filesList.isSharingButtonPresent(resource)
assert.ok(!state, `Error: Sharing button for resource ${resource} is not in disabled state`)
await filesList.openSideBar(resource)
const sidebarLinkTabState = await appSideBar.isLinksTabPresentOnCurrentSidebar()
assert.ok(!sidebarLinkTabState, `Error: Sidebar 'Links' tab for resource ${resource} is present`)
Expand Down

0 comments on commit fa0a463

Please sign in to comment.