diff --git a/client/index.js b/client/index.js index d832019..98fad16 100644 --- a/client/index.js +++ b/client/index.js @@ -10,7 +10,9 @@ module.exports = { const nightmare = typeof window !== 'undefined' && window.__nightmare || parent.window.__nightmare; - if (!nightmare) return resolve(); + if (!nightmare || nightmare.skipScreenshot) { + return resolve(); + } const fs = nightmare.fs; const win = nightmare.remote.getCurrentWindow(); setTimeout(function() { @@ -22,7 +24,7 @@ module.exports = { fs.writeFile(path, data, 'base64', resolve); }); }); - }, 100); + }, 0); }); } } diff --git a/index.js b/index.js index a7749df..2976812 100644 --- a/index.js +++ b/index.js @@ -16,7 +16,7 @@ var NightmareBrowser = function (baseBrowserDecorator, args, config) { }) this._process.stdout.on('data', function (data) { - console.log('' + data); + // console.log('' + data); }) } } diff --git a/karma.conf.js b/karma.conf.js index 9ee3147..58a04de 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -62,6 +62,7 @@ module.exports = function(config) { concurrency: Infinity, nightmareOptions: { + skipScreenshot: false, width: 800, height: 600, show: false, diff --git a/lib/browser.js b/lib/browser.js index eb1478e..c30261a 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -20,13 +20,17 @@ const nightmare = require('nightmare')( ); nightmare - .goto(process.argv[2]) - .wait('#browsers') - .evaluate(() => { - document.querySelector('#banner').style.display = 'none'; - document.querySelector('#browsers').style.display = 'none'; - }) - .wait(() => null) - .end() + .goto(process.argv[2]) + .wait('#browsers') + .evaluate((options) => { + const __nightmare = window.__nightmare || window.parent.__nightmare; + if (__nightmare) { + __nightmare.skipScreenshot = options.skipScreenshot; + } + document.querySelector('#banner').style.display = 'none'; + document.querySelector('#browsers').style.display = 'none'; + }, options) + .wait(() => null) + .end() .catch((error) => console.error(error)); diff --git a/package.json b/package.json index 972a9bf..9395a2c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "test": "DEBUG=nightmare:*,electron:* karma start" + "test": "karma start" }, "keywords": [ "karma-plugin",