Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jgoldring/b2cd473773fe51ca8d517012e8508af4 to your computer and use it in GitHub Desktop.
Save jgoldring/b2cd473773fe51ca8d517012e8508af4 to your computer and use it in GitHub Desktop.
Example wdio config file where onComplete does not wait for the async operation
exports.config = {
runner: 'local',
specs: [ 'test.js'],
maxInstances: 2,
exclude: [],
hostname: 'localhost',
port: 4444,
path: '/wd/hub',
capabilities: [
{
browserName: 'chrome',
"goog:chromeOptions" : {
"args" : [
"no-sandbox"
]
}
}
],
outputDir: './wdiologs/',
deprecationWarnings: true,
bail: 0,
logLevel: 'info',
coloredLogs: true,
waitforTimeout: 10000,
connectionRetryTimeout: 20000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd'
},
onPrepare: async function(config, capabilities) {
console.log("onPrepare() - Pre 10s Wait: " + Date.now());
await new Promise(resolve => setTimeout(resolve, 10000));
console.log("onPrepare() - Post 10s Wait: " + Date.now());
},
onComplete: async function (exitCode, config, capabilities, results) {
console.log("onComplete() - Pre 10s Wait: " + Date.now());
await new Promise(resolve => setTimeout(resolve, 10000));
console.log("onComplete() - Post 10s Wait: " + Date.now());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment