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

Conversation

sakshamgurung
Copy link
Contributor

Description

Flaky test while trying to check the share indicator of a file inside shard folder.
Gives error: Error while running .isElementDisplayed() protocol action: The command failed because the referenced element is no longer attached to the DOM. – stale element reference:
There seems to be no any reload after file upload inside a shared folder. Possible cause of stale reference was not found.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • ...

@ownclouders
Copy link
Contributor

Results for oC10SharingInternalGroupsSharingIndicator https://drone.owncloud.com/owncloud/web/19212/24/1
The following scenarios passed on retry:

  • webUISharingInternalGroupsSharingIndicator/shareWithGroups.feature:114

@ownclouders
Copy link
Contributor

Results for oCISSharingInternalUsers1 https://drone.owncloud.com/owncloud/web/19212/55/1
The following scenarios passed on retry:

  • webUISharingInternalUsers/shareWithUsers.feature:108

resourceRowXpath = this.getFileRowSelectorByFileName(fileName)
shareIndicatorsXpath = resourceRowXpath + this.elements.shareIndicatorsInFileRow.selector
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.

console.log(error)
console.log('\n Retrying with new reference \n')
Copy link
Contributor

Choose a reason for hiding this comment

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

leftovers?

Copy link
Contributor

Choose a reason for hiding this comment

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

these console logs may be helpful for debugging.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe the error does not need to be logged but IMO the retrying info is good.

Copy link
Contributor

@kiranparajuli589 kiranparajuli589 left a comment

Choose a reason for hiding this comment

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

expect the existing comment...rest looks good to me 👍🏼

Copy link
Contributor

@pascalwengerter pascalwengerter left a comment

Choose a reason for hiding this comment

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

Please don't merge this without feedback from the web team :)

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ownclouders
Copy link
Contributor

Results for oC10SharingPublicManagement https://drone.owncloud.com/owncloud/web/19226/34/1
The following scenarios passed on retry:

  • webUISharingPublicManagement/publicLinkIndicator.feature:27

@ownclouders
Copy link
Contributor

Results for oC10SharingExternalRoot https://drone.owncloud.com/owncloud/web/19226/40/1
The following scenarios passed on retry:

  • webUISharingExternalToRoot/federationSharing.feature:111

Comment on lines +489 to +504
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)
}
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

@saw-jan
Copy link
Member

saw-jan commented Sep 30, 2021

Closing this because the fixes are made in PR #5852

@saw-jan saw-jan closed this Sep 30, 2021
@phil-davis phil-davis deleted the stale-element-ref branch September 30, 2021 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants