Skip to content

Commit

Permalink
Create the Tests project
Browse files Browse the repository at this point in the history
  • Loading branch information
carloshpds committed Dec 25, 2015
1 parent 0c5b122 commit f5aabc6
Show file tree
Hide file tree
Showing 59 changed files with 3,682 additions and 26 deletions.
31 changes: 8 additions & 23 deletions demo/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,12 @@ options.modulesData = {
// newModule: {
// uses: 'newModule.js'
// },
gulp : {
gulp: {
uses: '../demo/node_modules/gulp'
},
karma: {
uses: '../demo/node_modules/karma'
},
server : {
routes : {
'/bower_components': 'bower_components',
'/environment' : 'builds/dev/serve/app/project/scripts/environment'
},
isEnabled: true
},

sonar: {
host : {
Expand All @@ -48,6 +41,13 @@ options.modulesData = {
projectKey : 'io.timeoutzero:basebuild-angular-demo',
projectName : 'basebuild angular demo',
projectVersion : '1.0.2',
},

unitTests: {
excludeFiles: [
'builds/dev/serve/app/**/init.dev.env.js',
'builds/dev/serve/app/**/init.prod.env.js'
]
}
}

Expand All @@ -56,21 +56,6 @@ if(gutil.env.prod){
options.modulesData.karma.uses = 'karma'
}

if(!gutil.env.demo){
options.modulesData.unitTests = {
addDeps: [
'../dist/utils.js',
'../specs/*.js',
'../node_modules/chalk/index.js'
// 'builds/dev/serve/app/**/variables.env.js'
],

excludeFiles: [
'builds/dev/serve/app/**/init.dev.env.js',
'builds/dev/serve/app/**/init.prod.env.js'
]
};
}

/*
==========================
Expand Down
5 changes: 2 additions & 3 deletions demo/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ module.exports = function(config) {
],

preprocessors: {
'src/**/*.html': ['ng-html2js'],
'builds/dev/serve/{app,components}/**/!(*spec|*mock).js' : ['coverage']
'src/**/*.html' : ['ng-html2js']
},

// generates the coverage
Expand All @@ -102,11 +101,11 @@ module.exports = function(config) {
},

exclude: [
'app/i18n/pt-BR.json'
]

};

console.log('config files', config.files);


// This block is needed to execute Chrome on Travis
Expand Down
3 changes: 3 additions & 0 deletions tests/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
13 changes: 13 additions & 0 deletions tests/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
10 changes: 10 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
bower_components/
.sass-cache/
.tmp/
dist/
dev/
tests/
builds/
coverage/
docs/
35 changes: 35 additions & 0 deletions tests/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"globalstrict": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": true,
"validthis": true,
"globals": {
"angular": false,
// Angular Mocks
"inject": false,
"module": false,
// JASMINE
"describe": false,
"it": false,
"before": false,
"beforeEach": false,
"after": false,
"afterEach": false,
"expect": false
}
}
32 changes: 32 additions & 0 deletions tests/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "BaseBuildTests",
"private": "true",
"version": "0.0.0",
"dependencies": {
"underscore": "~1.8.3",
"angular-animate": "~1.3.4",
"angular-cookies": "~1.3.4",
"angular-touch": "~1.3.4",
"angular-sanitize": "~1.3.4",
"jquery": "~1.11.1",
"angular-resource": "~1.3.4",
"angular-ui-router": "~0.2.15",
"angular": "~1.3.4",
"ngtoast": "~1.5.0",
"angular-loading-bar": "~0.7.1",
"angular-ui-select": "~0.12.0",
"angular-sweetalert": "~1.1.0",
"bootstrap-sass-official": "~3.3.5",
"angular-bootstrap": "~0.13.0",
"react": "~0.13.3",
"classnames": "~2.1.3"
},
"devDependencies": {
"angular-mocks": "~1.3.4",
"basebuild-angular": "*"
},
"resolutions": {
"jquery": "~1.11.1",
"angular": "1.3.18"
}
}
107 changes: 107 additions & 0 deletions tests/coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"arrow_spacing": {
"level": "ignore"
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
"colon_assignment_spacing": {
"level": "ignore",
"spacing": {
"left": 0,
"right": 0
}
},
"cyclomatic_complexity": {
"value": 10,
"level": "ignore"
},
"duplicate_key": {
"level": "error"
},
"empty_constructor_needs_parens": {
"level": "ignore"
},
"indentation": {
"value": 2,
"level": "error"
},
"line_endings": {
"level": "ignore",
"value": "unix"
},
"max_line_length": {
"value": 200,
"level": "error",
"limitComments": true
},
"missing_fat_arrows": {
"level": "ignore"
},
"newlines_after_classes": {
"value": 3,
"level": "ignore"
},
"no_backticks": {
"level": "ignore"
},
"no_debugger": {
"level": "warn"
},
"no_empty_functions": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "ignore"
},
"no_implicit_braces": {
"level": "ignore",
"strict": true
},
"no_implicit_parens": {
"strict": true,
"level": "ignore"
},
"no_interpolation_in_single_quotes": {
"level": "ignore"
},
"no_plusplus": {
"level": "ignore"
},
"no_stand_alone_at": {
"level": "ignore"
},
"no_tabs": {
"level": "error"
},
"no_throwing_strings": {
"level": "error"
},
"no_trailing_semicolons": {
"level": "error"
},
"no_trailing_whitespace": {
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"level": "warn"
},
"non_empty_constructor_needs_parens": {
"level": "ignore"
},
"prefer_english_operator": {
"level": "ignore",
"doubleNotLevel": "ignore"
},
"space_operators": {
"level": "ignore"
}
}
10 changes: 10 additions & 0 deletions tests/e2e/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../.jshintrc",
"globals": {
"browser": false,
"element": false,
"by": false,
"$": false,
"$$": false
}
}
15 changes: 15 additions & 0 deletions tests/e2e/main.po.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
*/

'use strict';

var MainPage = function() {
this.jumbEl = element(by.css('.jumbotron'));
this.h1El = this.jumbEl.element(by.css('h1'));
this.imgEl = this.jumbEl.element(by.css('img'));
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));
};

module.exports = new MainPage();
21 changes: 21 additions & 0 deletions tests/e2e/main.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

describe('The main view', function () {
var page;

beforeEach(function () {
browser.get('http://localhost:3000/index.html');
page = require('./main.po');
});

it('should include jumbotron with correct data', function() {
expect(page.h1El.getText()).toBe('\'Allo, \'Allo!');
expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
});

it('list more than 5 awesome things', function () {
expect(page.thumbnailEls.count()).toBeGreaterThan(5);
});

});
Loading

0 comments on commit f5aabc6

Please sign in to comment.