Flaky Test

Intermittent Modal

A promotional modal appears ~50% of the time on page load, blocking the form and causing tests that do not handle it to fail.

Contact Form

Fill out and submit this contact form. On page load, there is a 50% chance a promotional modal appears and blocks the form.

Page Load Log

Each page load (or simulated reload) is logged below, showing whether the modal appeared.

Why This Causes Flaky Tests

A test that navigates to this page and immediately tries to fill in the form will fail ~50% of the time when the modal overlay blocks the form elements. The test needs to conditionally dismiss the modal before interacting with the form.

  • Modal appears with 50% probability (Math.random() < 0.5)
  • When present, the modal blocks all form interactions
  • Fix: Check for modal presence and dismiss it before form interaction