lundi 12 novembre 2018

Why am I keep getting Error: Timeout of 2000ms exceeded from Mocha on async?

I am trying to start javascript testing on Selenium, but I am stucked at the start.

MochaJS never waits for the end of test, instead throwing after 2 seconds

Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/pavel/code/gscc/test/test.js)

My code is

const {Builder, By, Key, until} = require('selenium-webdriver');

describe('Test Suite', function() {
    it('should do', async function() {
        try {
            let driver = new Builder().forBrowser('firefox').build();
            await driver.get('http://www.google.com/ncr');
            await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
            await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
        } catch(err) {
            console.log(err);
        } finally {
            await driver.quit();
        }
    })
})

Mocha says that I have unresolved promises in my code, but are there such?

Aucun commentaire:

Enregistrer un commentaire