Hooks before/beforeEach continues to running test(s) before their command queue is finished.
When running commands without an async done callback in a before and/or beforeEach, the next test is run before the command queue within the before/beforeEach is complete.
module.exports = {
beforeEach: function (browser) { // or before
browser.pause(1000, function() {
console.log('beforeEach pause complete')
})
},
test: function (browser) {
console.log('test started');
}
};
// Actual output:
// 'test started'
// 'beforeEach pause complete'
// Expected output:
// 'beforeEach pause complete'
// 'test started'
Workaround: use the async hook format: beforeEach (browser, done)
, calling done()
at the end of the command queue.