Benjamin Eliezer Benjamin Eliezer - 2 months ago 25
Javascript Question

Im not able to edit the timeout on Selenium Standalone

I'm trying to create a test Automation with webdriverio, selenium standalone and Gulp. Selenium is running within the app, but I can't edit the selenium timeout default value. The page loads fine, but it's super slow and I get the default 10 second timeout. How can I edit the TimeOut?

Here is my code to load the Selenium server.
gulpfile.babel

import gulp from 'gulp';
import selenium from 'selenium-standalone';
import webdriver from 'gulp-webdriver';

let seleniumServer;

gulp.task('selenium:start', (done) => {
selenium.install({ logger: function(message) {} }, () => {
selenium.start((err, child) => {
if (err) { return done(err); }
seleniumServer = child;
done();
});
});

});

gulp.task('config:setup', ['selenium:start'], () => {
return gulp.src('wdio.conf.js')
.pipe(webdriver({
waitforTimeout: 60000
})).on('error', () => {
seleniumServer.kill();
process.exit(1);
});
});
gulp.task('handler', ['config:setup'], () => {
seleniumServer.kill();
});


My Test case

describe('Creating a new invitation request', function() {
let _page, _container;
before(() => {
_page = new page.page();
_container = new container.container();

});
it('request invitation', function() {
_page.navigate(_container.urlBase);
expect(_page.createNewRequest(_container.userToCreate));
});
});


Thanks in advance.

Edited, added the wdio.conf.js



exports.config = {
specs: [
'./testcases/*.js'
],
exclude: [
'./excluded/out/*.js'
],
maxInstances: 1,
capabilities:
capabilities: [{
maxInstances: 1,
browserName: 'chrome'
}],
sync: true,
logLevel: 'silent',
coloredLogs: true,
screenshotPath: './errorShots/',
baseUrl: 'http://localhost',
waitforTimeout: 90000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
compilers: ['js:babel-core/register']
}
}

Answer

On the wdio.conf.js file, on mochaOpts attribute added timeout with the milliseconds desired under the compiler options. The config ended up like this:

  exports.config = {
    specs: [
        './testcases/*.js'
    ],
    exclude: [      
        './excluded/out/*.js'
    ],
    maxInstances: 1,
capabilities:
    capabilities: [{      
        maxInstances: 1,
        browserName: 'chrome'
    }],
    sync: true,
    logLevel: 'silent',
    coloredLogs: true,
    screenshotPath: './errorShots/',
    baseUrl: 'http://localhost',
    waitforTimeout: 90000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    framework: 'mocha',
    mochaOpts: {
        compilers: ['js:babel-core/register'],
        timeout: 90000
    }
}
Comments