Skip to content

Commit

Permalink
[js] Fix builder test
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani authored Sep 30, 2021
1 parent 992cef2 commit cb0e615
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions javascript/node/selenium-webdriver/test/builder_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ const assert = require('assert')

const chrome = require('../chrome')
const edge = require('../edge')
const error = require('../lib/error')
const firefox = require('../firefox')
const ie = require('../ie')
const safari = require('../safari')
const test = require('../lib/test')
const { Browser } = require('../lib/capabilities')
const { Pages } = require('../lib/test')
const { Builder } = require('../../selenium-webdriver/index')
const { Builder, Capabilities } = require('..')

test.suite(function (env) {
const BROWSER_MAP = new Map([
Expand Down Expand Up @@ -92,31 +93,31 @@ test.suite(function (env) {
async function getCaps(driver) {
return driver.getCapabilities();
}
})

describe('Builder', function () {
describe('catches incorrect use of browser options class', function () {
function test(key, options) {
it(key, async function () {
let builder = new Builder().withCapabilities(
new Capabilities()
.set('browserName', 'fake-browser-should-not-try-to-start')
.set(key, new options())
)
try {
let driver = await builder.build()
await driver.quit()
return Promise.reject(Error('should have failed'))
} catch (ex) {
if (!(ex instanceof error.InvalidArgumentError)) {
throw ex

describe('Builder', function () {
describe('catches incorrect use of browser options class', function () {
function test(key, options) {
it(key, async function () {
let builder = new Builder().withCapabilities(
new Capabilities()
.set('browserName', 'fake-browser-should-not-try-to-start')
.set(key, new options())
)
try {
let driver = await builder.build()
await driver.quit()
return Promise.reject(Error('should have failed'))
} catch (ex) {
if (!(ex instanceof error.InvalidArgumentError)) {
throw ex
}
}
}
})
}
})
}

test('chromeOptions', chrome.Options)
test('moz:firefoxOptions', firefox.Options)
test('safari.options', safari.Options)
test('chromeOptions', chrome.Options)
test('moz:firefoxOptions', firefox.Options)
test('safari.options', safari.Options)
})
})
})

0 comments on commit cb0e615

Please sign in to comment.