Skip to content

Prevents StaleElementException when waiting for button text to change

Jay McCure requested to merge jm-mr-button-text-wait into master

What does this MR do and why?

This change is to prevent a transient StaleElementReferenceError when waiting for the MWPS button to change into the Merge button. I suspect this has caused these failures:

Staging ref Selenium error on ./qa/specs/featur... (#361224 - closed)

Failure in qa/specs/features/ee/browser_ui/secu... (#347200 - closed)

Previously the button element would be found and then the has_text? method will keep re-checking for the text to appear for the configured wait time. Since the wait_until causes a page refresh (and refreshes can be slow) it's possible that the has_text? will be attempted against a stale element. I can re-create this scenario fairly easily by running the line and manually refreshing. Now the check will use the text attribute which will not re-query the node and can't get a StaleElementReferenceError.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jay McCure

Merge request reports

Loading