You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nightwatch: an awaited waitForElementPresent returns before the wait runs when the plugin is loaded #457
With @wdio/nightwatch-devtools loaded, an awaited waitForElementPresent returns before the wait has run, so the commands after it run first:
awaitbrowser.click('button[type="submit"]')// navigates to /secureawaitbrowser.waitForElementPresent('#flash',2000)// returns at onceconsttext=awaitbrowser.getText('#flash')// runs before the waitawaitbrowser.click('#logout')// navigates back to /login// only now does the wait poll for #flash, on /login, and time out
The test then fails on a timeout it would not have hit. The same spec against the same pages with the plugin removed passes, with the element present after about 500 ms. Seen in 9 of 9 runs while extending the conformance scenarios (#455).
Why it matters
The plugin changes the outcome of the user's own test, which is the one thing an observer must never do.
Expected
await browser.waitForElementPresent(...) resolves only after the wait has finished, with or without the plugin, so the following commands run against the page the wait saw.
Where to look
The plugin wraps Nightwatch commands to capture them (packages/nightwatch-devtools/src/helpers/browserProxy.ts). The wrapper likely resolves the awaited chainable before Nightwatch's queued wait has executed, so the user's await no longer waits for it.
Fixed by #467. The cause was the plugin's performance read: half a second after a navigation it ran browser.execute, a queued Nightwatch command fired from a timer, which became a child of whatever command the test was running and resolved that command's await early. An awaited waitForElementPresent that the read landed inside therefore returned before the wait ran. #467 moved the read onto the raw WebDriver transport. With it on main, the conformance suite's wait-order gap (the wait landing after its test's assertion in 15 of 15 runs) and the login-test-fails gap both went stale, and three runs in all BiDi modes passed without them; the gaps are removed in #465.
Activity
vishnuv688 commentedon Oct 27, 2026
Fixed by #467. The cause was the plugin's performance read: half a second after a navigation it ran
browser.execute, a queued Nightwatch command fired from a timer, which became a child of whatever command the test was running and resolved that command'sawaitearly. An awaitedwaitForElementPresentthat the read landed inside therefore returned before the wait ran. #467 moved the read onto the raw WebDriver transport. With it on main, the conformance suite's wait-order gap (the wait landing after its test's assertion in 15 of 15 runs) and the login-test-fails gap both went stale, and three runs in all BiDi modes passed without them; the gaps are removed in #465.