Reputation: 188
Currently, I do not understand why the terminal says my test is passing. I have my test set up to fail.
This is the terminal message:
Google
✓ Load google search page
1 passing (22ms)
This is my test written with Node JS
const assert = require('assert');
const {Builder, By, Key, until} = require('selenium-webdriver');
const suite = require('selenium-webdriver/testing')
var driver = new Builder()
.forBrowser('chrome')
.build();
describe('Google', function() {
it('Load google search page', function() {
driver.get('https://www.foobar.com')
.then(_ => driver.wait(until.titleIs('Darkness!'), 10000))
.then(_ => driver.quit());
});
});
Upvotes: 1
Views: 493
Reputation: 23495
Looking at documentation when you want to make asynchronous tests use the following format :
it('should be fulfilled', function (done) {
promise.should.be.fulfilled.and.notify(done);
});
it('should be rejected', function (done) {
otherPromise.should.be.rejected.and.notify(done);
});
Applied to your case :
describe('Google', function() {
it('Load google search page', function(done) {
driver.get('https://www.foobar.com')
.then(() => driver.wait(until.titleIs('Darkness!'), 10000))
.then(() => driver.quit())
.then(() => done())
.catch(done);
});
});
Upvotes: 3