-
Notifications
You must be signed in to change notification settings - Fork 156
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
await this.waitForFileVisible(fileName) | ||
} | ||
Comment on lines
+489
to
+504
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 what I suspect is, the DOM is refreshed due to the preview of the file causing the element reference to change. |
||
await this.api.elements( | ||
this.elements.shareIndicatorsInFileRow.locateStrategy, | ||
shareIndicatorsXpath, | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 thrownStaleElementReferenceException
. So I put that code inside try-catch and retry it.