Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: mousemove support #249

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
5 changes: 4 additions & 1 deletion e2e/utils/visual-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ module.exports.getDiffScreenshotName = (isDefaultBrowser) => {
};
};


module.exports.getRefPicName = () => {
return function (context) {
const testName = context.test.title;
Expand All @@ -174,3 +173,7 @@ module.exports.getRefPicName = () => {
return path.join(basePathRef, `${slugify(parent.toLowerCase())}/${slugify(testName.toLowerCase())}/${lastWordOfTestName.toLowerCase()}_reference_pic.png`);
};
};

module.exports.printOutConsoleLog = () => {
browser.printOutConsoleLog = true;
};
39 changes: 28 additions & 11 deletions wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ if (process.env.BROWSER) {
browsers.push({
width: resolution.width,
height: resolution.height,
browserName: element
browserName: element,
'moz:firefoxOptions': {
// flag to activate Firefox headless mode (see https://github.com/mozilla/geckodriver/blob/master/README.md#firefox-capabilities for more details about moz:firefoxOptions)
args: ['-headless']
}
});
} else {
browsers.push({
Expand All @@ -51,16 +55,13 @@ if (process.env.BROWSER) {
}
}];
}

const browserLogEntries = [];
exports.config = {
seleniumInstallArgs: {version: '3.4.0'},
seleniumArgs: {version: '3.4.0'},
seleniumInstallArgs: { version: '3.4.0' },
seleniumArgs: { version: '3.4.0' },

specs: [
'./e2e/test/**/*.js'
],
exclude: [
],
specs: ['./e2e/test/**/*.js'],
exclude: [],

maxInstances: 10,

Expand Down Expand Up @@ -119,7 +120,7 @@ exports.config = {
screenshotName: getScreenshotName(isDefaultBrowser),
diffName: getDiffScreenshotName(isDefaultBrowser),
misMatchTolerance: 3.0
}),
})
},
user: sauceLabsUsername,
key: saucelabsAccesKey,
Expand All @@ -144,13 +145,29 @@ exports.config = {
require: './e2e/utils/mocha-setup.js'
},

before: function (capabilities, tests) {
before: (capabilities, tests) => {
browser.currentTest = tests[0];
if (capabilities.width && capabilities.height) {
browser.windowHandleSize({
width: capabilities.width,
height: capabilities.height
});
}
},

afterTest: (test) => {
if (browser.options.desiredCapabilities.browserName === 'chrome') {
browserLogEntries.push({
title: test.title,
result: test.passed,
messages: browser.log('browser').value,
url: browser.getUrl()
});
}
if (browser.options.desiredCapabilities.browserName === 'chrome' && browser.printOutConsoleLog) {
console.log('console entries for %s', browser.currentTest);
console.log(JSON.stringify(browserLogEntries, null, 2));
browser.printOutConsoleLog = false;
}
}
};