gulp-protractor-qa
Advanced tools
Comparing version 0.1.17 to 0.1.18
84
index.js
@@ -25,3 +25,3 @@ var gutil = require('gulp-util'); | ||
regexList = _this.ptorFindElements.regex; | ||
// lopp regexlist | ||
@@ -39,3 +39,3 @@ for( var i = 0; i<regexList.length; i++ ){ | ||
}; | ||
_this.ptorFindElements.foundList.push( res ); | ||
@@ -82,8 +82,8 @@ | ||
var obj = _this[ collection ][i]; | ||
if( typeof obj.path != 'undefined' ){ | ||
if( filepath.indexOf( obj.path.replace("./", "/") ) >= 0 ){ | ||
obj.contents = newContent; | ||
break; | ||
} | ||
} | ||
if( typeof obj.path != 'undefined' ){ | ||
if( filepath.indexOf( obj.path.replace("./", "/") ) >= 0 ){ | ||
obj.contents = newContent; | ||
break; | ||
} | ||
} | ||
} | ||
@@ -109,3 +109,3 @@ | ||
} | ||
return exists; | ||
@@ -119,3 +119,3 @@ }, | ||
for( var i = 0; i<foundList.length; i++ ){ | ||
for( var i = 0; i < foundList.length; i++ ){ | ||
@@ -127,3 +127,3 @@ var found = false; | ||
var obj = _this.viewFiles[c]; | ||
$ = cheerio.load( obj.contents ); | ||
@@ -133,11 +133,13 @@ var selector = ''; | ||
if( foundItem.type === "attr" ){ | ||
selector = [ '[', foundItem.attrName, '="', foundItem.val, '"]' ].join(""); | ||
selector = [ | ||
'[', foundItem.attrName, '="', foundItem.val, '"], ', | ||
'[data-', foundItem.attrName, '="', foundItem.val, '"]' | ||
].join(""); | ||
if( foundItem.attrName === "ng-bind" ){ | ||
// search for {{bindings}} | ||
if( _this.bindExists( foundItem.val, obj.contents ) ){ | ||
found = true; | ||
} | ||
} | ||
if( foundItem.attrName === "ng-bind" ){ | ||
// search for {{bindings}} | ||
if( _this.bindExists( foundItem.val, obj.contents ) ){ | ||
found = true; | ||
} | ||
} | ||
} else if( foundItem.type === "cssAttr" ){ | ||
@@ -147,3 +149,3 @@ selector = [ '[', foundItem.val, ']' ].join(""); | ||
if( $( selector ).length ){ | ||
if ($(selector).length) { | ||
found = true; | ||
@@ -153,5 +155,5 @@ } | ||
if( !found ){ | ||
if( !found ){ | ||
allElementsFound = false; | ||
gutil.log('[' + chalk.cyan(PLUGIN_NAME) + '] ' + chalk.red(foundItem.at) + ' at ' + chalk.bold(foundItem.fileName) + ' not found in view files!'); | ||
gutil.log('[' + chalk.cyan(PLUGIN_NAME) + '] ' + chalk.red(foundItem.at) + ' at ' + chalk.bold(foundItem.fileName) + ' not found within view files!'); | ||
} | ||
@@ -162,5 +164,5 @@ | ||
if( allElementsFound ){ | ||
gutil.log( | ||
'[' + chalk.cyan(PLUGIN_NAME) + '] ' + | ||
chalk.green("all test element found!") | ||
gutil.log( | ||
'[' + chalk.cyan(PLUGIN_NAME) + '] ' + | ||
chalk.green("all test elements were successfully found!") | ||
); | ||
@@ -177,5 +179,5 @@ } | ||
var gaze = new Gaze(src); | ||
gaze.on('all', function(event, filepath) { | ||
gaze.on('all', function(event, filepath) { | ||
fs.readFile(filepath, 'utf8', function(err, data){ | ||
if (err) { throw err }; | ||
if (err) { throw err; } | ||
_this.updateFileContents(collection, filepath, data); | ||
@@ -188,6 +190,6 @@ }); | ||
var async = function async(arg, callback) { | ||
fs.readFile(arg, 'utf8', function (err, data) { | ||
if (err) { throw err }; | ||
callback(arg, data); | ||
}); | ||
fs.readFile(arg, 'utf8', function (err, data) { | ||
if (err) { throw err; } | ||
callback(arg, data); | ||
}); | ||
}; | ||
@@ -198,4 +200,4 @@ | ||
async(item, function(filePath, data){ | ||
_this[ collection ].push( | ||
_this[ collection ].push( | ||
{ | ||
@@ -207,5 +209,5 @@ path : filePath, | ||
if( _this[ collection ].length == files.length ) { | ||
_cb(); | ||
} | ||
if( _this[ collection ].length == files.length ) { | ||
_cb(); | ||
} | ||
}); | ||
@@ -218,3 +220,3 @@ }); | ||
bindStoreFileContents : function( _callback ){ | ||
var _this = this; | ||
@@ -236,3 +238,3 @@ | ||
globals.options = options || {}; | ||
if (typeof globals.options.testSrc == 'undefined') { | ||
@@ -242,3 +244,3 @@ throw new gutil.PluginError(PLUGIN_NAME, '`testSrc` required'); | ||
if (typeof globals.options.viewSrc == 'undefined') { | ||
throw new gutil.PluginError(PLUGIN_NAME, '`viewSrc` viewSrc!'); | ||
throw new gutil.PluginError(PLUGIN_NAME, '`viewSrc` required!'); | ||
} | ||
@@ -248,6 +250,6 @@ | ||
globals.searchProtractorDotByContents(globals.testFiles, function beforeViewMatches(){ | ||
gutil.log( '[' + chalk.cyan(PLUGIN_NAME) + '] ' + chalk.gray( "// " + globals.ptorFindElements.foundList.length + " out of " + globals.totalNumOfElements + " element selectors are been watched" ) ); | ||
gutil.log( '[' + chalk.cyan(PLUGIN_NAME) + '] ' + chalk.gray( "// " + globals.ptorFindElements.foundList.length + " out of " + globals.totalNumOfElements + " element selectors are being watched" ) ); | ||
}); | ||
}); | ||
}; | ||
@@ -254,0 +256,0 @@ |
@@ -21,2 +21,7 @@ var utilConfig = { | ||
match : /[b|B]y\.binding\(\s*['|"](.*?)['|"]\s*\)/gi | ||
}, | ||
{ | ||
type: "attr", | ||
attrName : "ng-repeat", | ||
match: /[b|B]y\.repeater\(\s*['|"](.*? in .*?)['|"]\s*\)/gi | ||
} | ||
@@ -23,0 +28,0 @@ ], |
{ | ||
"name": "gulp-protractor-qa", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"description": "Gulp Protractor QA warns you on the fly whether all element() selectors could be found or not within your AngularJS view files.", | ||
"license": "MIT", | ||
"repository": "ramonvictor/gulp-protractor-qa", | ||
"author": { | ||
"name": "Ramon Victor", | ||
"email": "ramon.wd@gmail.com", | ||
"url": "https://github.com/ramonvictor" | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/ramonvictor/gulp-protractor-qa" | ||
}, | ||
"author": "Ramon Victor <ramon.wd@gmail.com> (https://github.com/ramonvictor)", | ||
"engines": { | ||
@@ -26,7 +25,14 @@ "node": ">=0.10.0" | ||
"gulp-util": "2.2.14", | ||
"gaze" : "0.5.1", | ||
"chalk" : "0.4.0", | ||
"cheerio" : "0.15.0", | ||
"buster-glob" : "0.3.3" | ||
"gaze": "0.5.1", | ||
"chalk": "0.4.0", | ||
"cheerio": "0.15.0", | ||
"buster-glob": "0.3.3" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ramonvictor/gulp-protractor-qa/issues" | ||
}, | ||
"homepage": "https://github.com/ramonvictor/gulp-protractor-qa", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# [gulp](http://gulpjs.com)-protractor-qa | ||
# [gulp](http://gulpjs.com)-protractor-qa [![NPM version](https://badge.fury.io/js/gulp-protractor-qa.svg)](http://badge.fury.io/js/gulp-protractor-qa) [![Build Status](https://travis-ci.org/ramonvictor/gulp-protractor-qa.svg?branch=master)](https://travis-ci.org/ramonvictor/gulp-protractor-qa) | ||
@@ -6,4 +6,6 @@ | ||
Keeping end-to-end test up-to-date can be really painful. Gulp Protractor QA warns you on the fly whether all element() selectors could be found or not within your AngularJS view files. | ||
Keeping end-to-end tests up-to-date can be really painful. Gulp Protractor QA warns you on the fly whether all element() selectors could be found or not within your application view files. | ||
###### *Because code changes should not break your tests!* | ||
## How it works? | ||
@@ -10,0 +12,0 @@ |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
12421
7
215
102