I am a JS and Mocha newbie. This is my simplified source file.
$browser.get(LOGIN_URL)
.then(() => Promise.all([
populateInputById('signin-email', 'email', ACCOUNT_EMAIL),
populateInputById('signin-password', 'password', ACCOUNT_PASSWORD),
])).
then(() => {
console.log('Success');
});
The $browser
object is a global object, and is used by our system. I am supposed to write unit test for this function. That means that I need to be able to initialise this object.
I have read through mocha docs, and SO posts like this joining tests from multiple files with mocha.js. But how do I initialise the $browser
object?
My unit test file is as follows:
var assert = require('assert');
describe('Sample test', function() {
it('login test', function() {
// I need to initialise $browser here.
})
})