Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de83c62

Browse files
committed
Merge pull request gridstack#376 from troolee/tests/end-to-end
e2e tests
2 parents 3d19aed + 4862a61 commit de83c62

File tree

6 files changed

+80
-8
lines changed

6 files changed

+80
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
bower_components
3-
coverage
3+
coverage
4+
*.log

.travis.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
language: node_js
22

3+
node_js:
4+
- "5.7.0"
5+
6+
env:
7+
- CXX=g++-4.8
8+
9+
addons:
10+
apt:
11+
sources:
12+
- ubuntu-toolchain-r-test
13+
packages:
14+
- g++-4.8
15+
16+
before_install:
17+
- npm install -g protractor
18+
19+
install:
20+
- npm install -g npm@2
21+
- npm install -g grunt-cli
22+
- npm install -g bower
23+
- bower install
24+
- npm install
25+
- webdriver-manager update --standalone
26+
327
before_script:
4-
- npm install -g grunt-cli
5-
- npm install -g bower
6-
- bower install
7-
- npm install
28+
- export CHROME_BIN=chromium-browser
29+
- export DISPLAY=:99.0
30+
- sh -e /etc/init.d/xvfb start
31+
- nohup bash -c "webdriver-manager start 2>&1 &"
832

933
script:
10-
- npm run build
11-
- npm test
34+
- npm run build
35+
- npm test
36+
- grunt e2e-test

Gruntfile.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module.exports = function(grunt) {
77
grunt.loadNpmTasks('grunt-contrib-jshint');
88
grunt.loadNpmTasks('grunt-jscs');
99
grunt.loadNpmTasks('grunt-contrib-watch');
10+
grunt.loadNpmTasks('grunt-protractor-runner');
11+
grunt.loadNpmTasks('grunt-contrib-connect');
1012

1113
grunt.initConfig({
1214
sass: {
@@ -95,7 +97,25 @@ module.exports = function(grunt) {
9597
},
9698
},
9799
},
100+
101+
protractor: {
102+
options: {
103+
configFile: 'protractor.conf.js',
104+
},
105+
all: {}
106+
},
107+
108+
connect: {
109+
all: {
110+
options: {
111+
port: 8080,
112+
hostname: 'localhost',
113+
base: '.',
114+
},
115+
},
116+
},
98117
});
99118

100119
grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify', 'doctoc']);
120+
grunt.registerTask('e2e-test', ['connect', 'protractor']);
101121
};

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,26 @@
3030
"lodash": "^4.5.1"
3131
},
3232
"devDependencies": {
33+
"connect": "^3.4.1",
3334
"coveralls": "^2.11.6",
3435
"grunt": "^0.4.5",
36+
"grunt-contrib-connect": "^0.11.2",
3537
"grunt-contrib-copy": "^0.8.2",
3638
"grunt-contrib-cssmin": "^0.14.0",
3739
"grunt-contrib-jshint": "^1.0.0",
3840
"grunt-contrib-uglify": "^0.11.1",
3941
"grunt-contrib-watch": "^0.6.1",
4042
"grunt-doctoc": "^0.1.1",
4143
"grunt-jscs": "^2.7.0",
44+
"grunt-protractor-runner": "^3.0.0",
4245
"grunt-sass": "^1.1.0",
4346
"jasmine-core": "^2.4.1",
4447
"karma": "^0.13.21",
4548
"karma-coverage": "^0.5.3",
4649
"karma-coveralls": "^1.1.2",
4750
"karma-jasmine": "^0.3.7",
4851
"karma-phantomjs-launcher": "^1.0.0",
49-
"phantomjs": "^2.1.3"
52+
"phantomjs-prebuilt": "^2.1.4",
53+
"serve-static": "^1.10.2"
5054
}
5155
}

protractor.conf.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
exports.config = {
2+
seleniumAddress: 'http://localhost:4444/wd/hub',
3+
specs: ['spec/e2e/*-spec.js'],
4+
capabilities: {
5+
browserName: 'firefox',
6+
version: '',
7+
platform: 'ANY'
8+
},
9+
};

spec/e2e/gridstack-spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
describe('gridstack.js two grids demo', function() {
2+
beforeAll(function() {
3+
browser.ignoreSynchronization = true;
4+
});
5+
6+
beforeEach(function() {
7+
browser.get('http://localhost:8080/demo/two.html');
8+
});
9+
10+
it('should have proper title', function() {
11+
expect(browser.getTitle()).toEqual('Two grids demo');
12+
});
13+
});

0 commit comments

Comments
 (0)