Skip to content

Commit

Permalink
Add retry for share indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
dpakach authored and saw-jan committed Apr 21, 2021
1 parent 6fe81c6 commit 52cc593
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ config = {
'webUITags',
'webUIWebdavLockProtection',
'webUIWebdavLocks',
],
],
'iPhone2': [
'webUIMoveFilesFolders',
'webUIResharing1',
Expand Down Expand Up @@ -272,6 +272,7 @@ config = {
'webUISharingInternalUsersToRootSharingIndicator',
'webUISharingInternalUsersExpireToRoot',
'webUISharingInternalUsersToRoot',
'webUISharingInternalUsersToRootBlacklisted',
'webUISharingPermissionsUsers',
'webUISharingPermissionToRoot',
'webUISharingPublicBasic',
Expand Down
29 changes: 27 additions & 2 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,11 @@ module.exports = {
this.elements.shareIndicatorsInFileRow.locateStrategy,
shareIndicatorsXpath,
result => {
console.log(result)
result.value.forEach(element => {
this.api.elementIdAttribute(element.ELEMENT, 'class', attr => {
console.log(attr)
if (parseInt(attr.status) < 0) {
return
}
if (attr.value.indexOf('uk-invisible') >= 0) {
return
}
Expand Down Expand Up @@ -485,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 52cc593

Please sign in to comment.