Skip to content

Commit

Permalink
Merge pull request #4976 from owncloud/debug-intermittent-tests
Browse files Browse the repository at this point in the history
[Tests-Only] Get share indicators of a resource with retry
  • Loading branch information
saw-jan authored Apr 21, 2021
2 parents 24ed5c0 + 4005761 commit 5b90c5d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ module.exports = {
result => {
result.value.forEach(element => {
this.api.elementIdAttribute(element.ELEMENT, 'class', attr => {
if (parseInt(attr.status) < 0) {
return
}
if (attr.value.indexOf('uk-invisible') >= 0) {
return
}
Expand Down Expand Up @@ -483,6 +486,30 @@ module.exports = {
return indicators
},

/**
*
* @param {string} fileName
* @param {boolean} sharingIndicatorExpectedToBeVisible
* @returns {Array} array of sharing indicator
*/
getShareIndicatorsForResourceWithRetry: async function(
fileName,
sharingIndicatorExpectedToBeVisible
) {
let indicators = await this.getShareIndicatorsForResource(
fileName,
sharingIndicatorExpectedToBeVisible
)
if (!indicators.length) {
console.log('Share indicators not found on first try, Retrying again')
indicators = await this.getShareIndicatorsForResource(
fileName,
sharingIndicatorExpectedToBeVisible
)
}
return indicators
},

setSort: async function(column, isDesc = false) {
const columnSelector = util.format(
this.elements.filesTableHeaderColumn.selector,
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/stepDefinitions/filesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ Then('the following resources should have share indicators on the webUI', async
dataTable
) {
for (const { fileName, expectedIndicators } of dataTable.hashes()) {
const indicatorsArray = await client.page.FilesPageElement.filesList().getShareIndicatorsForResource(
const indicatorsArray = await client.page.FilesPageElement.filesList().getShareIndicatorsForResourceWithRetry(
fileName,
true
)
Expand Down

0 comments on commit 5b90c5d

Please sign in to comment.