Created
August 15, 2017 16:42
-
-
Save treaz/3251b92f8c4b0932cfb64f26f88eb2cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = require('config'); | |
const includes = require('lodash.includes'); | |
const chaiWebdriver = require('chai-webdriverio').default; | |
const chai = require('chai'); | |
const VIEWPORT_SIZE = { | |
width: 1070, | |
height: 600, | |
}; | |
const testsToRun = ['./test/selenium/*.js']; | |
if (process.env.SCREEN_CATEGORY === 'small' || process.env.SCREEN_CATEGORY === 'native-phone') { | |
VIEWPORT_SIZE.width = 320; | |
testsToRun.push('./**/small/*.js'); | |
} else if (process.env.SCREEN_CATEGORY === 'medium' || process.env.SCREEN_CATEGORY === 'native-phablet') { | |
VIEWPORT_SIZE.width = 570; | |
testsToRun.push('./**/medium/*.js'); | |
} else if (process.env.SCREEN_CATEGORY === 'large' || process.env.SCREEN_CATEGORY === 'native-tablet') { | |
VIEWPORT_SIZE.width = 820; | |
testsToRun.push('./**/large/*.js'); | |
} else { | |
VIEWPORT_SIZE.width = 1070; | |
testsToRun.push('./**/xlarge/*.js'); | |
} | |
module.exports = { | |
specs: ['./test/selenium/xlarge/MenuMainLinks.js', './test/selenium/xlarge/MenuMoreLinks.js'], | |
sync: true, | |
logLevel: 'silent', | |
coloredLogs: true, | |
screenshotPath: './log/errorShots/', | |
baseUrl: config.selenium.target.baseUrl, | |
waitforTimeout: 30 * 1000, | |
connectionRetryTimeout: 90 * 1000, | |
connectionRetryCount: 3, | |
framework: 'mocha', | |
mochaOpts: { | |
ui: 'bdd', | |
timeout: 50 * 1000, | |
}, | |
plugins: { | |
'wdio-screenshot': {}, | |
}, | |
before: function() { | |
console.log('Tests suites to run: ' + JSON.stringify(testsToRun)); | |
selectors = require('./utils/selectors'); | |
selectorsThirdParties = require('./utils/selectorsThirdPartySites') | |
expect = require('chai').expect; | |
chai.use(chaiWebdriver(browser)); | |
require('babel-register'); | |
if (includes(process.env.SCREEN_CATEGORY, 'native')) { | |
console.log('Skipping resizing viewport on native devices'); | |
} else { | |
console.log('Using viewport size: ' + JSON.stringify(VIEWPORT_SIZE)); | |
browser.setViewportSize(VIEWPORT_SIZE); | |
} | |
browser.addCommand('clickForce', function(selector) { | |
browser.selectorExecute(selector, function(selector) { | |
selector[0].click(); | |
}); | |
}); | |
}, | |
screenshotOnReject: true, | |
screenshotOnReject: { | |
connectionRetryTimeout: 30000, | |
connectionRetryCount: 2, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment