Restructured the testing configs to run 4 browser sessions one after another: desktop Chrome, desktop Firefox, iPhone 6 Plus and Nexus 5X.

This commit is contained in:
Maxim Khlobystov 2017-11-10 17:21:53 -05:00
parent fb700ed510
commit 74f4cd3367
2 changed files with 13 additions and 5 deletions

View File

@ -6,7 +6,7 @@
"start:prod": "meteor reset && ROOT_URL=http://127.0.0.1/html5client NODE_ENV=production meteor --production",
"start:dev": "ROOT_URL=http://127.0.0.1/html5client NODE_ENV=development meteor",
"test": "wdio ./tests/webdriverio/wdio.conf.js",
"test-visual-regression": "wdio ./tests/webdriverio/wdio.vreg.conf.js",
"test-visual-regression": "export BROWSER_NAME=firefox; wdio ./tests/webdriverio/wdio.vreg.conf.js; export BROWSER_NAME=chrome; wdio ./tests/webdriverio/wdio.vreg.conf.js; export BROWSER_NAME=chrome_mobile; DEVICE_NAME='iPhone 6 Plus'; export DEVICE_NAME; wdio ./tests/webdriverio/wdio.vreg.conf.js; DEVICE_NAME='Nexus 5X'; export DEVICE_NAME; wdio ./tests/webdriverio/wdio.vreg.conf.js",
"lint": "eslint . --ext .jsx,.js",
"precommit": "lint-staged"
},

View File

@ -18,7 +18,7 @@ function getScreenshotNameWithBrowser(basePath) {
var type = context.type;
var testName = context.test.title;
var browserVersion = parseInt(context.browser.version, 10);
var browserName = context.browser.name;
var browserName = process.env.BROWSER_NAME=='chrome_mobile' ? process.env.DEVICE_NAME : context.browser.name;
var browserViewport = context.meta.viewport;
var browserWidth = browserViewport.width;
var browserHeight = browserViewport.height;
@ -32,9 +32,17 @@ exports.config = {
'tests/webdriverio/specs/visual-regression/**/*.spec.js'
],
capabilities: [{
capabilities: [process.env.BROWSER_NAME=='chrome_mobile' ? {
maxInstances: 5,
browserName: 'chrome'
browserName: 'chrome',
chromeOptions: {
mobileEmulation: {
deviceName: process.env.DEVICE_NAME
}
}
} : {
maxInstances: 5,
browserName: process.env.BROWSER_NAME
}],
sync: true,
@ -59,7 +67,7 @@ exports.config = {
diffName: getScreenshotNameWithBrowser(path.join(process.cwd(), 'tests/webdriverio/screenshots/diff')),
misMatchTolerance: 0.01,
}),
viewports: [{ width: 1920, height: 1200 }, { width: 960, height: 1200 }],
viewports: process.env.BROWSER_NAME=='chrome_mobile' ? [] : [{ width: 1920, height: 1200 }, { width: 960, height: 1200 }],
viewportChangePause: 300,
orientations: ['landscape'],
},