Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] [full-ci] try-catch and retry possible cause of stale-dom #5834

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions tests/acceptance/pageObjects/FilesPageElement/filesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,25 +477,31 @@ module.exports = {
* @returns {Array} array of sharing indicator
*/
getShareIndicatorsForResource: async function(fileName, sharingIndicatorExpectedToBeVisible) {
const resourceRowXpath = this.getFileRowSelectorByFileName(fileName)
const shareIndicatorsXpath =
resourceRowXpath + this.elements.shareIndicatorsInFileRow.selector
let resourceRowXpath = this.getFileRowSelectorByFileName(fileName)
let shareIndicatorsXpath = resourceRowXpath + this.elements.shareIndicatorsInFileRow.selector
const indicators = []
await this.waitForFileVisible(fileName)
const {
waitForNegativeConditionTimeout,
waitForConditionTimeout,
waitForConditionPollInterval
} = client.globals
await this.waitForElementVisible({
selector: shareIndicatorsXpath,
locateStrategy: this.elements.shareIndicatorsInFileRow.locateStrategy,
abortOnFailure: false,
timeout: sharingIndicatorExpectedToBeVisible
? waitForConditionTimeout
: waitForNegativeConditionTimeout,
pollInterval: waitForConditionPollInterval
})
try {
await this.waitForElementVisible({
selector: shareIndicatorsXpath,
locateStrategy: this.elements.shareIndicatorsInFileRow.locateStrategy,
abortOnFailure: false,
timeout: sharingIndicatorExpectedToBeVisible
? waitForConditionTimeout
: waitForNegativeConditionTimeout,
pollInterval: waitForConditionPollInterval
})
} catch (error) {
console.log('\n Retrying with new reference \n')
resourceRowXpath = this.getFileRowSelectorByFileName(fileName)
shareIndicatorsXpath = resourceRowXpath + this.elements.shareIndicatorsInFileRow.selector
Comment on lines +501 to +502
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the value of these variables does not seems to be different from the initial value. Why do you need to update it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During await this.waitForElementVisible({ line error is thrown StaleElementReferenceException. So I put that code inside try-catch and retry it.

await this.waitForFileVisible(fileName)
}
Comment on lines +489 to +504
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we should do that. And also the error is thrown by
508: this.api.elementIdAttribute(element.ELEMENT, 'data-test-indicator-type', attr => {

what I suspect is, the DOM is refreshed due to the preview of the file causing the element reference to change.
so I suggest is to use @disablePreviews tag in webUISharingInternalUsersSharingIndicator/shareWithUsers.feature file

await this.api.elements(
this.elements.shareIndicatorsInFileRow.locateStrategy,
shareIndicatorsXpath,
Expand Down