Quick interview answer
JavaScript is single threaded with an event loop; promises queue microtasks, and async/await is syntax over promises. In test code every browser interaction returns a promise, so a missing await produces false passes.
Detailed explanation
The call stack runs synchronous code; completed promise callbacks run in the microtask queue before timers (macrotasks). await pauses the async function without blocking the thread. In Playwright or WebdriverIO, forgetting await means assertions run against an unresolved promise, which is truthy — the test passes for the wrong reason. Use eslint no-floating-promises to catch it.
1// BUG: no await, assertion runs against a Promise2if (page.locator('#total').textContent() === '$32.39') { /* never true */ }3 4// Correct5await expect(page.locator('#total')).toHaveText('$32.39');Real-world example
A suite of 40 'passing' E2E tests turned out to have 11 missing awaits — they never asserted anything.
Interview tip
Mention no-floating-promises linting; it separates people who have shipped JS suites from people who read about them.