diff --git a/.travis.yml b/.travis.yml index 6e36ca8e..732ef299 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,26 @@ language: node_js addons: firefox: latest -os: - - linux - - osx -node_js: - - "4.6" - - "5.11" - - "6.1" +matrix: + include: + - os: linux + node_js: "4" + - os: linux + env: CXX=g++-4.8 + node_js: "5" + - os: linux + node_js: "6" + - os: linux + env: CXX=g++-4.8 + node_js: "7" + - os: osx + node_js: "4" + - os: osx + node_js: "5" + - os: osx + node_js: "6" + - os: osx + node_js: "7" before_install: - export CHROME_BIN=chromium-browser - export DISPLAY=:99.0 @@ -20,3 +33,9 @@ script: - npm run lint - npm run lint-styles - npm run test +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 diff --git a/appveyor.yml b/appveyor.yml index 7bbb7237..274ccf19 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,15 @@ environment: matrix: - - nodejs_version: "4.6" - - nodejs_version: "5.11" - - nodejs_version: "6.1" + - nodejs_version: "4" + - nodejs_version: "6" + - nodejs_version: "7" +platform: + - x86 + - x64 install: - ps: Install-Product node $env:nodejs_version - md public + - npm install --global --production windows-build-tools - npm install build_script: - npm run build diff --git a/config/wdio.conf.js b/config/wdio.conf.js new file mode 100644 index 00000000..a44e9310 --- /dev/null +++ b/config/wdio.conf.js @@ -0,0 +1,47 @@ +var webpack = require("webpack"); +var WebpackDevServer = require("webpack-dev-server"); +var webpackConfig = require("./webpack.config"); +var testConfig = require("../test/config/specs"); + + +var server; + +exports.config = { + specs: [ + './test/specs/**/*.js' + ], + exclude: [ + ], + maxInstances: 10, + capabilities: [{ + maxInstances: 5, + browserName: 'firefox' + }], + sync: true, + logLevel: 'silent', + coloredLogs: true, + bail: 0, + screenshotPath: './errorShots/', + baseUrl: 'http://localhost', + waitforTimeout: 10000, + connectionRetryTimeout: 90000, + connectionRetryCount: 3, + services: ['phantomjs'], + framework: 'mocha', + reporters: ['spec'], + mochaOpts: { + ui: 'bdd', + // Because we don't know how long the initial build will take... + timeout: 2*60*1000 + }, + onPrepare: function (config, capabilities) { + var compiler = webpack(webpackConfig); + server = new WebpackDevServer(compiler, { + stats: "minimal" + }); + server.listen(testConfig.port); + }, + onComplete: function(exitCode) { + server.close(); + } +} diff --git a/webpack.config.js b/config/webpack.config.js similarity index 100% rename from webpack.config.js rename to config/webpack.config.js diff --git a/webpack.loaders.js b/config/webpack.loaders.js similarity index 100% rename from webpack.loaders.js rename to config/webpack.loaders.js diff --git a/webpack.production.config.js b/config/webpack.production.config.js similarity index 100% rename from webpack.production.config.js rename to config/webpack.production.config.js diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index 4c820935..00000000 --- a/karma.conf.js +++ /dev/null @@ -1,34 +0,0 @@ -var webpackConfig = require('./webpack.config.js'); - -// Karma configuration -module.exports = function(config) { - var browsers = ['Chrome']; - if (process.env.TRAVIS) { - browsers = ['Firefox']; - } - - config.set({ - browsers: browsers, - frameworks: ['mocha'], - // ... normal karma configuration - files: [ - // all files ending in "_test" - {pattern: 'test/*_test.js', watched: false}, - {pattern: 'test/**/*_test.js', watched: false} - // each file acts as entry point for the webpack configuration - ], - - preprocessors: { - // add webpack as preprocessor - 'test/*_test.js': ['webpack'], - 'test/**/*_test.js': ['webpack'] - }, - - webpack: webpackConfig, - webpackMiddleware: { - // webpack-dev-middleware configuration - // i. e. - stats: 'errors-only' - } - }); -}; diff --git a/package.json b/package.json index 2380ebb2..5ddc740a 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "description": "A MapboxGL visual style editor", "main": "''", "scripts": { - "stats": "webpack --config webpack.production.config.js --profile --json > stats.json", - "build": "webpack --config webpack.production.config.js --progress --profile --colors", - "test": "karma start --single-run", - "test-watch": "karma start", - "start": "webpack-dev-server --progress --profile --colors --watch-poll", + "stats": "webpack --config config/webpack.production.config.js --profile --json > stats.json", + "build": "webpack --config config/webpack.production.config.js --progress --profile --colors", + "test": "wdio config/wdio.conf.js", + "test-watch": "wdio config/wdio.conf.js --watch", + "start": "webpack-dev-server --progress --profile --colors --watch-poll --config config/webpack.config.js", "lint": "eslint --ext js --ext jsx {src,test}", "lint-styles": "stylelint 'src/styles/*.scss'" }, @@ -124,6 +124,10 @@ "stylelint-config-standard": "^15.0.1", "transform-loader": "^0.2.3", "url-loader": "0.5.7", + "wdio-mocha-framework": "^0.5.9", + "wdio-phantomjs-service": "^0.2.2", + "wdio-spec-reporter": "^0.1.0", + "webdriverio": "^4.6.2", "webpack": "1.14.0", "webpack-cleanup-plugin": "^0.4.1", "webpack-dev-server": "1.16.2" diff --git a/test/config/specs.js b/test/config/specs.js new file mode 100644 index 00000000..7bb8239b --- /dev/null +++ b/test/config/specs.js @@ -0,0 +1,6 @@ +var config = {}; + +config.port = 9001; +config.baseUrl = "http://localhost:"+config.port; + +module.exports = config; diff --git a/test/sample_test.js b/test/sample_test.js deleted file mode 100644 index b187c051..00000000 --- a/test/sample_test.js +++ /dev/null @@ -1,7 +0,0 @@ -import assert from 'assert' - -describe('Component', () => { - it('#always successds', () => { - assert.equal(1, 1) - }) -}) diff --git a/test/specs/simple.js b/test/specs/simple.js new file mode 100644 index 00000000..56b27695 --- /dev/null +++ b/test/specs/simple.js @@ -0,0 +1,15 @@ +var assert = require('assert'); +var config = require("../config/specs"); + + +describe('maputnik', function() { + + it('check logo exists', function () { + browser.url(config.baseUrl); + browser.waitForExist(".maputnik-toolbar-link"); + + var src = browser.getAttribute(".maputnik-toolbar-link img", "src"); + assert.equal(src, config.baseUrl+'/img/maputnik.png'); + }); + +});