Fixes linter/indentation errors

This commit is contained in:
Simon Gellis 2017-03-01 01:01:23 -05:00
parent 4f3da17fba
commit 96c2f0f7c3
22 changed files with 156 additions and 137 deletions

View File

@ -11,7 +11,7 @@ export class Driver extends webdriver.WebDriver {
* the {@linkplain #getDefaultService default service} by default.
* @param {promise.ControlFlow=} opt_flow The control flow to use, or
* {@code null} to use the currently active flow.
* @return {!Driver} A new driver instance.
* @return {!Driver} A new driver instance.
*/
static createSession(opt_config?: webdriver.CreateSessionCapabilities, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow): Driver;

View File

@ -238,29 +238,29 @@ export function prepareProfile(profile: string | any, port: number): any;
*/
export class Driver extends webdriver.WebDriver {
/**
* Creates a new Firefox session.
*
* Creates a new Firefox session.
*
* @param {(Options|capabilities.Capabilities|Object)=} opt_config The
* configuration options for this driver, specified as either an
* {@link Options} or {@link capabilities.Capabilities}, or as a raw hash
* object.
* @param {(http.Executor|remote.DriverService)=} opt_executor Either a
* pre-configured command executor to use for communicating with an
* externally managed remote end (which is assumed to already be running),
* or the `DriverService` to use to start the geckodriver in a child
* process.
*
* If an executor is provided, care should e taken not to use reuse it with
* other clients as its internal command mappings will be updated to support
* Firefox-specific commands.
*
* _This parameter may only be used with Mozilla's GeckoDriver._
*
* @param {(http.Executor|remote.DriverService)=} opt_executor Either a
* pre-configured command executor to use for communicating with an
* externally managed remote end (which is assumed to already be running),
* or the `DriverService` to use to start the geckodriver in a child
* process.
*
* If an executor is provided, care should e taken not to use reuse it with
* other clients as its internal command mappings will be updated to support
* Firefox-specific commands.
*
* _This parameter may only be used with Mozilla's GeckoDriver._
*
* @param {promise.ControlFlow=} opt_flow The flow to
* schedule commands through. Defaults to the active flow object.
* @throws {Error} If a custom command executor is provided and the driver is
* configured to use the legacy FirefoxDriver from the Selenium project.
* @return {!Driver} A new driver instance.
* @throws {Error} If a custom command executor is provided and the driver is
* configured to use the legacy FirefoxDriver from the Selenium project.
* @return {!Driver} A new driver instance.
*/
static createSession(opt_config?: Options | webdriver.Capabilities, opt_executor?: http.Executor | remote.DriverService, opt_flow?: webdriver.promise.ControlFlow): Driver;

View File

@ -5,13 +5,13 @@ import * as webdriver from './index';
*/
export class Driver extends webdriver.WebDriver {
/**
* Creates a new session for Microsoft's Internet Explorer.
*
* Creates a new session for Microsoft's Internet Explorer.
*
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
* options.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
* or {@code null} to use the currently active flow.
* @return {!Driver} A new driver instance.
* @return {!Driver} A new driver instance.
*/
static createSession(opt_config?: webdriver.Capabilities | Options, opt_flow?: webdriver.promise.ControlFlow): Driver;

View File

@ -1,6 +1,9 @@
// Type definitions for Selenium WebDriverJS 3.0.1
// Type definitions for Selenium WebDriverJS 3.0
// Project: https://github.com/SeleniumHQ/selenium/tree/master/javascript/node/selenium-webdriver
// Definitions by: Bill Armstrong <https://github.com/BillArmstrong>, Yuki Kokubun <https://github.com/Kuniwak>, Craig Nishina <https://github.com/cnishina>, Simon Gellis <https://github.com/SupernaviX>
// Definitions by: Bill Armstrong <https://github.com/BillArmstrong>,
// Yuki Kokubun <https://github.com/Kuniwak>,
// Craig Nishina <https://github.com/cnishina>,
// Simon Gellis <https://github.com/SupernaviX>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@ -1307,7 +1310,7 @@ export class Condition<T> {
export class WebElementCondition extends Condition<WebElement> {
// add an unused private member so the compiler treats this
// class distinct from other Conditions
private _nominal: void;
private _nominal: undefined;
}
export namespace until {
@ -2113,9 +2116,9 @@ interface ProxyConfig {
httpProxy?: string;
sslProxy?: string;
noProxy?: string;
socksProxy?: string,
socksUsername?: string,
socksPassword?: string
socksProxy?: string,
socksUsername?: string,
socksPassword?: string
}
/**
@ -2348,15 +2351,15 @@ export class Builder {
setScrollBehavior(behavior: number): Builder;
/**
* Sets the http agent to use for each request.
* If this method is not called, the Builder will use http.globalAgent by default.
*
* @param {http.Agent} agent The agent to use for each request.
* @return {!Builder} A self reference.
*/
usingHttpAgent(agent: any): Builder;
* Sets the http agent to use for each request.
* If this method is not called, the Builder will use http.globalAgent by default.
*
* @param {http.Agent} agent The agent to use for each request.
* @return {!Builder} A self reference.
*/
usingHttpAgent(agent: any): Builder;
/**
/**
* Sets the URL of a remote WebDriver server to use. Once a remote URL has been
* specified, the builder direct all new clients to that server. If this method
* is never called, the Builder will attempt to create all clients locally.
@ -3910,10 +3913,10 @@ export class WebDriver {
* whether the condition has been satisified. Note the resolution time for
* a promise is factored into whether a wait has timed out.
*
* Note, if the provided condition is a {@link WebElementCondition}, then
* the wait will return a {@link WebElementPromise} that will resolve to the
* element that satisified the condition.
*
* Note, if the provided condition is a {@link WebElementCondition}, then
* the wait will return a {@link WebElementPromise} that will resolve to the
* element that satisified the condition.
*
* *Example:* waiting up to 10 seconds for an element to be present and visible
* on the page.
*

View File

@ -163,7 +163,7 @@ export class Driver extends webdriver.WebDriver {
* the {@link getDefaultService default service} by default.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
* or {@code null} to use the currently active flow.
* @return {!Driver} A new driver instance.
* @return {!Driver} A new driver instance.
*/
static createSession(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow): Driver;

View File

@ -66,6 +66,100 @@ export class DriverService {
stop(): webdriver.promise.Promise<any>;
}
export module DriverService {
/**
* Creates {@link DriverService} objects that manage a WebDriver server in a
* child process.
*/
export class Builder {
/**
* @param {string} exe Path to the executable to use. This executable must
* accept the `--port` flag for defining the port to start the server on.
* @throws {Error} If the provided executable path does not exist.
*/
constructor(exe: string);
/**
* Define additional command line arguments to use when starting the server.
*
* @param {...CommandLineFlag} var_args The arguments to include.
* @return {!THIS} A self reference.
* @this {THIS}
* @template THIS
*/
addArguments(...var_args: string[]): this;
/**
* Sets the host name to access the server on. If specified, the
* {@linkplain #setLoopback() loopback} setting will be ignored.
*
* @param {string} hostname
* @return {!DriverService.Builder} A self reference.
*/
setHostname(hostname: string): this;
/**
* Sets whether the service should be accessed at this host's loopback
* address.
*
* @param {boolean} loopback
* @return {!DriverService.Builder} A self reference.
*/
setLoopback(loopback: boolean): this;
/**
* Sets the base path for WebDriver REST commands (e.g. "/wd/hub").
* By default, the driver will accept commands relative to "/".
*
* @param {?string} basePath The base path to use, or `null` to use the
* default.
* @return {!DriverService.Builder} A self reference.
*/
setPath(basePath: string | null): this;
/**
* Sets the port to start the server on.
*
* @param {number} port The port to use, or 0 for any free port.
* @return {!DriverService.Builder} A self reference.
* @throws {Error} If an invalid port is specified.
*/
setPort(port: number): this;
/**
* Defines the environment to start the server under. This setting will be
* inherited by every browser session started by the server. By default, the
* server will inherit the enviroment of the current process.
*
* @param {(Map<string, string>|Object<string, string>|null)} env The desired
* environment to use, or `null` if the server should inherit the
* current environment.
* @return {!DriverService.Builder} A self reference.
*/
setEnvironment(env: Map<string, string> | {[name: string]: string} | null): this;
/**
* IO configuration for the spawned server process. For more information,
* refer to the documentation of `child_process.spawn`.
*
* @param {StdIoOptions} config The desired IO configuration.
* @return {!DriverService.Builder} A self reference.
* @see https://nodejs.org/dist/latest-v4.x/docs/api/child_process.html#child_process_options_stdio
*/
setStdio(config: any): this;
/**
* Creates a new DriverService using this instance's current configuration.
*
* @return {!DriverService} A new driver service.
*/
build(): DriverService;
}
}
/**
* A {@link webdriver.FileDetector} that may be used when running
* against a remote
@ -103,95 +197,3 @@ export class FileDetector extends webdriver.FileDetector {
*/
handleFile(driver: webdriver.WebDriver, file: string): webdriver.promise.Promise<string>;
}
module DriverService {
/**
* Creates {@link DriverService} objects that manage a WebDriver server in a
* child process.
*/
export class Builder {
/**
* @param {string} exe Path to the executable to use. This executable must
* accept the `--port` flag for defining the port to start the server on.
* @throws {Error} If the provided executable path does not exist.
*/
constructor(exe: string);
/**
* Define additional command line arguments to use when starting the server.
*
* @param {...CommandLineFlag} var_args The arguments to include.
* @return {!THIS} A self reference.
* @this {THIS}
* @template THIS
*/
addArguments(...var_args: string[]): this;
/**
* Sets the host name to access the server on. If specified, the
* {@linkplain #setLoopback() loopback} setting will be ignored.
*
* @param {string} hostname
* @return {!DriverService.Builder} A self reference.
*/
setHostname(hostname: string): this;
/**
* Sets whether the service should be accessed at this host's loopback
* address.
*
* @param {boolean} loopback
* @return {!DriverService.Builder} A self reference.
*/
setLoopback(loopback: boolean): this;
/**
* Sets the base path for WebDriver REST commands (e.g. "/wd/hub").
* By default, the driver will accept commands relative to "/".
*
* @param {?string} basePath The base path to use, or `null` to use the
* default.
* @return {!DriverService.Builder} A self reference.
*/
setPath(basePath: string | null): this;
/**
* Sets the port to start the server on.
*
* @param {number} port The port to use, or 0 for any free port.
* @return {!DriverService.Builder} A self reference.
* @throws {Error} If an invalid port is specified.
*/
setPort(port: number): this;
/**
* Defines the environment to start the server under. This setting will be
* inherited by every browser session started by the server. By default, the
* server will inherit the enviroment of the current process.
*
* @param {(Map<string, string>|Object<string, string>|null)} env The desired
* environment to use, or `null` if the server should inherit the
* current environment.
* @return {!DriverService.Builder} A self reference.
*/
setEnvironment(env: Map<string, string> | {[name:string]: string} | null): this;
/**
* IO configuration for the spawned server process. For more information,
* refer to the documentation of `child_process.spawn`.
*
* @param {StdIoOptions} config The desired IO configuration.
* @return {!DriverService.Builder} A self reference.
* @see https://nodejs.org/dist/latest-v4.x/docs/api/child_process.html#child_process_options_stdio
*/
setStdio(config: any): this;
/**
* Creates a new DriverService using this instance's current configuration.
*
* @return {!DriverService} A new driver service.
*/
build(): DriverService;
}
}

View File

@ -518,10 +518,10 @@ function TestWebDriverOptions() {
promise = options.deleteAllCookies();
promise = options.deleteCookie('name');
options.getCookie('name').then(function (cookie: webdriver.IWebDriverCookie) {
options.getCookie('name').then((cookie: webdriver.IWebDriverCookie) => {
var expiry: number = cookie.expiry;
});
options.getCookies().then(function (cookies: webdriver.IWebDriverCookie[]) { });
options.getCookies().then((cookies: webdriver.IWebDriverCookie[]) => { });
var logs: webdriver.Logs = options.logs();
var timeouts: webdriver.Timeouts = options.timeouts();
@ -852,7 +852,7 @@ function TestUntilModule() {
withCapabilities(webdriver.Capabilities.chrome()).
build();
var conditionB: webdriver.Condition<boolean> = new webdriver.Condition<boolean>('message', function (driver: webdriver.WebDriver) { return true; });
var conditionB: webdriver.Condition<boolean> = new webdriver.Condition<boolean>('message', (driver: webdriver.WebDriver) => true);
var conditionBBase: webdriver.Condition<boolean> = conditionB;
var conditionWebElement: webdriver.WebElementCondition;
var conditionWebElements: webdriver.Condition<webdriver.WebElement[]>;

View File

@ -3,7 +3,7 @@
"rules": {
"callable-types": false,
"forbidden-types": false,
"interface-name": false,
"interface-name": [false],
"no-empty-interface": false,
"unified-signatures": false
}

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
import * as remote from './remote';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
import * as remote from './remote';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace executors {

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
import * as remote from './remote';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace http {

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace ie {

View File

@ -1,3 +1,4 @@
/* tslint:disable */
// Type definitions for Selenium WebDriverJS 2.53.1
// Project: https://github.com/SeleniumHQ/selenium/tree/master/javascript/node/selenium-webdriver
// Definitions by: Bill Armstrong <https://github.com/BillArmstrong>, Yuki Kokubun <https://github.com/Kuniwak>, Craig Nishina <https://github.com/cnishina>

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
import * as remote from './remote';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace remote {

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from './index';
declare namespace safari {

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as chrome from 'selenium-webdriver/chrome';
import * as remote from 'selenium-webdriver/remote';
import * as webdriver from 'selenium-webdriver';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as firefox from 'selenium-webdriver/firefox';
import * as remote from 'selenium-webdriver/remote';
import * as webdriver from 'selenium-webdriver';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
import * as webdriver from 'selenium-webdriver';
import * as chrome from 'selenium-webdriver/chrome';
import * as firefox from 'selenium-webdriver/firefox';

View File

@ -1,3 +1,4 @@
/* tslint:disable */
declare namespace testing {
/**
* Registers a new test suite.
@ -60,4 +61,4 @@ declare namespace testing {
function xit(name: string, fn: Function): void;
}
export = testing;
export = testing;