2017-04-04 16:51:30 +02:00
|
|
|
var webpack = require("webpack");
|
|
|
|
var WebpackDevServer = require("webpack-dev-server");
|
2018-03-06 22:11:58 +01:00
|
|
|
var webpackConfig = require("./webpack.config");
|
2017-04-04 17:03:02 +02:00
|
|
|
var testConfig = require("../test/config/specs");
|
2018-01-05 18:45:55 +01:00
|
|
|
var artifacts = require("../test/artifacts");
|
|
|
|
var isDocker = require("is-docker");
|
2017-04-04 16:51:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
var server;
|
2018-01-05 18:45:55 +01:00
|
|
|
var SCREENSHOT_PATH = artifacts.pathSync("screenshots");
|
2017-04-04 16:51:30 +02:00
|
|
|
|
|
|
|
exports.config = {
|
2017-04-04 17:03:02 +02:00
|
|
|
specs: [
|
2018-01-10 14:19:34 +01:00
|
|
|
'./test/functional/index.js'
|
2017-04-04 17:03:02 +02:00
|
|
|
],
|
|
|
|
exclude: [
|
|
|
|
],
|
|
|
|
maxInstances: 10,
|
|
|
|
capabilities: [{
|
|
|
|
maxInstances: 5,
|
2018-01-05 18:45:55 +01:00
|
|
|
browserName: 'chrome'
|
2017-04-04 17:03:02 +02:00
|
|
|
}],
|
|
|
|
sync: true,
|
2017-11-07 19:13:06 +01:00
|
|
|
logLevel: 'verbose',
|
2017-04-04 17:03:02 +02:00
|
|
|
coloredLogs: true,
|
|
|
|
bail: 0,
|
2018-01-05 18:45:55 +01:00
|
|
|
screenshotPath: SCREENSHOT_PATH,
|
2018-04-09 18:49:56 +02:00
|
|
|
// Note: This is here because @orangemug currently runs Maputnik inside a docker container.
|
|
|
|
host: (isDocker() ? "host.docker.internal" : "0.0.0.0"),
|
2017-04-04 17:03:02 +02:00
|
|
|
baseUrl: 'http://localhost',
|
|
|
|
waitforTimeout: 10000,
|
|
|
|
connectionRetryTimeout: 90000,
|
|
|
|
connectionRetryCount: 3,
|
|
|
|
framework: 'mocha',
|
|
|
|
reporters: ['spec'],
|
|
|
|
mochaOpts: {
|
|
|
|
ui: 'bdd',
|
|
|
|
// Because we don't know how long the initial build will take...
|
2018-02-07 12:38:32 +01:00
|
|
|
timeout: 4*60*1000
|
2017-04-04 17:03:02 +02:00
|
|
|
},
|
|
|
|
onPrepare: function (config, capabilities) {
|
2018-04-09 11:20:37 +02:00
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
var compiler = webpack(webpackConfig);
|
|
|
|
server = new WebpackDevServer(compiler, {
|
|
|
|
stats: {
|
|
|
|
colors: true
|
|
|
|
}
|
|
|
|
});
|
2018-04-09 18:49:56 +02:00
|
|
|
server.listen(testConfig.port, (isDocker() ? "0.0.0.0" : "localhost"), function(err) {
|
2018-04-09 11:20:37 +02:00
|
|
|
if(err) {
|
2018-04-09 18:49:56 +02:00
|
|
|
reject(err);
|
2018-04-09 11:20:37 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
resolve();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
2017-04-04 17:03:02 +02:00
|
|
|
},
|
|
|
|
onComplete: function(exitCode) {
|
2018-01-05 18:45:55 +01:00
|
|
|
server.close()
|
2017-04-04 17:03:02 +02:00
|
|
|
}
|
2017-04-04 16:51:30 +02:00
|
|
|
}
|