Loading
Rapid diffs spec fixes
What does this MR do and why?
Fixes failures of this variety:
1) User comments on a diff when viewing comments when toggling inline comments in multiple files toggles comments
Failure/Error: super
Selenium::WebDriver::Error::StaleElementReferenceError:
stale element reference: stale element not found in the current frame
(Session info: chrome=151.0.7922.108); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#staleelementreferenceexception
Screenshot: /tmp/capybara/user_comments_on_a_diff_when_viewing_comments_when_toggling_inline_comments_in_multiple_files_toggles_comments.png
HTML: /tmp/capybara/user_comments_on_a_diff_when_viewing_comments_when_toggling_inline_comments_in_multiple_files_toggles_comments.html
...
rspec ./spec/features/merge_request/user_comments_on_diff_spec.rb:47 # User comments on a diff when viewing comments when toggling inline comments in multiple files toggles commentsSample fail-on-retry (hard failure) jobs:
- https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/16551648688
- https://gitlab.com/gitlab-org/gitlab/-/jobs/16546112803
- https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/16551238106
Sample pass-on-retry jobs:
- https://gitlab.com/gitlab-org/gitlab/-/jobs/16549535964
- https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/16493310380
There's been 88 first-attempt failures across 83 pipelines since 2026-09-12, 19 of which failed on retry.
There are two root causes, addressed in each of the first two commits:
select_parallel_view/select_inline_viewneed to wait for a rerender, which is streamed in.wait_for_requestsisn't sufficient.Instead we mark the existingWe just do the testid wait, per !256064 (comment 3855249163).diff-filesas old, start the view type change, wait for them to vanish, and wait for the new testid to appear.diff_fileneeds to return a reloadable element. Right now we're getting stale elements from thefind(...).ancestor('diff-file'); thefinded (found?) element is stale, andancestorcomplains. Rewriting it as just onefindfixes it; the returned element reloads itself when stale.
The third commit drops some now-unnecessary wait_for_requests.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Asherah Connor