Skip to content

Commit 11ece9d

Browse files
miherlosevegoist
authored andcommitted
Add testcafe support (close egoist#56), fix eslint errors (egoist#84)
* contribute testcafe * fix eslint errors
1 parent a9b42d0 commit 11ece9d

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

template/client/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from 'vue'
2-
import {sync} from 'vuex-router-sync'
2+
import { sync } from 'vuex-router-sync'
33
import App from './components/App'
44
import router from './router'
55
import store from './store'
@@ -11,4 +11,4 @@ const app = new Vue({
1111
...App
1212
})
1313

14-
export {app, router, store}
14+
export { app, router, store }

template/client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import './promise-polyfill'
2-
import {app} from './app'
2+
import { app } from './app'
33

44
// enable progressive web app support (with offline-plugin)
55
if (process.env.NODE_ENV === 'production') {

template/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "{{ description }}",
55
"main": "client/index.js",
66
"scripts": {
7-
"test": "echo lol",
7+
"test": "testcafe all tests/index.js --app \"npm run dev\" --app-init-delay 10000",
88
"build": "webpack --config build/webpack.prod.js",
99
"dev": "node build/server.js"{{#electron}},
1010
"app": "cross-env NODE_ENV=development electron app/"{{/electron}}{{#eslint}},
@@ -43,6 +43,7 @@
4343
"eslint": "^3.6.0",
4444
"eslint-config-vue": "latest",
4545
"eslint-plugin-vue": "latest",
46+
"eslint-plugin-testcafe": "^0.2.0",
4647
{{/eslint}}
4748
"express": "^4.14.0",
4849
"extract-text-webpack-plugin": "^2.0.0-beta.3",
@@ -54,6 +55,7 @@
5455
"postcss-loader": "^0.9.1",
5556
"postcss-nested": "^1.0.0",
5657
"style-loader": "^0.13.1",
58+
"testcafe": "^0.12.1",
5759
"vue-loader": "^10.0.2",
5860
"vue-template-compiler": "^2.1.3",
5961
"webpack": "2.2.0-rc.3",

template/tests/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import IndexPage from './page-model';
2+
3+
fixture `Index page`
4+
.page('http://localhost:4000');
5+
6+
const page = new IndexPage();
7+
8+
test('first test', async t => {
9+
await t.expect(page.counter.innerText).contains('0')
10+
.click(page.increment)
11+
.expect(page.counter.innerText).contains('1')
12+
.click(page.desrement)
13+
.expect(page.counter.innerText).contains('0');
14+
});

template/tests/page-model.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Selector } from 'testcafe';
2+
3+
export default class IndexPage {
4+
constructor () {
5+
const counterWrapper = Selector('.counter-wrapper');
6+
7+
this.counter = counterWrapper.child('.counter');
8+
this.increment = counterWrapper.child('button').withText('Increment');
9+
this.desrement = counterWrapper.child('button').withText('Decrement');
10+
}
11+
}

0 commit comments

Comments
 (0)