From 7dc4ef649ca8337a324fe81cf2607104a6f3f768 Mon Sep 17 00:00:00 2001 From: salomonelli Date: Sat, 20 May 2017 13:40:31 +0200 Subject: [PATCH] REMOVE e2e --- package.json | 4 +- static/.gitkeep | 0 test/{unit => }/.eslintrc | 0 test/e2e/custom-assertions/elementCount.js | 26 ------------ test/e2e/nightwatch.conf.js | 46 ---------------------- test/e2e/runner.js | 33 ---------------- test/e2e/specs/test.js | 19 --------- test/{unit => }/index.js | 0 test/{unit => }/karma.conf.js | 0 test/specs/Hello.spec.js | 11 ++++++ test/unit/specs/Hello.spec.js | 11 ------ 11 files changed, 12 insertions(+), 138 deletions(-) delete mode 100755 static/.gitkeep rename test/{unit => }/.eslintrc (100%) delete mode 100755 test/e2e/custom-assertions/elementCount.js delete mode 100755 test/e2e/nightwatch.conf.js delete mode 100755 test/e2e/runner.js delete mode 100755 test/e2e/specs/test.js rename test/{unit => }/index.js (100%) rename test/{unit => }/karma.conf.js (100%) create mode 100755 test/specs/Hello.spec.js delete mode 100755 test/unit/specs/Hello.spec.js diff --git a/package.json b/package.json index 445e003..4aea9fa 100755 --- a/package.json +++ b/package.json @@ -9,9 +9,7 @@ "start": "node build/dev-server.js", "pdf": "node --harmony-async-await node/app.js", "build": "node build/build.js", - "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", - "e2e": "node test/e2e/runner.js", - "test": "npm run unit && npm run e2e", + "test": "cross-env BABEL_ENV=test karma start test/karma.conf.js --single-run", "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" }, "dependencies": { diff --git a/static/.gitkeep b/static/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/test/unit/.eslintrc b/test/.eslintrc similarity index 100% rename from test/unit/.eslintrc rename to test/.eslintrc diff --git a/test/e2e/custom-assertions/elementCount.js b/test/e2e/custom-assertions/elementCount.js deleted file mode 100755 index c0d5fe0..0000000 --- a/test/e2e/custom-assertions/elementCount.js +++ /dev/null @@ -1,26 +0,0 @@ -// A custom Nightwatch assertion. -// the name of the method is the filename. -// can be used in tests like this: -// -// browser.assert.elementCount(selector, count) -// -// for how to write custom assertions see -// http://nightwatchjs.org/guide#writing-custom-assertions -exports.assertion = function (selector, count) { - this.message = 'Testing if element <' + selector + '> has count: ' + count - this.expected = count - this.pass = function (val) { - return val === this.expected - } - this.value = function (res) { - return res.value - } - this.command = function (cb) { - var self = this - return this.api.execute(function (selector) { - return document.querySelectorAll(selector).length - }, [selector], function (res) { - cb.call(self, res) - }) - } -} diff --git a/test/e2e/nightwatch.conf.js b/test/e2e/nightwatch.conf.js deleted file mode 100755 index f019c0a..0000000 --- a/test/e2e/nightwatch.conf.js +++ /dev/null @@ -1,46 +0,0 @@ -require('babel-register') -var config = require('../../config') - -// http://nightwatchjs.org/gettingstarted#settings-file -module.exports = { - src_folders: ['test/e2e/specs'], - output_folder: 'test/e2e/reports', - custom_assertions_path: ['test/e2e/custom-assertions'], - - selenium: { - start_process: true, - server_path: require('selenium-server').path, - host: '127.0.0.1', - port: 4444, - cli_args: { - 'webdriver.chrome.driver': require('chromedriver').path - } - }, - - test_settings: { - default: { - selenium_port: 4444, - selenium_host: 'localhost', - silent: true, - globals: { - devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) - } - }, - - chrome: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true - } - }, - - firefox: { - desiredCapabilities: { - browserName: 'firefox', - javascriptEnabled: true, - acceptSslCerts: true - } - } - } -} diff --git a/test/e2e/runner.js b/test/e2e/runner.js deleted file mode 100755 index 85d67d6..0000000 --- a/test/e2e/runner.js +++ /dev/null @@ -1,33 +0,0 @@ -// 1. start the dev server using production config -process.env.NODE_ENV = 'testing' -var server = require('../../build/dev-server.js') - -server.ready.then(() => { - // 2. run the nightwatch test suite against it - // to run in additional browsers: - // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" - // 2. add it to the --env flag below - // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` - // For more information on Nightwatch's config file, see - // http://nightwatchjs.org/guide#settings-file - var opts = process.argv.slice(2) - if (opts.indexOf('--config') === -1) { - opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) - } - if (opts.indexOf('--env') === -1) { - opts = opts.concat(['--env', 'chrome']) - } - - var spawn = require('cross-spawn') - var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) - - runner.on('exit', function (code) { - server.close() - process.exit(code) - }) - - runner.on('error', function (err) { - server.close() - throw err - }) -}) diff --git a/test/e2e/specs/test.js b/test/e2e/specs/test.js deleted file mode 100755 index a7b1bd9..0000000 --- a/test/e2e/specs/test.js +++ /dev/null @@ -1,19 +0,0 @@ -// For authoring Nightwatch tests, see -// http://nightwatchjs.org/guide#usage - -module.exports = { - 'default e2e tests': function (browser) { - // automatically uses dev Server port from /config.index.js - // default: http://localhost:8080 - // see nightwatch.conf.js - const devServer = browser.globals.devServerURL - - browser - .url(devServer) - .waitForElementVisible('#app', 5000) - .assert.elementPresent('.hello') - .assert.containsText('h1', 'Welcome to Your Vue.js App') - .assert.elementCount('img', 1) - .end() - } -} diff --git a/test/unit/index.js b/test/index.js similarity index 100% rename from test/unit/index.js rename to test/index.js diff --git a/test/unit/karma.conf.js b/test/karma.conf.js similarity index 100% rename from test/unit/karma.conf.js rename to test/karma.conf.js diff --git a/test/specs/Hello.spec.js b/test/specs/Hello.spec.js new file mode 100755 index 0000000..d660a5a --- /dev/null +++ b/test/specs/Hello.spec.js @@ -0,0 +1,11 @@ +import Vue from 'vue'; +import Hello from '@/components/Hello'; + +describe('Hello.vue', () => { + it('should render correct contents', () => { + const Constructor = Vue.extend(Hello); + const vm = new Constructor().$mount(); + expect(vm.$el.querySelector('.hello h1').textContent) + .to.equal('Welcome to Your Vue.js App'); + }); +}); diff --git a/test/unit/specs/Hello.spec.js b/test/unit/specs/Hello.spec.js deleted file mode 100755 index 80140ba..0000000 --- a/test/unit/specs/Hello.spec.js +++ /dev/null @@ -1,11 +0,0 @@ -import Vue from 'vue' -import Hello from '@/components/Hello' - -describe('Hello.vue', () => { - it('should render correct contents', () => { - const Constructor = Vue.extend(Hello) - const vm = new Constructor().$mount() - expect(vm.$el.querySelector('.hello h1').textContent) - .to.equal('Welcome to Your Vue.js App') - }) -})