8000 replace e2e tests with nightwatch · vuejs/v2.vuejs.org@09178ab · GitHub
[go: up one dir, main page]

Skip to content

Commit 09178ab

Browse files
committed
replace e2e tests with nightwatch
1 parent 069109b commit 09178ab

File tree

15 files changed

+369
-172
lines changed

15 files changed

+369
-172
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ examples/**/build.js
88
types/typings
99
types/test/*.js
1010
explorations
11+
*.log
12+
test/e2e/reports
13+
test/e2e/screenshots

examples/counter/Counter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div id="app">
33
Clicked: {{ $store.state.count }} times, count is {{ evenOrOdd }}.
44
<button @click="increment">+</button>
55
<button @click="decrement">-</button>

examples/shopping-cart/components/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
< E7F5 /div>
11
<template>
2-
<div class="app">
2+
<div id="app">
33
<h1>Shopping Cart Example</h1>
44
<hr>
55
<h2>Products</h2>

examples/todomvc/components/App.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
<li v-for="(val, key) in filters">
3232
<a :href="'#/' + key"
3333
:class="{ selected: visibility === key }"
34-
@click="visibility = key">
35-
{{ key | capitalize }}
36-
</a>
34+
@click="visibility = key">{{ key | capitalize }}</a>
3735
</li>
3836
</ul>
3937
<button class="clear-completed"

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dev": "cd examples && webpack-dev-server --inline --hot --no-info",
1313
"test": "eslint src && npm run test:unit && npm run test:e2e",
1414
"test:unit": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
15-
"test:e2e": "npm run build-examples && casperjs test --concise ./test/e2e",
15+
"test:e2e": "node test/e2e/runner.js",
1616
"build": "node build/build.js",
1717
"release": "bash build/release.sh",
1818
"docs": "cd docs && gitbook serve",
@@ -37,7 +37,6 @@
3737
"babel-preset-es2015-rollup": "^1.1.1",
3838
"babel-preset-stage-2": "^6.1.18",
3939
"babel-runtime": "^6.0.0",
40-
"casperjs": &quo 23D3 t;^1.1.0-beta5",
4140
"css-loader": "^0.23.1",
4241
"eslint": "^2.2.0",
4342
"eslint-config-vue": "^1.0.0",

test/e2e/cart.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

test/e2e/chat.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

test/e2e/counter.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/e2e/nightwatch.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// http://nightwatchjs.org/guide#settings-file
2+
module.exports = {
3+
'src_folders': ['test/e2e/specs'],
4+
'output_folder': 'test/e2e/reports',
5+
'custom_commands_path': ['node_modules/nightwatch-helpers/commands'],
6+
'custom_assertions_path': ['node_modules/nightwatch-helpers/assertions'],
7+
8+
'selenium': {
9+
'start_process': true,
10+
'server_path': 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar',
11+
'host': '127.0.0.1',
12+
'port': 4444,
13+
'cli_args': {
14+
'webdriver.chrome.driver': 'node_modules/chromedriver/lib/chromedriver/chromedriver'
15+
}
16+
},
17+
18+
'test_settings': {
19+
'default': {
20+
'selenium_port': 4444,
21+
'selenium_host': 'localhost',
22+
'silent': true,
23+
'screenshots': {
24+
'enabled': true,
25+
'on_failure': true,
26+
'on_error': false,
27+
'path': 'test/e2e/screenshots'
28+
}
29+
},
30+
31+
'chrome': {
32+
'desiredCapabilities': {
33+
'browserName': 'chrome',
34+
'javascriptEnabled': true,
35+
'acceptSslCerts': true
36+
}
37+
},
38+
39+
'phantomjs': {
40+
'desiredCapabilities': {
41+
'browserName': 'phantomjs',
42+
'javascriptEnabled': true,
43+
'acceptSslCerts': true
44+
}
45+
}
46+
}
47+
}

test/e2e/runner.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var path = require('path')
2+
var spawn = require('cross-spawn')
3+
var args = process.argv.slice(2)
4+
5+
var server = args.indexOf('--dev') > -1
6+
? null
7+
: require('../../examples/server')
8+
9+
if (args.indexOf('--config') === -1) {
10+
args = args.concat(['--config', 'test/e2e/nightwatch.config.js'])
11+
}
12+
if (args.indexOf('--env') === -1) {
13+
args = args.concat(['--env', 'phantomjs'])
14+
}
15+
var i = args.indexOf('--test')
16+
if (i > -1) {
17+
args[i + 1] = 'test/e2e/specs/' + args[i + 1]
18+
}
19+
if (args.indexOf('phantomjs') > -1) {
20+
process.env.PHANTOMJS = true
21+
}
22+
23+
var runner = spawn('./node_modules/.bin/nightwatch', args, {
24+
stdio: 'inherit'
25+
})
26+
27+
runner.on('exit', function (code) {
28+
server && server.close()
29+
process.exit(code)
30+
})
31+
32+
runner.on('error', function (err) {
33+
server && server.close()
34+
throw err
35+
})

0 commit comments

Comments
 (0)
0