Starting e2e testing

This commit is contained in:
Dušan Juretić 2013-12-25 16:17:05 -03:00
parent 0f3202f964
commit 462bc416de
5 changed files with 54 additions and 56 deletions

View file

@ -1,8 +1,14 @@
language: node_js
node_js:
- '0.10'
services:
- mongodb
before_script:
- 'npm install -g bower grunt-cli'
- 'bower install'
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- cp config.json.example config.json
- ./node_modules/protractor/bin/webdriver-manager update
- ./node_modules/protractor/bin/webdriver-manager start &
- grunt run:dev > /dev/null &

View file

@ -1,54 +0,0 @@
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['ng-scenario'],
// list of files / patterns to load in the browser
files: [
'test/e2e/**/*.js'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
// Uncomment the following lines if you are using grunt's server to run the tests
// proxies: {
// '/': 'http://localhost:9000/'
// },
// URL root prevent conflicts with the site root
// urlRoot: '_karma_'
});
};

View file

@ -58,12 +58,12 @@
"npm": "1.2.x"
},
"scripts": {
"test": "grunt karma:continuous",
"test": "grunt karma:continuous && ./node_modules/protractor/bin/protractor protractor.conf.js",
"start": "grunt run:dev",
"postinstall": "./node_modules/bower/bin/bower install -f"
},
"devDependencies": {
"karma-ng-scenario": "~0.1.0",
"protractor": "~0.14.0",
"grunt-karma": "~0.6.2",
"karma-script-launcher": "~0.1.0",
"karma-chrome-launcher": "~0.1.0",

24
protractor.conf.js Normal file
View file

@ -0,0 +1,24 @@
// An example configuration file.
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'firefox'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['test/e2e/e2e.js'],
// A base URL for your application under test. Calls to protractor.get()
// with relative paths will be prepended with this.
baseUrl: 'http://localhost:3000',
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};

22
test/e2e/e2e.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
describe('index page', function() {
beforeEach(function(){
browser.ignoreSynchronization = true;
browser.get('http://localhost:3000/');
});
it('shows the front page', function(){
// browser.sleep(3000);
var button = element(by.className('btn'));
expect(button.getText()).toEqual('Play');
});
it('shows the login form', function(){
var button = element(by.className('btn'));
button.click();
});
});