Skip to content

Commit

Permalink
Fix acceptance test selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Nov 16, 2021
1 parent 8c90ae4 commit c944748
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Feature: files and folders can be deleted from the trashbin
| name |
| lorem.txt |
| lorem-big.txt |
And the user batch deletes the marked files using the webUI
And the user batch deletes the market files permanently using the webUI
Then file "lorem.txt" should be listed on the webUI
And file "lorem-big.txt" should be listed on the webUI
But file "data.zip" should not be listed on the webUI
Expand All @@ -88,7 +88,7 @@ Feature: files and folders can be deleted from the trashbin
| name |
| lorem.txt |
| lorem-big.txt |
And the user batch deletes the marked files using the webUI
And the user batch deletes the market files permanently using the webUI
Then file "lorem.txt" should be listed on the webUI
And file "lorem-big.txt" should be listed on the webUI
But folder "simple-folder" should be listed on the webUI
Expand All @@ -97,14 +97,14 @@ Feature: files and folders can be deleted from the trashbin
@issue-product-188 @skipOnOC10 @issue-4582
Scenario: Select all files and delete from trashbin in a batch
When the user marks all files for batch action using the webUI
And the user batch deletes the marked files using the webUI
And the user batch deletes the market files permanently using the webUI
Then there should be no resources listed on the webUI

@skipOnOC10 @issue-product-188
# after the issue is fixed delete this scenario and use the one above
Scenario: Select all files and delete from trashbin in a batch (ocis bug demonstration)
When the user marks all files for batch action using the webUI
And the user batch deletes the marked files using the webUI
And the user batch deletes the market files permanently using the webUI
Then file "lorem.txt" should not be listed on the webUI
But folder "simple-folder" should be listed on the webUI

Expand Down
16 changes: 0 additions & 16 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,6 @@ module.exports = {
.waitForElementVisible('@checkBoxAllFiles')
.click('@checkBoxAllFiles')
},
/**
* Restores all the selected files/folders
*
*/
restoreSelected: function () {
return this.waitForElementVisible('@restoreSelectedButton')
.initAjaxCounters()
.useXpath()
.click('@restoreSelectedButton')
.waitForOutstandingAjaxCalls()
.useCss()
},

/**
* Toggle enable or disable file/folder select checkbox
Expand Down Expand Up @@ -708,10 +696,6 @@ module.exports = {
selector: '//input[@type="checkbox"]',
locateStrategy: 'xpath'
},
restoreSelectedButton: {
selector: '//span[contains(text(),"Restore")]',
locateStrategy: 'xpath'
},
collaboratorsList: {
selector: '.files-collaborators-lists'
},
Expand Down
9 changes: 3 additions & 6 deletions tests/acceptance/pageObjects/personalPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ module.exports = {
selector: '#new-file-menu-btn:enabled'
},
deleteSelectedButton: {
selector: '#delete-selected-btn'
selector: '.oc-files-actions-delete-trigger'
},
newResourceDropdown: {
selector: '#new-file-menu-drop'
Expand All @@ -341,9 +341,6 @@ module.exports = {
newFileInput: {
selector: '#new-file-input'
},
newFolderOkButton: {
selector: '#new-folder-ok'
},
breadcrumb: {
selector: '#files-breadcrumb li:nth-of-type(2)'
},
Expand Down Expand Up @@ -393,10 +390,10 @@ module.exports = {
selector: '.oc-modal-body-input .oc-text-input'
},
moveSelectedBtn: {
selector: '#move-selected-btn'
selector: '.oc-files-actions-move-trigger'
},
copySelectedBtn: {
selector: '#copy-selected-btn'
selector: '.oc-files-actions-copy-trigger'
},
editorCloseBtn: {
selector: '#markdown-editor-app-bar .uk-text-right .oc-button'
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/pageObjects/sharedWithMePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = {
locateStrategy: 'xpath'
},
batchDeclineSharesButton: {
selector: '#decline-selected-shares-btn'
selector: '.oc-files-actions-decline-share-trigger'
}
}
}
23 changes: 22 additions & 1 deletion tests/acceptance/pageObjects/trashbinPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,32 @@ module.exports = {
.initAjaxCounters()
.click('@clearTrashbin')
.waitForOutstandingAjaxCalls()
},
restoreSelected: function () {
return this.waitForElementVisible('@restoreSelectedButton')
.initAjaxCounters()
.click('@restoreSelectedButton')
.waitForOutstandingAjaxCalls()
},
deleteSelectedPermanently: function () {
return this.waitForElementVisible('@deleteSelectedPermanentlyButton')
.click('@deleteSelectedPermanentlyButton')
.waitForElementVisible('@dialog')
.waitForAnimationToFinish() // wait for transition on the modal to finish
.click('@dialogConfirmBtnEnabled')
.waitForAjaxCallsToStartAndFinish()
.waitForElementNotPresent('@dialog')
}
},
elements: {
clearTrashbin: {
selector: '#delete-selected-btn'
selector: '.oc-files-actions-empty-trash-bin-trigger'
},
restoreSelectedButton: {
selector: '.oc-files-actions-restore-trigger'
},
deleteSelectedPermanentlyButton: {
selector: '.oc-files-actions-delete-permanent-trigger'
}
}
}
17 changes: 16 additions & 1 deletion tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ When('the user marks all files for batch action using the webUI', function () {
return client.page.FilesPageElement.filesList().checkAllFiles()
})

When('the user batch deletes the marked files permanently using the webUI', function () {
return client.page.trashBinPage().deleteSelectedPermanently()
})

When('the user/public batch deletes the marked files using the webUI', function () {
return client.page.personalPage().deleteAllCheckedFiles()
})
Expand All @@ -541,6 +545,17 @@ When('the user batch unshares these files using the webUI', async function (shar
return client.page.sharedWithMePage().unshareAllCheckedFiles()
})

When(
'the user batch deletes these files permanently using the webUI',
async function (fileOrFolders) {
for (const item of fileOrFolders.rows()) {
await client.page.FilesPageElement.filesList().toggleFileOrFolderCheckbox('enable', item[0])
}

return client.page.trashBinPage().deleteSelectedPermanently()
}
)

When('the user batch deletes these files using the webUI', async function (fileOrFolders) {
for (const item of fileOrFolders.rows()) {
await client.page.FilesPageElement.filesList().toggleFileOrFolderCheckbox('enable', item[0])
Expand Down Expand Up @@ -599,7 +614,7 @@ When('the user clears the trashbin', function () {
})

When('the user batch restores the marked files using the webUI', function () {
return client.page.FilesPageElement.filesList().restoreSelected()
return client.page.trashbinPage().restoreSelected()
})

When('the user opens the sidebar for file/folder {string} on the webUI', function (item) {
Expand Down

0 comments on commit c944748

Please sign in to comment.