nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.75k stars 1.3k forks source link

Fix Nightwatch commands in `waitUntil` callback return `NightwatchAPI` instead of a `Promise` #4171

Open capGoblin opened 2 months ago

capGoblin commented 2 months ago

Fixes #4158 The problem is that in waitUntil if we pass an async callback to waitUntil command, Nightwatch commands inside the callback still just return NightwatchAPI and no promise which can be awaited to get the result. While in perform command, it works fine and Nightwatch commands return a promise inside async callback passed to perfom command, which this is because the alwaysAsync is set true for perform which inturn returns the promise in this code block. Similarly now waitUntil returns promise instead of the NightwatchAPI as expected. Would love to hear any suggestions/opinions.