Commit 6d5fbfdb authored by Tom Jorquera's avatar Tom Jorquera
Browse files

add some logs and avoid exiting too soon

parent c3ff14a2
......@@ -3,8 +3,11 @@ const config = require('./config.json');
const runner = require('./lib/runner.js')(config.runner);
const controller = require('./lib/controller.js')('./client');
console.log('starting hublot...');
controller.loadAll('controller', 'lib', 'robot')
.then(modules => {
console.log('modules loaded... launching runner');
// Note: result can be stored in a variable to control further the browser
// e.g.: let client = runner.run(...); client.end();
runner.run(modules, config.visio.url, 'test-bot', config.client);
......@@ -12,3 +15,8 @@ controller.loadAll('controller', 'lib', 'robot')
.catch(err => {
console.error(err);
});
// Hang
(function wait() {
setTimeout(wait, 10000);
})();
......@@ -10,11 +10,18 @@ function resolveSequentially(f, elements) {
module.exports = config => ({
run: (controllerFilesList, server, room, clientConfig) => {
console.log('runner is up');
const client = webdriverio.remote(config.driver);
console.log('runner created client');
return client.init()
.then(() => console.log('runner: client started'))
.url(server + '/' + room)
.then(() => console.log('runner: connecting to url'))
.waitForVisible('#displayname', 30000)
.then(() => console.log('runner: displayname visible'))
.then(() => resolveSequentially(f => client.execute(f, room, clientConfig),
controllerFilesList))
.then(() => console.log('runner: modules resolved'))
.then(() => client.execute(() => {
setTimeout(() => {
/* eslint-disable no-undef */
......@@ -22,9 +29,12 @@ module.exports = config => ({
/* eslint-enable */
}, 500);
}))
.waitForVisible('#displayname', 30000)
.then(() => console.log('runner: robot started'))
.setValue('#displayname', clientConfig.name)
.click('.btn')
.waitForExist('//div[@video-id="video-thumb8"]', 30000);
.then(() => console.log('runner: button clicked'))
.waitForExist('//div[@video-id="video-thumb8"]', 30000)
.then(() => console.log('runner: video exists'))
.catch(err => console.log('runner: error %j', err));
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment