Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 2x | /** * You can use `call` to execute any async action within your test spec. The command itself * is treated like a synchronous function. It accepts promises and stops the execution until * the promise has resolved. * * <example> :call.js it('some testing here', () => { browser.url('http://google.com') // make an asynchronous call using any 3rd party library supporting promises // e.g. call to backend or db to inject fixture data browser.call(() => { return somePromiseLibrary.someMethod().then(() => { // ... }) }) // example for async call to 3rd party library that doesn't support promises browser.call(() => { return new Promise((resolve, reject) => { someOtherNodeLibrary.someMethod(param1, (err, res) => { if (err) { return reject(err) } resolve(res) }) }) }) // continue synchronously $('#elemA').click() $('.firstname').setValue('webdriverbot') }); * </example> * * @alias browser.call * @param {Function} callback function to be called * @type utility * */ export default function call (fn = () => {}) { return fn() } |