Selenium / Scenario

The Suite Frozen in 2017

A legacy WebDriverJS suite with zero awaits ran fine for years, then the selenium-webdriver 4 upgrade turned it into a 40ms 'pass' and a pile of unhandled rejections.

Difficulty
Medium
Format
Scenario
Points
150
Estimate
13 min

// MISSION BRIEF

Your Mission

You inherited a Node Selenium suite written in 2017. It has no async, no await, and until last week it worked. The upgrade to selenium-webdriver 4 changed that: tests now 'complete' in milliseconds, browsers pile up unclosed, and the log is a wall of unhandled rejections.

Read the legacy test, the failure log, and the changelog note. Explain the archaeology, then prescribe the rewrite.

// FIRST CONTACT

Battle teaser

First artifact

checkout.test.js (2017 style, unchanged since)

How did this test ever pass reliably in the 3.x era without a single await?

  1. AIt never truly passed; CI was misconfigured for three years
  2. BMocha used to auto-await any promise created inside a test
  3. CThe promise manager silently queued every scheduled command and ran them strictly in order, so sequential-looking code WAS sequential even though each call returned a promise
  4. DCommands were synchronous HTTP calls in 3.x, promises arrived in 4.0
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

seleniumjavascriptasyncmigrationflakiness