Last active
May 20, 2019 13:33
-
-
Save shridharkalagi/e1b4b3c0d4ccf867dc7372939768039a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 defaultConfig = require( './wdio.conf.js'); | |
const overriddenConfig = { | |
baseUrl: baseURL, | |
host: 'localhost', | |
port: 4444, | |
capabilities: { | |
maxInstances: 1, | |
browserName: 'chrome' | |
}, | |
services: ['selenium-standalone'], | |
// seleniumArgs: { | |
// version: '3.13.0' | |
// }, | |
// seleniumInstallArgs: { | |
// baseURL: 'https://selenium-release.storage.googleapis.com', | |
// version: '3.13.0', | |
// chrome: { | |
// // check for more recent versions of chrome driver here: | |
// // https://chromedriver.storage.googleapis.com/index.html | |
// version: '2.42', | |
// arch: process.arch, | |
// baseURL: 'https://chromedriver.storage.googleapis.com' | |
// } | |
// }, | |
reporters: [ | |
'dot', 'spec', JsonReporter, 'mochawesome' | |
], | |
mochaOpts: { | |
ui: 'tdd', | |
compilers: ['js:@babel/register'], | |
applicationCategory: ' Fresh', | |
timeout: 10 * 60 * 1000 | |
}, | |
onPrepare: function () { | |
var fs = require('fs'); | |
// Create Report Directory | |
if (!fs.existsSync(this.reporterOptions.outputDir)) { | |
fs.mkdirSync(this.reporterOptions.outputDir); | |
} | |
// Create Screenshot Directory | |
if (!fs.existsSync(this.reporterOptions.outputDir + '/screenshots/')) { | |
fs.mkdirSync(this.reporterOptions.outputDir + '/screenshots/'); | |
} | |
// do nothing after screenshot setup, override Browserstack config in default conf | |
}, | |
onComplete: () => { | |
// do nothing, override Browserstack config in default conf | |
}, | |
// Runs after a WebdriverIO command gets executed | |
afterTest: function (test) { | |
if (!(test.err === undefined)) { | |
// capture screenprint for assertion errors. | |
if (test.passed === false && test.err.message.indexOf('Verify') === -1) { | |
console.log('Error:', test.err) | |
var screenshotName = this.reporterOptions.outputDir + '/screenshots/' + test.title + '_' + browser.desiredCapabilities.browserName + '.png'; | |
browser.saveScreenshot(screenshotName); | |
} | |
} | |
}, | |
}; | |
exports.config = Object.assign({}, defaultConfig.config, overriddenConfig); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment