Test Automation / Scenario
The Sleep Audit
One inherited test, 23 seconds of sleep, three different reasons. Classify each sleep and prescribe its condition-based replacement.
- Difficulty
- Easy
- Format
- Scenario
- Points
- 100
- Estimate
- 12 min
// MISSION BRIEF
Your Mission
An inherited signup test (framework-neutral pseudocode) contains four sleeps totaling 23 seconds. Multiply by 300 tests and 40 runs a day, and the math funds an intern.
But sleeps cannot just be deleted, each one papers over a REAL synchronization need. Your job: identify what each sleep is actually waiting for, and replace it with the right condition.
Decisions are weighted.
// FIRST CONTACT
Battle teaser
First artifact
signup.test (pseudocode)
S1 and S2 (page load, redirect) should become:
- AOne combined 8s sleep at the start, simpler to maintain
- BNothing, page loads cannot be waited on conditionally
- CShorter sleeps: 1.5s and 1s, per the measured timings
- DCondition waits on the UI: wait for a signup-form element to be ready, and assert/wait on the URL or a welcome-page element for the redirect
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
test-automationwaitsflakinessrefactoringe2e-testing