mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(): add instructions to readme, simplify usage with grunt
This commit is contained in:
39
Gruntfile.js
39
Gruntfile.js
@@ -124,13 +124,17 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
exec: {
|
||||
'e2e': {
|
||||
command: 'protractor config/protractor.conf.js'
|
||||
},
|
||||
'e2e-sauce': {
|
||||
command: 'protractor config/protractor-sauce.conf.js'
|
||||
protractor: {
|
||||
local: {
|
||||
options: {
|
||||
configFile: 'config/protractor.conf.js'
|
||||
}
|
||||
},
|
||||
sauce: {
|
||||
options: {
|
||||
configFile: 'config/protractor-sauce.conf.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
@@ -200,6 +204,10 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
spawn: false
|
||||
}
|
||||
},
|
||||
e2e: {
|
||||
files: ['test/e2e/**/*.{html,js}'],
|
||||
tasks: ['protractor:local']
|
||||
}
|
||||
},
|
||||
|
||||
@@ -213,6 +221,11 @@ module.exports = function(grunt) {
|
||||
'build'
|
||||
]);
|
||||
|
||||
grunt.registerTask('e2e-watch', [
|
||||
'connect',
|
||||
'watch'
|
||||
]);
|
||||
|
||||
//NOTE(ajoslin): the order of these tasks is very important.
|
||||
grunt.registerTask('build', [
|
||||
'sass',
|
||||
@@ -231,8 +244,8 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('cloudtest', [
|
||||
'sauce-connect',
|
||||
'karma:sauce',
|
||||
'connect',
|
||||
'exec:e2e-sauce',
|
||||
'connect',
|
||||
'protractor:sauce',
|
||||
'sauce-disconnect'
|
||||
]);
|
||||
|
||||
@@ -255,6 +268,16 @@ module.exports = function(grunt) {
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('protractor', 'Run protractor', function() {
|
||||
var done = this.async();
|
||||
var options = this.options();
|
||||
cp.spawn('protractor', [options.configFile], { stdio: 'inherit' })
|
||||
.on('exit', function(code) {
|
||||
if (code) return grunt.fail.warn('Protractor test(s) failed. Exit code: ' + code);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('version', 'Generate version JSON', function() {
|
||||
var pkg = grunt.config('pkg');
|
||||
this.files.forEach(function(file) {
|
||||
|
||||
@@ -86,7 +86,9 @@ For most cases, you'll need AngularJS as well. This is bundled in `js/angular/`
|
||||
* `grunt watch` to watch and rebuild on change
|
||||
* `grunt karma:single` to test one-time
|
||||
* `grunt karma:watch` to test and re-run on source change
|
||||
* Additionally, a commit message validator is installed for this repository when running `grunt`. Read about it [here](https://github.com/ajoslin/conventional-changelog/blob/master/CONVENTIONS.md).
|
||||
* `grunt protractor:local` to test e2e tests locally
|
||||
* `grunt e2e-watch` to run end to end tests on change of files in `test/e2e/**/*`
|
||||
* `grunt cloudtest` to run unit & e2e tests in the cloud
|
||||
|
||||
### Commit Conventions
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"grunt-remove-logging": "~0.2.0",
|
||||
"grunt-conventional-changelog": "~1.1.0",
|
||||
"grunt-contrib-connect": "^0.6.0",
|
||||
"grunt-exec": "^0.4.5",
|
||||
"sauce-connect-launcher": "^0.2.2"
|
||||
},
|
||||
"licenses": [
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
<title>navViews and ion-tabs w/ nested navViews</title>
|
||||
|
||||
<link rel="stylesheet" href="../../dist/css/ionic.css">
|
||||
<script src="../../dist/js/angular/angular.js"></script>
|
||||
<script src="../../dist/js/angular/angular-animate.js"></script>
|
||||
<script src="../../dist/js/angular/angular-sanitize.js"></script>
|
||||
<script src="../../dist/js/angular-ui/angular-ui-router.js"></script>
|
||||
<script src="../../dist/js/ionic.js"></script>
|
||||
<script src="../../dist/js/ionic-angular.js"></script>
|
||||
<link rel="stylesheet" href="../../../dist/css/ionic.css">
|
||||
<script src="../../../dist/js/angular/angular.js"></script>
|
||||
<script src="../../../dist/js/angular/angular-animate.js"></script>
|
||||
<script src="../../../dist/js/angular/angular-sanitize.js"></script>
|
||||
<script src="../../../dist/js/angular-ui/angular-ui-router.js"></script>
|
||||
<script src="../../../dist/js/ionic.js"></script>
|
||||
<script src="../../../dist/js/ionic-angular.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
describe('tabs test page', function() {
|
||||
var P;
|
||||
beforeEach(function() {
|
||||
browser.get('http://localhost:8080/test/e2e/tabs-test.html');
|
||||
browser.get('http://localhost:8080/test/e2e/viewState/test.html');
|
||||
P = protractor.getInstance();
|
||||
});
|
||||
|
||||
@@ -28,8 +28,8 @@ describe('tabs test page', function() {
|
||||
|
||||
expect(navTitle().getText()).toBe('Auto List');
|
||||
expect(navButtons('back').getAttribute('class')).toContain('hide');
|
||||
// expect(P.isElementPresent(navButtons('left'))).toBe(false);
|
||||
// expect(P.isElementPresent(navButtons('right'))).toBe(false);
|
||||
expect(navButtons('left').isPresent()).toBe(false);
|
||||
expect(navButtons('right').isPresent()).toBe(false);
|
||||
|
||||
element(by.css('[href="#/tabs/autos/3"]')).click();
|
||||
|
||||
Reference in New Issue
Block a user