Skip to content

Commit

Permalink
Firefox config done and tests added to Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mchapman committed Jun 3, 2014
1 parent 8c1e947 commit fa86240
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"browser": false,
"element": false,
"input": false,
"repeater": false,
"protractor": false,
"by": false,

/* testabilityPatch / matchers */
"inject": false,
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
language: node_jsservices: mongodbnode_js: - "0.10"before_script: - npm install -g bower - bower install
language: node_jsservices: mongodbnode_js: - "0.10"before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start"before_script: - npm install -g bower - bower install
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"scripts": {
"start": "node ./server/server.js",
"postinstall":"./node_modules/protractor/bin/webdriver-manager update",
"test": "scripts/testrun.sh"
},
"main": "./server/server.js",
Expand Down Expand Up @@ -66,6 +67,7 @@
"karma-phantomjs-launcher": "~0.1.0",
"karma": "~0.12",
"mocha": "~1.18",
"protractor": "~0.23.1",
"karma-junit-reporter": "~0.2",
"karma-ng-scenario": "~0.1.0",
"grunt-expand-include-with-subs": "~0.9.7",
Expand Down
4 changes: 3 additions & 1 deletion scripts/testrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ grunt jshint

KARMA=./node_modules/karma/bin/karma
MOCHA=./node_modules/mocha/bin/mocha
PROTRACTOR=./node_modules/protractor/bin/protractor

$KARMA start config/karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=PhantomJS
$KARMA start config/karma.midway.conf.js --no-auto-watch --single-run --reporters=dots --browsers=PhantomJS
Expand All @@ -23,7 +24,8 @@ case ${A:0:4} in
esac

$MOCHA --recursive test/api/*.js
$KARMA start config/karma-e2e.conf.js --no-auto-watch --single-run --reporters=dots --browsers=PhantomJS
#$KARMA start config/karma-e2e.conf.js --no-auto-watch --single-run --reporters=dots --browsers=PhantomJS
$PROTRACTOR test/e2e/protractor-firefox.conf.js

case $B in
0 )
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/conditionals.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ describe('Conditionals', function () {

it('should not show hidden fields', function () {
browser.get('/#!/g_conditional_fields/51c583d5b9991226db418f00/edit');
var items = element.all(by.css('.hasDatepicker')).map(function(elm) {
return(elm.isDisplayed());
var items = element.all(by.css('.hasDatepicker')).map(function (elm) {
return (elm.isDisplayed());
});
expect(items).toEqual([false]);
element(by.model('record.accepted')).click();
Expand All @@ -24,8 +24,8 @@ describe('Conditionals', function () {

it('should not show hidden fields in sub schemas', function () {
browser.get('/#!/f_nested_schema/51c583d5b5c51226db418f17/edit');
var items = element.all(by.css('.hasDatepicker')).map(function(elm) {
return(elm.isDisplayed());
var items = element.all(by.css('.hasDatepicker')).map(function (elm) {
return (elm.isDisplayed());
});
expect(items).toEqual([true, false, true, true, true, false]);
});
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/protractor-firefox.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.config = {
specs: [
'./**/*.spec.js'
],
capabilities: {
browserName: 'firefox',
version: '',
platform: 'ANY'
},
baseUrl: 'http://localhost:3001'
};
11 changes: 11 additions & 0 deletions test/e2e/protractor-phantom.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.config = {
specs: [
'./**/*.spec.js'
],
capabilities: {
browserName: 'phantomjs',
version: '',
platform: 'ANY'
},
baseUrl: 'http://localhost:3001'
};
3 changes: 2 additions & 1 deletion test/e2e/reports.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ describe('Reports', function () {
});

it('should do reports with options from the command line', function () {
browser.get('/#!/analyse/g_conditional_fields?r={"pipeline":[{"$group":{"_id":"$sex","count":{"$sum":1}}}],"title":"Breakdown By Sex","columnDefs":[{"field":"_id","displayName":"Sex"},{"field":"count","displayName":"No of Applicants"}]}');
browser.get('/#!/analyse/g_conditional_fields?r={"pipeline":[{"$group":{"_id":"$sex","count":{"$sum":1}}}],"title":"Breakdown By Sex"' +
',"columnDefs":[{"field":"_id","displayName":"Sex"},{"field":"count","displayName":"No of Applicants"}]}');
expect($('.ngHeaderText.ng-binding.colt1').getText()).toMatch(/No of Applicants/);
expect($('.ngCell.col1.colt1 > div:nth-child(2) > div > span').getText()).toMatch(/11/);
});
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/select2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ describe('Select 2', function () {
var width = 1024;
var height = 768;
var browser = protractor.getInstance();
browser.driver.manage().window().setSize(width, height);
browser.driver.manage().window().setSize(width, height);

it('should handle enums', function () {
browser.get('/#!/b_using_options/519a6075b320153869b155e0/edit');
expect($('#s2id_f_eyeColour').getText()).toMatch(/Brown/);
Expand Down

0 comments on commit fa86240

Please sign in to comment.