https://stackoverflow.com/a/66072132/6793637
You can read this answer on how to use protractor
you can use await with any promise , but for call back function you have to make it a promise as you cannot use await with callback functions
Example:
const readFilePromise = () => {
return new Promise((resolve, reject) => {
fs.readFile(filePath, options, (err, data) => {
if (err) return reject(err)
resolve(data)
})
})
}
so we created a file read promise that resolves only after the call back is resolved
Now you can await it as
await readFilePromise ()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…