Skip to content

Fix flaky ee/spec/features/epics/update_epic_spec.rb by accepting alert

John Hope requested to merge jh-fix-flaky-spec-408227 into master

What does this MR do and why?

Fixes the flaky spec in #408227 (closed) and removes it from quarantine.

This spec is caused to fail by the addition of wait_for_all_requests to the standard visit method (this LOC) via monkeypatch in !118193 (merged).

This is because beforeunload triggers while waiting for requests, before a listener can be created to expect the alert and accept it.

There's no way to do this in the test other than to remove this change and use an accept_alert block, or to allow the monkeypatch to accept a further argument to run arbitrary code in between visiting the new URL and waiting for requests.

Since this change was introduced to presumably fix many specs, I've opted for the latter by allowing the method to take a block. That allows to pass the code to dismiss the alert to be executed before waiting.

However I think a better solution would be to implement visit_and_wait and leave the original visit as-is.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Merge request reports

Loading