-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (50 loc) · 1.76 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* webdriverio
* https://github.com/webdriverio/webdriverio
*
* A WebDriver module for nodejs. Either use the super easy help commands or use the base
* Webdriver wire protocol commands. Its totally inspired by jellyfishs webdriver, but the
* goal is to make all the webdriver protocol items available, as near the original as possible.
*
* Copyright (c) 2013 Camilo Tapia <[email protected]>
* Licensed under the MIT license.
*
* Contributors:
* Dan Jenkins <[email protected]>
* Christian Bromann <[email protected]>
* Vincent Voyer <[email protected]>
*/
import WebdriverIO from './lib/webdriverio'
import Multibrowser from './lib/multibrowser'
import ErrorHandler from './lib/utils/ErrorHandler'
import getImplementedCommands from './lib/helpers/getImplementedCommands'
import Launcher from './lib/launcher'
import pkg from './package.json'
const IMPLEMENTED_COMMANDS = getImplementedCommands()
const VERSION = pkg.version
let remote = function (options = {}, modifier) {
/**
* initialise monad
*/
let wdio = WebdriverIO(options, modifier)
/**
* build prototype: commands
*/
for (let commandName of Object.keys(IMPLEMENTED_COMMANDS)) {
wdio.lift(commandName, IMPLEMENTED_COMMANDS[commandName])
}
let prototype = wdio()
prototype.defer.resolve()
return prototype
}
let multiremote = function (options) {
let multibrowser = new Multibrowser()
for (let browserName of Object.keys(options)) {
multibrowser.addInstance(
browserName,
remote(options[browserName], multibrowser.getInstanceModifier())
)
}
return remote(options, multibrowser.getModifier())
}
export { remote, multiremote, VERSION, ErrorHandler, Launcher }