Commit 75ca2134 authored by Tom JORQUERA's avatar Tom JORQUERA
Browse files

Merge branch 'issue-17' into 'master'

runner: replace parallel loading of resources with sequential one

Closes #17

See merge request !13
parents 857d28df dd06abf0
const webdriverio = require('webdriverio');
// Utility function to resolve a list of promise-based function calls
// on a given element list sequentially
function resolveSequentially(f, elements) {
return elements.reduce(
(acc, curr) => acc.then(() => f(curr)).catch(err => console.error(err)),
new Promise(resolve => resolve()));
}
module.exports = config => ({
run: (controllerFilesList, server, room, clientConfig) => {
const client = webdriverio.remote(config.driver);
return client.init()
.url(server + '/' + room)
.then(
() => Promise.all(controllerFilesList.map(
f => client.execute(f, room, clientConfig))))
.then(() => resolveSequentially(f => client.execute(f, room, clientConfig),
controllerFilesList))
.then(() => client.execute(() => {
/* eslint-disable no-undef */
robot.start();
......
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