diff --git a/tests/acceptance/pageObjects/FilesPageElement/filesList.js b/tests/acceptance/pageObjects/FilesPageElement/filesList.js index 37c8299db1e..d941440cd2e 100644 --- a/tests/acceptance/pageObjects/FilesPageElement/filesList.js +++ b/tests/acceptance/pageObjects/FilesPageElement/filesList.js @@ -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 } @@ -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, diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js index ad8afa1f8d5..a73a4eacb17 100644 --- a/tests/acceptance/stepDefinitions/filesContext.js +++ b/tests/acceptance/stepDefinitions/filesContext.js @@ -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 )