Skip to content

Fix `admin_audit_logs_spec.rb` flaky test

Michael Becker requested to merge fix/350720 into master

What does this MR do and why?

To resolve #350720 (closed) we want to resolve the flakiness that required this spec to be added to spec/support/rspec_order_todo.yml

I removed this spec from the TODO file, and set out to figure out the flakiness.

I am not sure why this works. I narrowed the flaky behavior down to this spec, an discovered that if I added a save_and_open_screenshot call after the wait_for block, the spec would pass.

If I removed the save_and_open_screenshot, the spec failed.

The selenium browser seems to get into a weird state when using the wait_for block, and some (unknown) side effect from a page.driver.browser.save_screenshot "foo.png" call corrects that weird state and makes the spec pass

Navigating back to the new projects page has the same side effect being achieved by the wait_for + save_and_open_screenshot, in that we end up with a fresh page object, post project creation.

So, with this change the test avoids the weird browser state encountered when using the wait_for helper, while ultimately still testing the original expectation

How to set up and validate locally

  • specs seem to always pass after a satisfactory number of samples

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 Michael Becker

Merge request reports