Skip to content

Commit d8c4670

Browse files
committed
Merge pull request #49 from skrustev/master
Fix not working tests, update readme and add Travis CI integration.
2 parents c34032f + b7db867 commit d8c4670

File tree

7 files changed

+53
-27
lines changed

7 files changed

+53
-27
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-
dist
3+
dist
4+
test_out

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
after_success: npm run test-single && npm run protractor
3+
node_js:
4+
- "5"

README.md

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
#Ignite UI directives for AngularJS (Preview)
1+
#Ignite UI directives for AngularJS
2+
3+
[![Build Status](https://travis-ci.org/IgniteUI/igniteui-angular.svg?branch=master)](https://travis-ci.org/IgniteUI/igniteui-angular)
4+
25
Use the directives found in `igniteui-angular.js` to use [Ignite UI](http://igniteui.com) controls in [AngularJS](http://angularjs.com) pages. [Work with the running samples here](http://igniteui.github.io/igniteui-angular).
36

47
#Requirements
@@ -154,23 +157,38 @@ The easiest way to run the unit tests is to use the npm script:
154157

155158
npm test
156159

157-
This will start the [Karma](http://karma-runner.github.io/0.12/index.html) test runner and execute the tests.
160+
This will start the [Karma](http://karma-runner.github.io/0.12/index.html) test runner and execute the tests. By default the browser is Chrome.
158161

159-
####End to end testing
160-
These tests are run with the [Protractor](https://github.com/angular/protractor) test runner, it simulates interaction.
161-
So first the web server should be brought up:
162+
To run the tests for a single run you can use:
162163

163-
npm start
164+
npm run test-single
164165

165-
So that Protractor can execute the tests against it. Starting the tests is done with:
166+
To run the tests on Firefox you can use:
166167

167-
npm run protractor
168+
npm run test-single-firefox
169+
170+
###End to end testing
171+
These tests are run with the [Protractor](https://github.com/angular/protractor) test runner, it simulates interaction.
172+
173+
####Setup
168174

169-
**Note**: Protractor is built upon WebDriver and this should be installed:
175+
Before proceeding you need to download and install the latest version of the stand-alone WebDriver tool:
170176

171177
npm run update-webdriver
178+
179+
After that make sure you have [Java Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) installed on your machine. It is required for the Standalone Selenium Server.
180+
181+
####Running tests
182+
183+
So first the web server should be brought up so that Protractor can execute the tests against it:
184+
185+
npm start
186+
187+
Running the tests is done with:
188+
189+
npm run protractor
172190

173-
This will download and install the latest version of the stand-alone WebDriver tool.
191+
**Note:** You will need to run the protractor on a separate bash
174192

175193
---------------------------------------
176194

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
"devDependencies": {
55
"grunt": "",
66
"grunt-contrib-jshint": "",
7-
"grunt-contrib-concat": "",
87
"grunt-contrib-uglify": "",
98
"grunt-contrib-watch": "",
10-
"grunt-contrib-requirejs": "",
119
"jshint-stylish": "",
12-
"karma": "",
1310
"protractor": "",
1411
"http-server": "",
1512
"bower": "",
1613
"shelljs": "",
14+
"karma": "",
15+
"karma-jasmine": "",
16+
"karma-chrome-launcher": "",
17+
"karma-firefox-launcher": "",
1718
"karma-junit-reporter": ""
1819
},
1920
"scripts": {
@@ -24,13 +25,14 @@
2425

2526
"pretest": "npm install",
2627
"test": "karma start test/karma.conf.js",
27-
"test-single-run": "karma start test/karma.conf.js --single-run",
28+
"test-single": "karma start test/karma.conf.js --single-run --reporters junit,dots",
29+
"test-single-firefox": "karma start test/karma.conf.js --browsers Firefox --single-run --reporters junit,dots",
2830

2931
"preupdate-webdriver": "npm install",
3032
"update-webdriver": "webdriver-manager update",
3133

3234
"preprotractor": "npm run update-webdriver",
33-
"protractor": "protractor test/protractor-conf.js",
35+
"protractor": "npm start | protractor test/protractor-conf.js",
3436

3537
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
3638
}

test/app/js/util.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
var ptor = protractor.getInstance();
2-
31
function executeScript(script) {
4-
ptor.driver.executeScript(script);
2+
browser.driver.executeScript(script);
53
}
64

75
function getResult(script) {
8-
return ptor.driver.executeScript('return ' + script);
6+
return browser.driver.executeScript('return ' + script);
97
}
108

119
function getAll(locatior) {
12-
return ptor.findElements(locatior);
10+
return browser.findElements(locatior);
1311
}
1412

1513
function isInitialized(elementId, widget) {
@@ -19,10 +17,10 @@ function isInitialized(elementId, widget) {
1917
}
2018

2119
function resetNorthwindScope() {
22-
ptor.driver.executeScript(
20+
browser.driver.executeScript(
2321
'angular.element($("#grid1")).scope().northwind = angular.copy(angular.element($("#grid1")).scope().northwind_bak.slice(0));'
2422
);
25-
ptor.driver.executeScript(
23+
browser.driver.executeScript(
2624
'angular.element($("#grid1")).scope().$apply();'
2725
);
2826
}

test/karma.conf.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ module.exports = function(config){
2424
browsers : ['Chrome'],
2525

2626
plugins : [ 'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-jasmine', 'karma-junit-reporter' ],
27-
27+
28+
reporters: ['junit'],
29+
2830
junitReporter : {
29-
outputFile: 'test_out/unit.xml',
31+
outputDir: './test_out',
32+
outputFile: 'unit.xml',
3033
suite: 'unit'
3134
}
3235

test/unit/directiveSpecs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('Ignite directives', function() {
2-
3-
beforeEach(module('igniteui-directives'));
2+
3+
beforeEach(module('my-app'));
44

55
//these can go into html files
66
var gridTpl = '<ig-grid id="grid1" data-source="northwind" height="400px" primary-key="ProductID" auto-commit="true" width="700px" auto-generate-columns="false">' +

0 commit comments

Comments
 (0)