Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/helper/Nightmare.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Nightmare extends Helper {
this.options = {
waitForAction: 500,
waitForTimeout: 1000,
fullPageScreenshots: true,
rootElement: 'body',
restart: true,
keepCookies: false,
Expand Down Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions lib/helper/Protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/helper/SeleniumWebdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class SeleniumWebdriver extends Helper {
restart: true,
keepCookies: false,
windowSize: null,
fullPageScreenshots: true,
waitForTimeout: 1000, // ms
scriptTimeout: 1000, // ms
manualStart: false,
Expand Down
48 changes: 25 additions & 23 deletions lib/helper/WebDriverIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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}"]`;
}
}

Expand Down