diff --git a/README.md b/README.md index 8fac064..326bdad 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,8 @@ And integrated `viffclient.post` method in your functional testing code. Check m # History +2014-06-08 **viff@0.10.x** could use multi viff instances to improve testing performance. + 2014-05-18 **viff@0.9.0** finally replace `canvas` by `phantomjs`, so easy installation starts from now, even in Windows System. 2014-03-15 **viff@0.8.2** could setup viff server and wait for screenshots from the place out of viff. Check out the [`viff client`](https://github.com/winsonwq/viff-client) example. diff --git a/bin/viffs b/bin/viffs deleted file mode 100755 index 8079a3d..0000000 --- a/bin/viffs +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node - -require('../lib/viffs.js') diff --git a/gruntfile.coffee b/gruntfile.coffee index 98f13e2..42f5f7e 100644 --- a/gruntfile.coffee +++ b/gruntfile.coffee @@ -26,7 +26,6 @@ module.exports = (grunt) -> 'lib/testcase.js': 'src/testcase.coffee', 'lib/capability.js': 'src/capability.coffee', 'lib/resemble.js': 'src/resemble.coffee', - 'lib/viffs.js': 'src/viffs.coffee', 'lib/canvas.drawimage.js': 'src/canvas.drawimage.coffee', 'lib/image.dataurl.helper.js': 'src/image.dataurl.helper.coffee', 'test/build/comparison_test.js': 'test/src/comparison_test.coffee', diff --git a/package.json b/package.json index d6bb921..5553a27 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "viff", "description": "Find virtual differences between web pages in different environments(developing, staging, production) and browsers.", - "version": "0.9.4", + "version": "0.10.2", "homepage": "https://github.com/winsonwq/viff", "author": { "name": "Wang Qiu", diff --git a/src/index.coffee b/src/index.coffee index 66d183b..d163cf7 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -11,25 +11,27 @@ config = processArgs process.argv return console.log config if _.isString config -viff = new Viff config.seleniumHost +count = config.maxInstance ? 1 + +cases = Viff.constructCases config.browsers, config.envHosts, config.paths +testGroups = Viff.split cases, count +resolvedCases = [] exceptions = [] -# clean the images and report.json -viff.on 'before', (cases) -> - imgGen.reset() - consoleStatus.logBefore() +imgGen.reset() +consoleStatus.logBefore() -# generate images by each case -viff.on 'afterEach', (_case, duration, fex, tex) -> - imgGen.generateByCase _case if duration != 0 - consoleStatus.logAfterEach _case, duration, fex, tex, exceptions +for group in testGroups + viff = new Viff config.seleniumHost -# generate report.json -viff.on 'after', (cases, duration) -> - imgGen.generateReport cases - resemble.exit() - partialCanvas.exit() - consoleStatus.logAfter cases, duration, exceptions + viff.on 'afterEach', (_case, duration, fex, tex) -> + imgGen.generateByCase _case if duration != 0 + consoleStatus.logAfterEach _case, duration, fex, tex, exceptions -cases = Viff.constructCases config.browsers, config.envHosts, config.paths -viff.run cases + viff.run group, ([cases, duration]) -> + resolvedCases = resolvedCases.concat cases + unless --count + imgGen.generateReport resolvedCases + resemble.exit() + partialCanvas.exit() + consoleStatus.logAfter resolvedCases, duration, exceptions diff --git a/src/viffs.coffee b/src/viffs.coffee deleted file mode 100644 index d553a17..0000000 --- a/src/viffs.coffee +++ /dev/null @@ -1,37 +0,0 @@ -_ = require 'underscore' - -Viff = require './viff.js' -processArgs = require './process.argv.js' -consoleStatus = require './console.status.js' -imgGen = require './image.generator' -resemble = require './resemble' -partialCanvas = require './canvas.drawimage' - -config = processArgs process.argv - -return console.log config if _.isString config - -count = config.maxInstance ? 2 - -cases = Viff.constructCases config.browsers, config.envHosts, config.paths -testGroups = Viff.split cases, count -resolvedCases = [] -exceptions = [] - -imgGen.reset() -consoleStatus.logBefore() - -for group in testGroups - viff = new Viff config.seleniumHost - - viff.on 'afterEach', (_case, duration, fex, tex) -> - imgGen.generateByCase _case if duration != 0 - consoleStatus.logAfterEach _case, duration, fex, tex, exceptions - - viff.run group, ([cases, duration]) -> - resolvedCases = resolvedCases.concat cases - unless --count - imgGen.generateReport resolvedCases - resemble.exit() - partialCanvas.exit() - consoleStatus.logAfter resolvedCases, duration, exceptions