i trying increase timeout mocha tests web requests form part of automated ui test suite , therefore can take longer default 2000ms.
the code works great if call mocha --timeout set 5000ms or default 2000ms not enough.
i want able set timeout per test suite timeout becomes part of success criteria might different on case case basis.
before(()=>{ var sw = require('selenium-webdriver'); this.driver = new sw.builder().withcapabilities(sw.capabilities.chrome()).build(); var c = require('chai'); c.use(require('chai-webdriver')(this.driver)); this.expect = c.expect; return this.driver.getwindowhandle(); }) after(() => { return this.driver.quit(); }) describe('looking @ github', () => { beforeeach(() => { this.driver.get('http://stackoverflow.com/'); }) describe('when take @ stack overflow home page', () => { return it('it not have crazy cat text in it!', () => { return this.expect('#h-top-questions').dom.to.not.contain.text("just cats here!"); }); }); })
use function intead of arrow , call this.timeout(5000); e.g.
describe('when take @ stack overflow home page', () => { return it('it not have crazy cat text in it!', function() { this.timeout(5000); return this.expect('#h-top-questions').dom.to.not.contain.text("just cats here!"); }); }); this because ()=> captures surrounding this. more http://basarat.gitbooks.io/typescript/content/docs/arrow-functions.html
Comments
Post a Comment