node.js - Selenium Node + Sauce Labs Testing: Cannot Finish a Task -
i'm using sauce labs run selenium test scripts mocha testing framework. scripts ran perfectly, problem is, job not finish - seems driver.quit()
ignored, , i'm prompted timeout error after 90 secs.
here's code:
const { driver } = require('./config'); const { by, until } = require('selenium-webdriver'); describe('integration test', function () { this.timeout(20000); it('can login test user', function () { driver.get('https://www.example.com'); driver.wait(until.elementisnotvisible(driver.findelement(by.id('vale'))), 8000, 'vale cannot fade'); driver.findelement(by.name('email')).sendkeys('test_user@test.com'); driver.findelement(by.name('password')).sendkeys('password'); return driver.findelement(by.id('authformsubmitbutton')).click(); }); after(() => { console.log('quiting driver'); // not work! driver.quit(); }); });
in config driver
built , connected remote server.
when running this, in console can see test passing , quiting driver
message, in sauce labs dashboard task keeps waiting until time out.
btw tested above code local chromdriver
, works fine - driver
quitted after task.
any or idea appreciated.
needs return
before driver.quit()
.
instead of calling done(), mocha accepts promise return value. if test returns promise, mocha understands it’s asynchronous, , waits promise resolved before passing next test.
this article valuable.
Comments
Post a Comment