I'm trying to promisify the nightwatch windowHandles function within page objects. For example normally you can obtain window handles via the callback syntax:
this.api.windowHandles(result => result)
But I'd like to access the result outside of the callback:
const promisifyCallback = (fn) => new Promise(resolve => fn(result => resolve(result));
const handles = await promisifyCallback(this.api.windowHandles)
Seems like it should work (and it does work for other nightwatch functions like getAttribute) but for some reason the usage here throws the following error:
TypeError: Cannot read properties of undefined (reading 'isES6Async')