UNPKG

1.9 kBTypeScriptView Raw
1/// <reference types="q" />
2/**
3 * This is a base driver provider class.
4 * It is responsible for setting up the account object, tearing
5 * it down, and setting up the driver correctly.
6 */
7import * as q from 'q';
8import { promise as wdpromise, WebDriver } from 'selenium-webdriver';
9import { Config } from '../config';
10export declare abstract class DriverProvider {
11 drivers_: WebDriver[];
12 config_: Config;
13 private bpRunner;
14 constructor(config: Config);
15 /**
16 * Get all existing drivers.
17 *
18 * @public
19 * @return array of webdriver instances
20 */
21 getExistingDrivers(): WebDriver[];
22 getBPUrl(): string;
23 /**
24 * Create a new driver.
25 *
26 * @public
27 * @return webdriver instance
28 */
29 getNewDriver(): WebDriver;
30 /**
31 * Quit a driver.
32 *
33 * @public
34 * @param webdriver instance
35 */
36 quitDriver(driver: WebDriver): wdpromise.Promise<void>;
37 /**
38 * Quits an array of drivers and returns a q promise instead of a webdriver one
39 *
40 * @param drivers {webdriver.WebDriver[]} The webdriver instances
41 */
42 static quitDrivers(provider: DriverProvider, drivers: WebDriver[]): q.Promise<void>;
43 /**
44 * Default update job method.
45 * @return a promise
46 */
47 updateJob(update: any): q.Promise<any>;
48 /**
49 * Default setup environment method, common to all driver providers.
50 */
51 setupEnv(): q.Promise<any>;
52 /**
53 * Set up environment specific to a particular driver provider. Overridden
54 * by each driver provider.
55 */
56 protected abstract setupDriverEnv(): q.Promise<any>;
57 /**
58 * Teardown and destroy the environment and do any associated cleanup.
59 * Shuts down the drivers.
60 *
61 * @public
62 * @return {q.Promise<any>} A promise which will resolve when the environment is down.
63 */
64 teardownEnv(): q.Promise<any>;
65}