Skip to content

Instantly share code, notes, and snippets.

@treaz
Created August 15, 2017 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save treaz/3251b92f8c4b0932cfb64f26f88eb2cf to your computer and use it in GitHub Desktop.
Save treaz/3251b92f8c4b0932cfb64f26f88eb2cf to your computer and use it in GitHub Desktop.
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