protractor e2e test

This commit is contained in:
Pavel Reznikov 2016-03-01 19:31:09 -08:00
parent 50607a9797
commit 4862a61af3
6 changed files with 80 additions and 8 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules node_modules
bower_components bower_components
coverage coverage
*.log

View file

@ -1,11 +1,36 @@
language: node_js language: node_js
node_js:
- "5.7.0"
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install:
- npm install -g protractor
install:
- npm install -g npm@2
- npm install -g grunt-cli
- npm install -g bower
- bower install
- npm install
- webdriver-manager update --standalone
before_script: before_script:
- npm install -g grunt-cli - export CHROME_BIN=chromium-browser
- npm install -g bower - export DISPLAY=:99.0
- bower install - sh -e /etc/init.d/xvfb start
- npm install - nohup bash -c "webdriver-manager start 2>&1 &"
script: script:
- npm run build - npm run build
- npm test - npm test
- grunt e2e-test

View file

@ -7,6 +7,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs'); grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.initConfig({ grunt.initConfig({
sass: { sass: {
@ -95,7 +97,25 @@ module.exports = function(grunt) {
}, },
}, },
}, },
protractor: {
options: {
configFile: 'protractor.conf.js',
},
all: {}
},
connect: {
all: {
options: {
port: 8080,
hostname: 'localhost',
base: '.',
},
},
},
}); });
grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify', 'doctoc']); grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify', 'doctoc']);
grunt.registerTask('e2e-test', ['connect', 'protractor']);
}; };

View file

@ -30,8 +30,10 @@
"lodash": "^4.5.1" "lodash": "^4.5.1"
}, },
"devDependencies": { "devDependencies": {
"connect": "^3.4.1",
"coveralls": "^2.11.6", "coveralls": "^2.11.6",
"grunt": "^0.4.5", "grunt": "^0.4.5",
"grunt-contrib-connect": "^0.11.2",
"grunt-contrib-copy": "^0.8.2", "grunt-contrib-copy": "^0.8.2",
"grunt-contrib-cssmin": "^0.14.0", "grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-jshint": "^1.0.0", "grunt-contrib-jshint": "^1.0.0",
@ -39,6 +41,7 @@
"grunt-contrib-watch": "^0.6.1", "grunt-contrib-watch": "^0.6.1",
"grunt-doctoc": "^0.1.1", "grunt-doctoc": "^0.1.1",
"grunt-jscs": "^2.7.0", "grunt-jscs": "^2.7.0",
"grunt-protractor-runner": "^3.0.0",
"grunt-sass": "^1.1.0", "grunt-sass": "^1.1.0",
"jasmine-core": "^2.4.1", "jasmine-core": "^2.4.1",
"karma": "^0.13.21", "karma": "^0.13.21",
@ -46,6 +49,7 @@
"karma-coveralls": "^1.1.2", "karma-coveralls": "^1.1.2",
"karma-jasmine": "^0.3.7", "karma-jasmine": "^0.3.7",
"karma-phantomjs-launcher": "^1.0.0", "karma-phantomjs-launcher": "^1.0.0",
"phantomjs": "^2.1.3" "phantomjs-prebuilt": "^2.1.4",
"serve-static": "^1.10.2"
} }
} }

9
protractor.conf.js Normal file
View file

@ -0,0 +1,9 @@
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec/e2e/*-spec.js'],
capabilities: {
browserName: 'firefox',
version: '',
platform: 'ANY'
},
};

View file

@ -0,0 +1,13 @@
describe('gridstack.js two grids demo', function() {
beforeAll(function() {
browser.ignoreSynchronization = true;
});
beforeEach(function() {
browser.get('http://localhost:8080/demo/two.html');
});
it('should have proper title', function() {
expect(browser.getTitle()).toEqual('Two grids demo');
});
});