Skip to content

Commit

Permalink
configured tolerance, need to pull this out to a command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyanwang committed Apr 3, 2014
1 parent 93cd108 commit dcb5c57
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ocular-drift.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ program.on('--help', function(){
console.log('');
});

// 5d067fa40112f23b0900da77768fda676357149e
// 4a104fa12af5f216165ae7e772294a8ddccd4bbf
if(!program.build || !program.session || !process.env.BROWSERSTACK_TOKEN || !process.env.BROWSERSTACK_USER){
console.error("\nERROR: You must specify browser stack build id, and session id");
program.help();
Expand All @@ -33,7 +31,8 @@ var CONFIG = {
BROWSERSTACK_TOKEN: process.env.BROWSERSTACK_TOKEN,
BROWSERSTACK_USER: process.env.BROWSERSTACK_USER,
OUTPUT_DIR: "./output",
BASELINE_DIR: "./baseline"
BASELINE_DIR: "./baseline",
TOLERANCE: 0.5
};

if(program.output){
Expand All @@ -47,7 +46,7 @@ var comparisons = [];
function getRows(){
var rows = "";
comparisons.forEach(function(comparison){
if(comparison.results.misMatchPercentage > 1){
if(comparison.results.misMatchPercentage > CONFIG.TOLERANCE){
rows += "" +
"<tr>" +
" <td>"+comparison.filename+"</td>" +
Expand Down Expand Up @@ -125,7 +124,7 @@ async.series([
}
};

if(parseFloat(data.misMatchPercentage) > 1){
if(parseFloat(data.misMatchPercentage) > CONFIG.TOLERANCE){
var base64DataRaw = data.getImageDataUrl();
var base64Data = base64DataRaw.replace(/^data:image\/png;base64,/,"");
fs.writeFileSync(CONFIG.OUTPUT_DIR+"/diff/"+filename, base64Data , "base64");
Expand Down

0 comments on commit dcb5c57

Please sign in to comment.