diff --git a/lib/helper/Nightmare.js b/lib/helper/Nightmare.js index 01db4085d..27cadd354 100644 --- a/lib/helper/Nightmare.js +++ b/lib/helper/Nightmare.js @@ -48,6 +48,7 @@ class Nightmare extends Helper { this.options = { waitForAction: 500, waitForTimeout: 1000, + fullPageScreenshots: true, rootElement: 'body', restart: true, keepCookies: false, @@ -800,7 +801,7 @@ class Nightmare extends Helper { /** * {{> ../webapi/saveScreenshot }} */ - saveScreenshot(fileName, fullPage = false) { + saveScreenshot(fileName, fullPage = this.options.fullPageScreenshots) { let outputFile = path.join(global.output_dir, fileName); this.debug('Screenshot is saving to ' + outputFile); let recorder = require('../recorder'); diff --git a/lib/helper/Protractor.js b/lib/helper/Protractor.js index 02ec07d98..de1532568 100644 --- a/lib/helper/Protractor.js +++ b/lib/helper/Protractor.js @@ -68,6 +68,7 @@ class Protractor extends SeleniumWebdriver { browser: 'chrome', url: 'http://localhost', seleniumAddress: 'http://localhost:4444/wd/hub', + fullPageScreenshots: true, rootElement: 'body', scriptsTimeout: 10000, waitForTimeout: 1000, // ms diff --git a/lib/helper/SeleniumWebdriver.js b/lib/helper/SeleniumWebdriver.js index 5813a6725..cdacf5d07 100644 --- a/lib/helper/SeleniumWebdriver.js +++ b/lib/helper/SeleniumWebdriver.js @@ -72,6 +72,7 @@ class SeleniumWebdriver extends Helper { restart: true, keepCookies: false, windowSize: null, + fullPageScreenshots: true, waitForTimeout: 1000, // ms scriptTimeout: 1000, // ms manualStart: false, diff --git a/lib/helper/WebDriverIO.js b/lib/helper/WebDriverIO.js index 9aa0d92a1..26ef1f815 100644 --- a/lib/helper/WebDriverIO.js +++ b/lib/helper/WebDriverIO.js @@ -921,13 +921,15 @@ class WebDriverIO extends Helper { this.debug('Screenshot has been saved to ' + outputFile); return this.browser.saveScreenshot(outputFile); } - return this.browser.execute(() => ({ - height: document.body.scrollHeight, - width: document.body.scrollWidth - })).then(({ - width, - height - }) => { + return this.browser.execute(function () { + return ({ + height: document.body.scrollHeight, + width: document.body.scrollWidth + }) + }).then(({ + width, + height + }) => { this.browser.windowHandleSize(width, height); this.debug('Screenshot has been saved to ' + outputFile); return this.browser.saveScreenshot(outputFile); @@ -1120,13 +1122,13 @@ class WebDriverIO extends Helper { sec = sec || this.options.waitForTimeout; context = context || 'body'; return this.browser.waitUntil(function () { - return this.getText(withStrictLocator(context)).then(function (source) { - if (Array.isArray(source)) { - return source.filter(part => part.indexOf(text) >= 0).length > 0; - } - return source.indexOf(text) >= 0; - }); - }, sec * 1000) + return this.getText(withStrictLocator(context)).then(function (source) { + if (Array.isArray(source)) { + return source.filter(part => part.indexOf(text) >= 0).length > 0; + } + return source.indexOf(text) >= 0; + }); + }, sec * 1000) .catch((e) => { if (e.type === 'WaitUntilTimeoutError') { return proceedSee.call(this, 'assert', text, withStrictLocator(context)); @@ -1361,15 +1363,15 @@ function withStrictLocator(locator) { locator.toString = () => `{${key}: '${value}'}`; switch (key) { - case 'by': - case 'xpath': - return value; - case 'css': - return value; - case 'id': - return '#' + value; - case 'name': - return `[name="${value}"]`; + case 'by': + case 'xpath': + return value; + case 'css': + return value; + case 'id': + return '#' + value; + case 'name': + return `[name="${value}"]`; } }