From 0dcb154bc07d9d49368e8eb9fa8fff433e0c3ae5 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 29 Mar 2017 16:17:11 -0700 Subject: [PATCH] selenium-webdriver: Apply new lint rules (#15500) --- types/selenium-webdriver/chrome.d.ts | 21 -- types/selenium-webdriver/edge.d.ts | 1 - types/selenium-webdriver/firefox.d.ts | 16 -- types/selenium-webdriver/http.d.ts | 1 - types/selenium-webdriver/index.d.ts | 104 +++----- types/selenium-webdriver/remote.d.ts | 7 +- types/selenium-webdriver/test/chrome.ts | 16 +- types/selenium-webdriver/test/firefox.ts | 29 ++- types/selenium-webdriver/test/index.ts | 291 +++++++++++------------ 9 files changed, 200 insertions(+), 286 deletions(-) diff --git a/types/selenium-webdriver/chrome.d.ts b/types/selenium-webdriver/chrome.d.ts index 2604b99e89..6bd2fe22a8 100644 --- a/types/selenium-webdriver/chrome.d.ts +++ b/types/selenium-webdriver/chrome.d.ts @@ -59,7 +59,6 @@ export class Options { */ static fromCapabilities(capabilities: webdriver.Capabilities): Options; - /** * Add additional command line arguments to use when launching the Chrome * browser. Each argument may be specified with or without the '--' prefix @@ -70,7 +69,6 @@ export class Options { */ addArguments(...var_args: string[]): Options; - /** * List of Chrome command line switches to exclude that ChromeDriver by default * passes when starting Chrome. Do not prefix switches with '--'. @@ -80,7 +78,6 @@ export class Options { */ excludeSwitches(...var_args: string[]): Options; - /** * Add additional extensions to install when launching Chrome. Each extension * should be specified as the path to the packed CRX file, or a Buffer for an @@ -91,7 +88,6 @@ export class Options { */ addExtensions(...var_args: any[]): Options; - /** * Sets the path to the Chrome binary to use. On Mac OS X, this path should * reference the actual Chrome executable, not just the application binary @@ -105,7 +101,6 @@ export class Options { */ setChromeBinaryPath(path: string): Options; - /** * Sets whether to leave the started Chrome browser running if the controlling * ChromeDriver service is killed before {@link webdriver.WebDriver#quit()} is @@ -116,7 +111,6 @@ export class Options { */ detachDriver(detach: boolean): Options; - /** * Sets the user preferences for Chrome's user profile. See the 'Preferences' * file in Chrome's user data directory for examples. @@ -125,7 +119,6 @@ export class Options { */ setUserPreferences(prefs: any): Options; - /** * Sets the logging preferences for the new session. * @param {!webdriver.logging.Preferences} prefs The logging preferences. @@ -159,7 +152,6 @@ export class Options { */ setPerfLoggingPrefs(prefs: IPerfLoggingPrefs): Options; - /** * Sets preferences for the 'Local State' file in Chrome's user data * directory. @@ -168,7 +160,6 @@ export class Options { */ setLocalState(state: any): Options; - /** * Sets the name of the activity hosting a Chrome-based Android WebView. This * option must be set to connect to an [Android WebView]( @@ -179,7 +170,6 @@ export class Options { */ androidActivity(name: string): Options; - /** * Sets the device serial number to connect to via ADB. If not specified, the * ChromeDriver will select an unused device at random. An error will be @@ -190,7 +180,6 @@ export class Options { */ androidDeviceSerial(serial: string): Options; - /** * Configures the ChromeDriver to launch Chrome on Android via adb. This * function is shorthand for @@ -199,7 +188,6 @@ export class Options { */ androidChrome(): Options; - /** * Sets the package name of the Chrome or WebView app. * @@ -209,7 +197,6 @@ export class Options { */ androidPackage(pkg: string): Options; - /** * Sets the process name of the Activity hosting the WebView (as given by `ps`). * If not specified, the process name is assumed to be the same as @@ -220,7 +207,6 @@ export class Options { */ androidProcess(processName: string): Options; - /** * Sets whether to connect to an already-running instead of the specified * {@linkplain #androidProcess app} instead of launching the app with a clean @@ -231,7 +217,6 @@ export class Options { */ androidUseRunningApp(useRunning: boolean): Options; - /** * Sets the path to Chrome's log file. This path should exist on the machine * that will launch Chrome. @@ -240,7 +225,6 @@ export class Options { */ setChromeLogFile(path: string): Options; - /** * Sets the directory to store Chrome minidumps in. This option is only * supported when ChromeDriver is running on Linux. @@ -249,7 +233,6 @@ export class Options { */ setChromeMinidumpPath(path: string): Options; - /** * Configures Chrome to emulate a mobile device. For more information, refer * to the ChromeDriver project page on [mobile emulation][em]. Configuration @@ -295,7 +278,6 @@ export class Options { */ setProxy(proxy: webdriver.ProxyConfig): Options; - /** * Converts this options instance to a {@link webdriver.Capabilities} object. * @param {webdriver.Capabilities=} opt_capabilities The capabilities to merge @@ -330,7 +312,6 @@ export class ServiceBuilder extends remote.DriverService.Builder { */ setAdbPort(port: number): this; - /** * Sets the path of the log file the driver should log to. If a log file is * not specified, the driver will log to stderr. @@ -339,14 +320,12 @@ export class ServiceBuilder extends remote.DriverService.Builder { */ loggingTo(path: string): this; - /** * Enables verbose logging. * @return {!ServiceBuilder} A self reference. */ enableVerboseLogging(): this; - /** * Sets the number of threads the driver should use to manage HTTP requests. * By default, the driver will use 4 threads. diff --git a/types/selenium-webdriver/edge.d.ts b/types/selenium-webdriver/edge.d.ts index 3fb3408b1f..90b45fc92d 100644 --- a/types/selenium-webdriver/edge.d.ts +++ b/types/selenium-webdriver/edge.d.ts @@ -27,7 +27,6 @@ export class Driver extends webdriver.WebDriver { * Class for managing MicrosoftEdgeDriver specific options. */ export class Options { - /** * Extracts the MicrosoftEdgeDriver specific options from the given * capabilities object. diff --git a/types/selenium-webdriver/firefox.d.ts b/types/selenium-webdriver/firefox.d.ts index 6746c3c683..0c2ecdbe92 100644 --- a/types/selenium-webdriver/firefox.d.ts +++ b/types/selenium-webdriver/firefox.d.ts @@ -20,7 +20,6 @@ export class Binary { */ addArguments(...var_args: string[]): void; - /** * Launches Firefox and eturns a promise that will be fulfilled when the process * terminates. @@ -30,7 +29,6 @@ export class Binary { */ launch(profile: string): webdriver.promise.Promise; - /** * Kills the managed Firefox process. * @return {!promise.Promise} A promise for when the process has terminated. @@ -59,7 +57,6 @@ export class Profile { */ addExtension(extension: string): void; - /** * Sets a desired preference for this profile. * @param {string} key The preference key. @@ -70,7 +67,6 @@ export class Profile { setPreference(key: string, value: number): void; setPreference(key: string, value: boolean): void; - /** * Returns the currently configured value of a profile preference. This does * not include any defaults defined in the profile's template directory user.js @@ -81,7 +77,6 @@ export class Profile { */ getPreference(key: string): any; - /** * @return {number} The port this profile is currently configured to use, or * 0 if the port will be selected at random when the profile is written @@ -89,21 +84,18 @@ export class Profile { */ getPort(): number; - /** * Sets the port to use for the WebDriver extension loaded by this profile. * @param {number} port The desired port, or 0 to use any free port. */ setPort(port: number): void; - /** * @return {boolean} Whether the FirefoxDriver is configured to automatically * accept untrusted SSL certificates. */ acceptUntrustedCerts(): boolean; - /** * Sets whether the FirefoxDriver should automatically accept untrusted SSL * certificates. @@ -111,35 +103,30 @@ export class Profile { */ setAcceptUntrustedCerts(value: boolean): void; - /** * Sets whether to assume untrusted certificates come from untrusted issuers. * @param {boolean} value . */ setAssumeUntrustedCertIssuer(value: boolean): void; - /** * @return {boolean} Whether to assume untrusted certs come from untrusted * issuers. */ assumeUntrustedCertIssuer(): boolean; - /** * Sets whether to use native events with this profile. * @param {boolean} enabled . */ setNativeEventsEnabled(enabled: boolean): void; - /** * Returns whether native events are enabled in this profile. * @return {boolean} . */ nativeEventsEnabled(): boolean; - /** * Writes this profile to disk. * @param {boolean=} opt_excludeWebDriverExt Whether to exclude the WebDriver @@ -151,7 +138,6 @@ export class Profile { */ writeToDisk(opt_excludeWebDriverExt?: boolean): webdriver.promise.Promise; - /** * Encodes this profile as a zipped, base64 encoded directory. * @return {!promise.Promise.} A promise for the encoded profile. @@ -264,7 +250,6 @@ export class Driver extends webdriver.WebDriver { */ static createSession(opt_config?: Options | webdriver.Capabilities, opt_executor?: http.Executor | remote.DriverService, opt_flow?: webdriver.promise.ControlFlow): Driver; - /** * This function is a no-op as file detectors are not supported by this * implementation. @@ -305,4 +290,3 @@ export class ServiceBuilder extends remote.DriverService.Builder { */ setFirefoxBinary(binary: string | Binary): this; } - diff --git a/types/selenium-webdriver/http.d.ts b/types/selenium-webdriver/http.d.ts index 4fc12afb19..72fa1b2c5f 100644 --- a/types/selenium-webdriver/http.d.ts +++ b/types/selenium-webdriver/http.d.ts @@ -42,7 +42,6 @@ export class Response { toString(): string; } - export function post(path: string): any; export function del(path: string): any; export function get(path: string): any; diff --git a/types/selenium-webdriver/index.d.ts b/types/selenium-webdriver/index.d.ts index bfd583302e..08b77d0ce1 100644 --- a/types/selenium-webdriver/index.d.ts +++ b/types/selenium-webdriver/index.d.ts @@ -241,7 +241,6 @@ export namespace error { } export namespace logging { - /** * A hash describing log preferences. * @typedef {Object.} @@ -268,7 +267,7 @@ export namespace logging { * Common log types. * @enum {string} */ - var Type: IType; + const Type: IType; /** * Defines a message level that may be used to control logging output. @@ -984,28 +983,22 @@ export namespace promise { */ constructor(resolver: (resolve: IFulfilledCallback, reject: IRejectedCallback) => void, opt_flow?: ControlFlow); - //region Static Methods + /** + * Creates a promise that is immediately resolved with the given value. + * + * @param {T=} opt_value The value to resolve. + * @return {!ManagedPromise} A promise resolved with the given value. + * @template T + */ + static resolve(opt_value?: T): Promise; - /** - * Creates a promise that is immediately resolved with the given value. - * - * @param {T=} opt_value The value to resolve. - * @return {!ManagedPromise} A promise resolved with the given value. - * @template T - */ - static resolve(opt_value?: T): Promise; - - /** - * Creates a promise that is immediately rejected with the given reason. - * - * @param {*=} opt_reason The rejection reason. - * @return {!ManagedPromise} A new rejected promise. - */ - static reject(opt_reason?: any): Promise; - - //endregion - - // region Methods + /** + * Creates a promise that is immediately rejected with the given reason. + * + * @param {*=} opt_reason The rejection reason. + * @return {!ManagedPromise} A new rejected promise. + */ + static reject(opt_reason?: any): Promise; /** * Registers listeners for when this instance is resolved. @@ -1046,9 +1039,6 @@ export namespace promise { * @template R */ catch(errback: (err: any) => R | IThenable): Promise; - - - // endregion } /** @@ -1124,10 +1114,10 @@ export namespace promise { } interface IControlFlowTimer { - clearInterval: (ms: number) => void; - clearTimeout: (ms: number) => void; - setInterval: (fn: Function, ms: number) => number; - setTimeout: (fn: Function, ms: number) => number; + clearInterval(ms: number): void; + clearTimeout(ms: number): void; + setInterval(fn: Function, ms: number): number; + setTimeout(fn: Function, ms: number): number; } interface IEventType { @@ -1314,7 +1304,6 @@ export class WebElementCondition extends Condition { } export namespace until { - /** * Creates a condition that will wait until the input driver is able to switch * to the designated frame. The target frame may be specified as @@ -1545,7 +1534,7 @@ interface IButton { * * @enum {string} */ -export var Button: IButton; +export const Button: IButton; interface IKey { NULL: string; @@ -1624,7 +1613,7 @@ interface IKey { * @param {...string} var_args The key sequence to concatenate. * @return {string} The null-terminated key sequence. */ - chord: (...var_args: Array) => string; + chord(...var_args: Array): string; } /** @@ -1634,7 +1623,7 @@ interface IKey { * * @enum {string} */ -export var Key: IKey; +export const Key: IKey; /** * Class for defining sequences of complex user interactions. Each sequence @@ -1652,7 +1641,6 @@ export var Key: IKey; * */ export class ActionSequence { - // region Constructors /** @@ -1827,7 +1815,6 @@ export class ActionSequence { // endregion } - /** * Class for defining sequences of user touch interactions. Each sequence * will not be executed until {@link #perform} is called. @@ -1847,7 +1834,6 @@ export class TouchSequence { */ constructor(driver: WebDriver); - /** * Executes this action sequence. * @return {!promise.Promise} A promise that will be resolved once @@ -1855,7 +1841,6 @@ export class TouchSequence { */ perform(): promise.Promise; - /** * Taps an element. * @@ -1864,7 +1849,6 @@ export class TouchSequence { */ tap(elem: WebElement): TouchSequence; - /** * Double taps an element. * @@ -1873,7 +1857,6 @@ export class TouchSequence { */ doubleTap(elem: WebElement): TouchSequence; - /** * Long press on an element. * @@ -1882,7 +1865,6 @@ export class TouchSequence { */ longPress(elem: WebElement): TouchSequence; - /** * Touch down at the given location. * @@ -1891,7 +1873,6 @@ export class TouchSequence { */ tapAndHold(location: ILocation): TouchSequence; - /** * Move a held {@linkplain #tapAndHold touch} to the specified location. * @@ -1900,7 +1881,6 @@ export class TouchSequence { */ move(location: ILocation): TouchSequence; - /** * Release a held {@linkplain #tapAndHold touch} at the specified location. * @@ -1909,7 +1889,6 @@ export class TouchSequence { */ release(location: ILocation): TouchSequence; - /** * Scrolls the touch screen by the given offset. * @@ -2019,7 +1998,6 @@ export class Alert { sendKeys(text: string): promise.Promise; // endregion - } /** @@ -2107,7 +2085,7 @@ interface IBrowser { HTMLUNIT: string; } -export var Browser: IBrowser; +export const Browser: IBrowser; interface ProxyConfig { proxyType: string; @@ -2116,9 +2094,9 @@ interface ProxyConfig { httpProxy?: string; sslProxy?: string; noProxy?: string; - socksProxy?: string, - socksUsername?: string, - socksPassword?: string + socksProxy?: string; + socksUsername?: string; + socksPassword?: string; } /** @@ -2161,7 +2139,6 @@ interface ProxyConfig { * node mytest.js */ export class Builder { - // region Constructors /** @@ -2399,7 +2376,6 @@ export class Builder { * @final */ export class By { - /** * @param {string} using the name of the location strategy to use. * @param {string} value the value to search for. @@ -2539,7 +2515,6 @@ type ByHash = { className: string } | * @enum {string} */ interface ICapability { - /** * Indicates whether a driver should accept all SSL certs by default. This * capability only applies when requesting a new session. To query whether @@ -2548,7 +2523,6 @@ interface ICapability { */ ACCEPT_SSL_CERTS: string; - /** * The browser name. Common browser names are defined in the * {@link Browser} enum. @@ -2628,7 +2602,7 @@ interface ICapability { VERSION: string; } -export var Capability: ICapability; +export const Capability: ICapability; export class Capabilities { // region Constructors @@ -2681,7 +2655,6 @@ export class Capabilities { */ setProxy(proxy: ProxyConfig): Capabilities; - /** * Sets whether native events should be used. * @param {boolean} enabled Whether to enable native events. @@ -2689,7 +2662,6 @@ export class Capabilities { */ setEnableNativeEvents(enabled: boolean): Capabilities; - /** * Sets how elements should be scrolled into view for interaction. * @param {number} behavior The desired scroll behavior: either 0 to align with @@ -2916,7 +2888,7 @@ interface ICommandName { UPLOAD_FILE: string; } -export var CommandName: ICommandName; +export const CommandName: ICommandName; /** * Describes a command to be executed by the WebDriverJS framework. @@ -3046,7 +3018,6 @@ export class EventEmitter { */ addListener(type: string, fn: Function, opt_scope?: any, opt_oneshot?: boolean): EventEmitter; - /** * Registers a one-time listener which will be called only the first time an * event is emitted, after which it will be removed. @@ -3085,7 +3056,6 @@ export class EventEmitter { // endregion } - /** * Interface for navigating back and forth in the browser history. */ @@ -3141,7 +3111,6 @@ export class Navigation { } interface IWebDriverOptionsCookie { - /** * The name of the cookie. */ @@ -3199,7 +3168,7 @@ interface IWebDriverOptionsCookie { * * @type {(!number|undefined)} */ - expiry?: number + expiry?: number; } /** @@ -3354,7 +3323,6 @@ export class Timeouts { * An interface for managing the current window. */ export class Window { - // region Constructors /** @@ -3417,7 +3385,6 @@ export class Window { * Interface for managing WebDriver log records. */ export class Logs { - // region Constructors /** @@ -3460,7 +3427,6 @@ export class Logs { * An interface for changing the focus of the driver to another frame or window. */ export class TargetLocator { - // region Constructors /** @@ -3576,7 +3542,7 @@ export class FileDetector { type CreateSessionCapabilities = Capabilities | { desired?: Capabilities, required?: Capabilities - } + }; /** * Creates a new WebDriver client, which provides control over a browser. @@ -3708,7 +3674,6 @@ export class WebDriver { */ schedule(command: Command, description: string): promise.Promise; - /** * Sets the {@linkplain input.FileDetector file detector} that should be * used with this instance. @@ -3716,21 +3681,18 @@ export class WebDriver { */ setFileDetector(detector: FileDetector): void; - /** * @return {!promise.Promise.} A promise for this * client's session. */ getSession(): promise.Promise; - /** * @return {!promise.Promise.} A promise * that will resolve with the this instance's capabilities. */ getCapabilities(): promise.Promise; - /** * Schedules a command to quit the current session. After calling quit, this * instance will be invalidated and may no longer be used to issue commands @@ -3755,7 +3717,6 @@ export class WebDriver { */ actions(): ActionSequence; - /** * Creates a new touch sequence using this driver. The sequence will not be * scheduled for execution until {@link actions.TouchSequence#perform} is @@ -3770,7 +3731,6 @@ export class WebDriver { */ touchActions(): TouchSequence; - /** * Schedules a command to execute JavaScript in the context of the currently * selected frame or window. The script fragment will be executed as the body @@ -4842,7 +4802,6 @@ export class WebElementPromise extends WebElement implements promise.IThenable(opt_callback?: (value: WebElement) => R, opt_errback?: (error: any) => any): promise.Promise; - /** * Registers a listener for when this promise is rejected. This is synonymous * with the {@code catch} clause in a synchronous API: @@ -4873,7 +4832,6 @@ export class WebElementPromise extends WebElement implements promise.IThenable; } -export module DriverService { - +export namespace DriverService { /** * Creates {@link DriverService} objects that manage a WebDriver server in a * child process. */ - export class Builder { + 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. @@ -90,7 +89,6 @@ export module DriverService { */ addArguments(...var_args: string[]): this; - /** * Sets the host name to access the server on. If specified, the * {@linkplain #setLoopback() loopback} setting will be ignored. @@ -119,7 +117,6 @@ export module DriverService { */ setPath(basePath: string | null): this; - /** * Sets the port to start the server on. * diff --git a/types/selenium-webdriver/test/chrome.ts b/types/selenium-webdriver/test/chrome.ts index b26c43c2d6..a40afe854e 100644 --- a/types/selenium-webdriver/test/chrome.ts +++ b/types/selenium-webdriver/test/chrome.ts @@ -3,17 +3,17 @@ import * as remote from 'selenium-webdriver/remote'; import * as webdriver from 'selenium-webdriver'; function TestChromeDriver() { - var driver: chrome.Driver = chrome.Driver.createSession(); + let driver: chrome.Driver = chrome.Driver.createSession(); driver = chrome.Driver.createSession(webdriver.Capabilities.chrome()); driver = chrome.Driver.createSession(webdriver.Capabilities.chrome(), new remote.DriverService('executable', new chrome.Options()), new webdriver.promise.ControlFlow()); - var baseDriver: webdriver.WebDriver = driver; + let baseDriver: webdriver.WebDriver = driver; } function TestChromeOptions() { - var options: chrome.Options = new chrome.Options(); + let options: chrome.Options = new chrome.Options(); options = chrome.Options.fromCapabilities(webdriver.Capabilities.chrome()); options = options.addArguments('a', 'b', 'c'); @@ -35,15 +35,15 @@ function TestChromeOptions() { tracingCategories: 'category', bufferUsageReportingInterval: 1000 }); options = options.setProxy({ proxyType: 'proxyType' }); options = options.setUserPreferences('preferences'); - var capabilities: webdriver.Capabilities = options.toCapabilities(); + let capabilities: webdriver.Capabilities = options.toCapabilities(); capabilities = options.toCapabilities(webdriver.Capabilities.chrome()); } function TestServiceBuilder() { - var builder: chrome.ServiceBuilder = new chrome.ServiceBuilder(); + let builder: chrome.ServiceBuilder = new chrome.ServiceBuilder(); builder = new chrome.ServiceBuilder('exe'); - var anything: any = builder.build(); + let anything: any = builder.build(); builder = builder.setPort(8080); builder = builder.setAdbPort(5037); builder = builder.loggingTo('path'); @@ -52,10 +52,10 @@ function TestServiceBuilder() { builder = builder.setPath('path'); builder = builder.setStdio('config'); builder = builder.setStdio(['A', 'B']); - builder = builder.setEnvironment({ 'A': 'a', 'B': 'b' }); + builder = builder.setEnvironment({ A: 'a', B: 'b' }); } function TestChromeModule() { - var service: any = chrome.getDefaultService(); + let service: any = chrome.getDefaultService(); chrome.setDefaultService(new remote.DriverService('executable', new chrome.Options())); } diff --git a/types/selenium-webdriver/test/firefox.ts b/types/selenium-webdriver/test/firefox.ts index 38a3c3634e..0a8cabda41 100644 --- a/types/selenium-webdriver/test/firefox.ts +++ b/types/selenium-webdriver/test/firefox.ts @@ -4,26 +4,26 @@ import * as webdriver from 'selenium-webdriver'; import * as http from 'selenium-webdriver/http'; function TestBinary() { - var binary: firefox.Binary = new firefox.Binary(); + let binary: firefox.Binary = new firefox.Binary(); binary = new firefox.Binary('exe'); binary.addArguments('A', 'B', 'C'); - var promise: webdriver.promise.Promise = binary.kill(); + let promise: webdriver.promise.Promise = binary.kill(); binary.launch('profile').then((result: any) => {}); } function TestFirefoxDriver() { - var driver: firefox.Driver = firefox.Driver.createSession(); + let driver: firefox.Driver = firefox.Driver.createSession(); driver = firefox.Driver.createSession(webdriver.Capabilities.firefox()); driver = firefox.Driver.createSession(webdriver.Capabilities.firefox(), new http.Executor(new http.HttpClient('http://someurl'))); driver = firefox.Driver.createSession(webdriver.Capabilities.firefox(), new remote.DriverService('/dev/null', {})); driver = firefox.Driver.createSession(webdriver.Capabilities.firefox(), new remote.DriverService('/dev/null', {}), new webdriver.promise.ControlFlow()); - var baseDriver: webdriver.WebDriver = driver; + let baseDriver: webdriver.WebDriver = driver; } function TestFirefoxOptions() { - var options: firefox.Options = new firefox.Options(); + let options: firefox.Options = new firefox.Options(); options = options.setBinary('binary'); options = options.setBinary(new firefox.Binary()); @@ -31,19 +31,19 @@ function TestFirefoxOptions() { options = options.setProfile('profile'); options = options.setProfile(new firefox.Profile()); options = options.setProxy({ proxyType: 'proxy' }); - var capabilities: webdriver.Capabilities = options.toCapabilities(); + let capabilities: webdriver.Capabilities = options.toCapabilities(); } function TestFirefoxProfile() { - var profile: firefox.Profile = new firefox.Profile(); + let profile: firefox.Profile = new firefox.Profile(); profile = new firefox.Profile('dir'); - var bool: boolean = profile.acceptUntrustedCerts(); + let bool: boolean = profile.acceptUntrustedCerts(); profile.addExtension('ext'); bool = profile.assumeUntrustedCertIssuer(); profile.encode().then((prof: string) => {}); - var num: number = profile.getPort(); - var anything: any = profile.getPreference('key'); + let num: number = profile.getPort(); + let anything: any = profile.getPreference('key'); bool = profile.nativeEventsEnabled(); profile.setAcceptUntrustedCerts(true); profile.setAssumeUntrustedCertIssuer(true); @@ -52,16 +52,15 @@ function TestFirefoxProfile() { profile.setPreference('key', 'value'); profile.setPreference('key', 5); profile.setPreference('key', true); - var stringPromise: webdriver.promise.Promise = profile.writeToDisk(); + let stringPromise: webdriver.promise.Promise = profile.writeToDisk(); stringPromise = profile.writeToDisk(true); } - function TestServiceBuilder() { - var builder: firefox.ServiceBuilder = new firefox.ServiceBuilder(); + let builder: firefox.ServiceBuilder = new firefox.ServiceBuilder(); builder = new firefox.ServiceBuilder('exe'); - var anything: any = builder.build(); + let anything: any = builder.build(); builder = builder.setPort(8080); builder = builder.enableVerboseLogging(); builder = builder.enableVerboseLogging(true); @@ -70,5 +69,5 @@ function TestServiceBuilder() { builder = builder.setPath('path'); builder = builder.setStdio('config'); builder = builder.setStdio(['A', 'B']); - builder = builder.setEnvironment({ 'A': 'a', 'B': 'b' }); + builder = builder.setEnvironment({ A: 'a', B: 'b' }); } diff --git a/types/selenium-webdriver/test/index.ts b/types/selenium-webdriver/test/index.ts index 2556e7e2a8..5d4f8e8b4e 100644 --- a/types/selenium-webdriver/test/index.ts +++ b/types/selenium-webdriver/test/index.ts @@ -6,15 +6,15 @@ import * as remote from 'selenium-webdriver/remote'; import * as testing from 'selenium-webdriver/testing'; function TestBuilder() { - var builder: webdriver.Builder = new webdriver.Builder(); + let builder: webdriver.Builder = new webdriver.Builder(); - var driver: webdriver.WebDriver = builder.build(); + let driver: webdriver.WebDriver = builder.build(); builder = builder.forBrowser('name'); builder = builder.forBrowser('name', 'version'); builder = builder.forBrowser('name', 'version', 'platform'); - var cap: webdriver.Capabilities = builder.getCapabilities(); - var str: string = builder.getServerUrl(); + let cap: webdriver.Capabilities = builder.getCapabilities(); + let str: string = builder.getServerUrl(); builder = builder.setAlertBehavior('behavior'); builder = builder.setChromeOptions(new chrome.Options()); @@ -31,13 +31,13 @@ function TestBuilder() { } function TestActionSequence() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var sequence: webdriver.ActionSequence = new webdriver.ActionSequence(driver); - var element: webdriver.WebElement = new webdriver.WebElement(driver, 'elementId'); - var promise: webdriver.promise.Promise; + let sequence: webdriver.ActionSequence = new webdriver.ActionSequence(driver); + let element: webdriver.WebElement = new webdriver.WebElement(driver, 'elementId'); + let promise: webdriver.promise.Promise; element = new webdriver.WebElement(driver, promise); // Click @@ -87,12 +87,12 @@ function TestActionSequence() { } function TestTouchSequence() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var element: webdriver.WebElement = new webdriver.WebElement(driver, 'elementId'); + let element: webdriver.WebElement = new webdriver.WebElement(driver, 'elementId'); - var sequence: webdriver.TouchSequence = new webdriver.TouchSequence(driver); + let sequence: webdriver.TouchSequence = new webdriver.TouchSequence(driver); sequence = sequence.tap(element); sequence = sequence.doubleTap(element); @@ -109,11 +109,11 @@ function TestTouchSequence() { } function TestAlert() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var alert: webdriver.Alert = driver.switchTo().alert(); + let alert: webdriver.Alert = driver.switchTo().alert(); alert.accept().then(() => {}); alert.dismiss().then(() => {}); @@ -122,7 +122,7 @@ function TestAlert() { } function TestBrowser() { - var browser: string; + let browser: string; browser = webdriver.Browser.ANDROID; browser = webdriver.Browser.CHROME; @@ -137,7 +137,7 @@ function TestBrowser() { } function TestButton() { - var button: string; + let button: string; button = webdriver.Button.LEFT; button = webdriver.Button.MIDDLE; @@ -145,14 +145,14 @@ function TestButton() { } function TestCapabilities() { - var capabilities: webdriver.Capabilities = new webdriver.Capabilities(); + let capabilities: webdriver.Capabilities = new webdriver.Capabilities(); capabilities = new webdriver.Capabilities(webdriver.Capabilities.chrome()); - var objCapabilities: any = {}; + let objCapabilities: any = {}; objCapabilities[webdriver.Capability.BROWSER_NAME] = webdriver.Browser.PHANTOM_JS; capabilities = new webdriver.Capabilities(objCapabilities); - var anything: any = capabilities.get(webdriver.Capability.SECURE_SSL); - var check: boolean = capabilities.has(webdriver.Capability.SECURE_SSL); + let anything: any = capabilities.get(webdriver.Capability.SECURE_SSL); + let check: boolean = capabilities.has(webdriver.Capability.SECURE_SSL); capabilities = capabilities.merge(capabilities); capabilities = capabilities.merge(objCapabilities); capabilities = capabilities.set(webdriver.Capability.VERSION, { abc: 'def' }); @@ -180,7 +180,7 @@ function TestCapabilities() { } function TestCapability() { - var capability: string; + let capability: string; capability = webdriver.Capability.ACCEPT_SSL_CERTS; capability = webdriver.Capability.BROWSER_NAME; @@ -202,19 +202,19 @@ function TestCapability() { } function TestCommand() { - var command: webdriver.Command = new webdriver.Command(webdriver.CommandName.ADD_COOKIE); + let command: webdriver.Command = new webdriver.Command(webdriver.CommandName.ADD_COOKIE); - var name: string = command.getName(); - var param: any = command.getParameter('param'); + let name: string = command.getName(); + let param: any = command.getParameter('param'); - var params: any = command.getParameters(); + let params: any = command.getParameters(); command = command.setParameter('param', 123); command = command.setParameters({ param: 123 }); } function TestCommandName() { - var command: string; + let command: string; command = webdriver.CommandName.ACCEPT_ALERT; command = webdriver.CommandName.ADD_COOKIE; @@ -315,21 +315,21 @@ function TestCommandName() { } function TestEventEmitter() { - var emitter: webdriver.EventEmitter = new webdriver.EventEmitter(); + let emitter: webdriver.EventEmitter = new webdriver.EventEmitter(); - var callback = (a: number, b: number, c: number) => {}; + let callback = (a: number, b: number, c: number) => {}; emitter = emitter.addListener('ABC', callback); emitter = emitter.addListener('ABC', callback, this); emitter.emit('ABC', 1, 2, 3); - var listeners = emitter.listeners('ABC'); + let listeners = emitter.listeners('ABC'); if (listeners[0].oneshot) { listeners[0].fn.apply(listeners[0].scope); } - var length: number = listeners.length; - var listenerInfo = listeners[0]; + let length: number = listeners.length; + let listenerInfo = listeners[0]; if (listenerInfo.oneshot) { listenerInfo.fn.apply(listenerInfo.scope, [1, 2, 3]); } @@ -347,7 +347,7 @@ function TestEventEmitter() { } function TestKey() { - var key: string; + let key: string; key = webdriver.Key.ADD; key = webdriver.Key.ALT; @@ -412,13 +412,13 @@ function TestKey() { } function TestBy() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var locator: webdriver.By = new webdriver.By('class name', 'class'); + let locator: webdriver.By = new webdriver.By('class name', 'class'); - var str: string = locator.toString(); + let str: string = locator.toString(); locator = webdriver.By.className('class'); locator = webdriver.By.css('css'); @@ -430,9 +430,9 @@ function TestBy() { locator = webdriver.By.xpath('xpath'); // Can import 'By' without import declarations - var By = webdriver.By; + let By = webdriver.By; - var locatorHash: webdriver.ByHash; + let locatorHash: webdriver.ByHash; locatorHash = { className: 'class' }; locatorHash = { css: 'css' }; locatorHash = { id: 'id' }; @@ -446,45 +446,45 @@ function TestBy() { } function TestSession() { - var session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android()); - var capabilitiesObj: any = {}; + let session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android()); + let capabilitiesObj: any = {}; capabilitiesObj[webdriver.Capability.BROWSER_NAME] = webdriver.Browser.ANDROID; capabilitiesObj[webdriver.Capability.PLATFORM] = 'ANDROID'; session = new webdriver.Session('ABC', capabilitiesObj); - var capabilities: webdriver.Capabilities = session.getCapabilities(); - var capability: any = session.getCapability(webdriver.Capability.BROWSER_NAME); - var id: string = session.getId(); - var data: string = session.toJSON(); + let capabilities: webdriver.Capabilities = session.getCapabilities(); + let capability: any = session.getCapability(webdriver.Capability.BROWSER_NAME); + let id: string = session.getId(); + let data: string = session.toJSON(); } function TestWebDriverFileDetector() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var fileDetector: webdriver.FileDetector = new webdriver.FileDetector(); + let fileDetector: webdriver.FileDetector = new webdriver.FileDetector(); fileDetector.handleFile(driver, 'path/to/file').then((path: string) => {}); } function TestWebDriverLogs() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var logs: webdriver.Logs = new webdriver.Logs(driver); + let logs: webdriver.Logs = new webdriver.Logs(driver); logs.get(webdriver.logging.Type.BROWSER).then((entries: webdriver.logging.Entry[]) => {}); logs.getAvailableLogTypes().then((types: string[]) => {}); } function TestWebDriverNavigation() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var navigation: webdriver.Navigation = new webdriver.Navigation(driver); + let navigation: webdriver.Navigation = new webdriver.Navigation(driver); navigation.back().then(() => {}); navigation.forward().then(() => {}); @@ -493,19 +493,19 @@ function TestWebDriverNavigation() { } function TestWebDriverOptions() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var options: webdriver.Options = new webdriver.Options(driver); - var promise: webdriver.promise.Promise; + let options: webdriver.Options = new webdriver.Options(driver); + let promise: webdriver.promise.Promise; - var name: string = 'name'; - var value: string = 'value'; - var path: string = 'path'; - var domain: string = 'domain'; - var secure: boolean = true; - var httpOnly: boolean = true; + let name: string = 'name'; + let value: string = 'value'; + let path: string = 'path'; + let domain: string = 'domain'; + let secure: boolean = true; + let httpOnly: boolean = true; // Add Cookie promise = options.addCookie({ name, value }); @@ -519,37 +519,37 @@ function TestWebDriverOptions() { promise = options.deleteAllCookies(); promise = options.deleteCookie('name'); options.getCookie('name').then((cookie: webdriver.IWebDriverCookie) => { - var expiry: number = cookie.expiry; + let expiry: number = cookie.expiry; }); options.getCookies().then((cookies: webdriver.IWebDriverCookie[]) => { }); - var logs: webdriver.Logs = options.logs(); - var timeouts: webdriver.Timeouts = options.timeouts(); - var window: webdriver.Window = options.window(); + let logs: webdriver.Logs = options.logs(); + let timeouts: webdriver.Timeouts = options.timeouts(); + let window: webdriver.Window = options.window(); } function TestWebDriverTargetLocator() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var locator: webdriver.TargetLocator = new webdriver.TargetLocator(driver); - var promise: webdriver.promise.Promise; + let locator: webdriver.TargetLocator = new webdriver.TargetLocator(driver); + let promise: webdriver.promise.Promise; - var element: webdriver.WebElement = locator.activeElement(); - var alert: webdriver.Alert = locator.alert(); + let element: webdriver.WebElement = locator.activeElement(); + let alert: webdriver.Alert = locator.alert(); promise = locator.defaultContent(); promise = locator.frame(1); promise = locator.window('nameOrHandle'); } function TestWebDriverTimeouts() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var timeouts: webdriver.Timeouts = new webdriver.Timeouts(driver); - var promise: webdriver.promise.Promise; + let timeouts: webdriver.Timeouts = new webdriver.Timeouts(driver); + let promise: webdriver.promise.Promise; promise = timeouts.implicitlyWait(123); promise = timeouts.pageLoadTimeout(123); @@ -557,14 +557,14 @@ function TestWebDriverTimeouts() { } function TestWebDriverWindow() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var window: webdriver.Window = new webdriver.Window(driver); - var locationPromise: webdriver.promise.Promise; - var sizePromise: webdriver.promise.Promise; - var voidPromise: webdriver.promise.Promise; + let window: webdriver.Window = new webdriver.Window(driver); + let locationPromise: webdriver.promise.Promise; + let sizePromise: webdriver.promise.Promise; + let voidPromise: webdriver.promise.Promise; locationPromise = window.getPosition(); sizePromise = window.getSize(); @@ -574,28 +574,28 @@ function TestWebDriverWindow() { } function TestWebDriver() { - var session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android()); - var sessionPromise: webdriver.promise.Promise; - var httpClient: http.HttpClient = new http.HttpClient('http://someserver'); - var executor: http.Executor = new http.Executor(httpClient); - var flow: webdriver.promise.ControlFlow = new webdriver.promise.ControlFlow(); - var driver: webdriver.WebDriver = new webdriver.WebDriver(session, executor); + let session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android()); + let sessionPromise: webdriver.promise.Promise; + let httpClient: http.HttpClient = new http.HttpClient('http://someserver'); + let executor: http.Executor = new http.Executor(httpClient); + let flow: webdriver.promise.ControlFlow = new webdriver.promise.ControlFlow(); + let driver: webdriver.WebDriver = new webdriver.WebDriver(session, executor); driver = new webdriver.WebDriver(session, executor, flow); driver = new webdriver.WebDriver(sessionPromise, executor); driver = new webdriver.WebDriver(sessionPromise, executor, flow); - var voidPromise: webdriver.promise.Promise; - var stringPromise: webdriver.promise.Promise; - var booleanPromise: webdriver.promise.Promise; - var webElementPromise: webdriver.WebElementPromise; + let voidPromise: webdriver.promise.Promise; + let stringPromise: webdriver.promise.Promise; + let booleanPromise: webdriver.promise.Promise; + let webElementPromise: webdriver.WebElementPromise; - var actions: webdriver.ActionSequence = driver.actions(); - var touchActions: webdriver.TouchSequence = driver.touchActions(); + let actions: webdriver.ActionSequence = driver.actions(); + let touchActions: webdriver.TouchSequence = driver.touchActions(); // call stringPromise = driver.call(() => 'value'); stringPromise = driver.call(() => stringPromise); - stringPromise = driver.call(() => { var d: any = this; return 'value'; }, driver); + stringPromise = driver.call(() => { let d: any = this; return 'value'; }, driver); stringPromise = driver.call((a: number) => 'value', driver, 1); voidPromise = driver.close(); @@ -614,7 +614,7 @@ function TestWebDriver() { stringPromise = driver.executeScript((a: number) => {}, 1); // findElement - var element: webdriver.WebElement; + let element: webdriver.WebElement; element = driver.findElement(webdriver.By.id('ABC')); element = driver.findElement(webdriver.By.js('function(){}')); @@ -631,11 +631,11 @@ function TestWebDriver() { stringPromise = driver.getTitle(); stringPromise = driver.getWindowHandle(); - var options: webdriver.Options = driver.manage(); - var navigation: webdriver.Navigation = driver.navigate(); - var locator: webdriver.TargetLocator = driver.switchTo(); + let options: webdriver.Options = driver.manage(); + let navigation: webdriver.Navigation = driver.navigate(); + let locator: webdriver.TargetLocator = driver.switchTo(); - var fileDetector: webdriver.FileDetector = new webdriver.FileDetector(); + let fileDetector: webdriver.FileDetector = new webdriver.FileDetector(); driver.setFileDetector(fileDetector); voidPromise = driver.quit(); @@ -643,7 +643,7 @@ function TestWebDriver() { voidPromise = driver.sleep(123); stringPromise = driver.takeScreenshot(); - var booleanCondition: webdriver.Condition; + let booleanCondition: webdriver.Condition; booleanPromise = driver.wait(booleanPromise); booleanPromise = driver.wait(booleanCondition); booleanPromise = driver.wait((driver: webdriver.WebDriver) => true); @@ -660,24 +660,24 @@ function TestWebDriver() { } function TestSerializable() { - var serializable: webdriver.Serializable; - var serial: string | webdriver.promise.IThenable = serializable.serialize(); + let serializable: webdriver.Serializable; + let serial: string | webdriver.promise.IThenable = serializable.serialize(); } function TestWebElement() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var promise: webdriver.promise.Promise; - var element: webdriver.WebElement; + let promise: webdriver.promise.Promise; + let element: webdriver.WebElement; element = new webdriver.WebElement(driver, 'elementId'); element = new webdriver.WebElement(driver, promise); - var voidPromise: webdriver.promise.Promise; - var stringPromise: webdriver.promise.Promise; - var booleanPromise: webdriver.promise.Promise; + let voidPromise: webdriver.promise.Promise; + let stringPromise: webdriver.promise.Promise; + let booleanPromise: webdriver.promise.Promise; voidPromise = element.clear(); voidPromise = element.click(); @@ -709,11 +709,11 @@ function TestWebElement() { } function TestWebElementPromise() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var elementPromise: webdriver.WebElementPromise = driver.findElement(webdriver.By.id('id')); + let elementPromise: webdriver.WebElementPromise = driver.findElement(webdriver.By.id('id')); elementPromise.then(); elementPromise.then((element: webdriver.WebElement) => {}); @@ -722,11 +722,11 @@ function TestWebElementPromise() { } function TestLogging() { - var preferences: webdriver.logging.Preferences = new webdriver.logging.Preferences(); + let preferences: webdriver.logging.Preferences = new webdriver.logging.Preferences(); preferences.setLevel(webdriver.logging.Type.BROWSER, webdriver.logging.Level.ALL); - var prefs: any = preferences.toJSON(); + let prefs: any = preferences.toJSON(); - var level: webdriver.logging.Level = webdriver.logging.getLevel('OFF'); + let level: webdriver.logging.Level = webdriver.logging.getLevel('OFF'); level = webdriver.logging.getLevel(1); level = webdriver.logging.Level.ALL; @@ -736,10 +736,10 @@ function TestLogging() { level = webdriver.logging.Level.SEVERE; level = webdriver.logging.Level.WARNING; - var name: string = level.name; - var value: number = level.value; + let name: string = level.name; + let value: number = level.value; - var type: string; + let type: string; type = webdriver.logging.Type.BROWSER; type = webdriver.logging.Type.CLIENT; type = webdriver.logging.Type.DRIVER; @@ -748,7 +748,7 @@ function TestLogging() { } function TestLoggingEntry() { - var entry: webdriver.logging.Entry; + let entry: webdriver.logging.Entry; entry = new webdriver.logging.Entry(webdriver.logging.Level.ALL, 'ABC'); entry = new webdriver.logging.Entry('ALL', 'ABC'); @@ -757,23 +757,23 @@ function TestLoggingEntry() { entry = new webdriver.logging.Entry(webdriver.logging.Level.ALL, 'ABC', 123, webdriver.logging.Type.BROWSER); entry = new webdriver.logging.Entry('ALL', 'ABC', 123, webdriver.logging.Type.BROWSER); - var entryObj: any = entry.toJSON(); + let entryObj: any = entry.toJSON(); - var message: string = entry.message; - var timestamp: number = entry.timestamp; - var type: string = entry.type; + let message: string = entry.message; + let timestamp: number = entry.timestamp; + let type: string = entry.type; } function TestPromiseModule() { - var cancellationError: webdriver.promise.CancellationError = new webdriver.promise.CancellationError(); + let cancellationError: webdriver.promise.CancellationError = new webdriver.promise.CancellationError(); cancellationError = new webdriver.promise.CancellationError('message'); - var str: string = cancellationError.message; + let str: string = cancellationError.message; str = cancellationError.name; - var stringPromise: webdriver.promise.Promise; - var numberPromise: webdriver.promise.Promise; - var booleanPromise: webdriver.promise.Promise; - var voidPromise: webdriver.promise.Promise; + let stringPromise: webdriver.promise.Promise; + let numberPromise: webdriver.promise.Promise; + let booleanPromise: webdriver.promise.Promise; + let voidPromise: webdriver.promise.Promise; webdriver.promise.all([stringPromise]).then((values: string[]) => {}); @@ -791,7 +791,7 @@ function TestPromiseModule() { webdriver.promise.consume((a: number, b: number, c: number) => 5, this, 1, 2, 3) .then((value: number) => {}); - var numbersPromise: webdriver.promise.Promise = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => { + let numbersPromise: webdriver.promise.Promise = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => { return true; }); numbersPromise = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => { @@ -817,11 +817,11 @@ function TestPromiseModule() { return true; }, this); - var flow: webdriver.promise.ControlFlow = webdriver.promise.controlFlow(); + let flow: webdriver.promise.ControlFlow = webdriver.promise.controlFlow(); stringPromise = webdriver.promise.createFlow((newFlow: webdriver.promise.ControlFlow) => 'ABC'); - var deferred: webdriver.promise.Deferred; + let deferred: webdriver.promise.Deferred; deferred = webdriver.promise.defer(); deferred = webdriver.promise.defer(); @@ -837,8 +837,8 @@ function TestPromiseModule() { stringPromise = webdriver.promise.fullyResolved('abc'); - var bool: boolean = webdriver.promise.isGenerator(() => {}); - var isPromise: boolean = webdriver.promise.isPromise('ABC'); + let bool: boolean = webdriver.promise.isGenerator(() => {}); + let isPromise: boolean = webdriver.promise.isPromise('ABC'); stringPromise = webdriver.promise.rejected('{a: 123}'); @@ -848,18 +848,18 @@ function TestPromiseModule() { } function TestUntilModule() { - var driver: webdriver.WebDriver = new webdriver.Builder(). + let driver: webdriver.WebDriver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); - var conditionB: webdriver.Condition = new webdriver.Condition('message', (driver: webdriver.WebDriver) => true); - var conditionBBase: webdriver.Condition = conditionB; - var conditionWebElement: webdriver.WebElementCondition; - var conditionWebElements: webdriver.Condition; + let conditionB: webdriver.Condition = new webdriver.Condition('message', (driver: webdriver.WebDriver) => true); + let conditionBBase: webdriver.Condition = conditionB; + let conditionWebElement: webdriver.WebElementCondition; + let conditionWebElements: webdriver.Condition; conditionB = webdriver.until.ableToSwitchToFrame(5); - var conditionAlert: webdriver.Condition = webdriver.until.alertIsPresent(); - var el: webdriver.WebElement = driver.findElement(webdriver.By.id('id')); + let conditionAlert: webdriver.Condition = webdriver.until.alertIsPresent(); + let el: webdriver.WebElement = driver.findElement(webdriver.By.id('id')); conditionB = webdriver.until.stalenessOf(el); conditionB = webdriver.until.titleContains('text'); conditionB = webdriver.until.titleIs('text'); @@ -882,31 +882,31 @@ function TestUntilModule() { } function TestControlFlow() { - var flow: webdriver.promise.ControlFlow; + let flow: webdriver.promise.ControlFlow; flow = new webdriver.promise.ControlFlow(); - var emitter: webdriver.EventEmitter = flow; + let emitter: webdriver.EventEmitter = flow; - var eventType: string; + let eventType: string; eventType = webdriver.promise.ControlFlow.EventType.IDLE; eventType = webdriver.promise.ControlFlow.EventType.RESET; eventType = webdriver.promise.ControlFlow.EventType.SCHEDULE_TASK; eventType = webdriver.promise.ControlFlow.EventType.UNCAUGHT_EXCEPTION; - var stringPromise: webdriver.promise.Promise; + let stringPromise: webdriver.promise.Promise; stringPromise = flow.execute(() => 'value'); stringPromise = flow.execute(() => stringPromise); stringPromise = flow.execute(() => stringPromise, 'Description'); - var schedule: string; + let schedule: string; schedule = flow.toString(); schedule = flow.getSchedule(); schedule = flow.getSchedule(true); flow.reset(); - var voidPromise: webdriver.promise.Promise = flow.timeout(123); + let voidPromise: webdriver.promise.Promise = flow.timeout(123); voidPromise = flow.timeout(123, 'Description'); stringPromise = flow.wait(stringPromise); @@ -917,12 +917,12 @@ function TestControlFlow() { } function TestDeferred() { - var deferred: webdriver.promise.Deferred; + let deferred: webdriver.promise.Deferred; deferred = new webdriver.promise.Deferred(); deferred = new webdriver.promise.Deferred(new webdriver.promise.ControlFlow()); - var promise: webdriver.promise.Promise = deferred.promise; + let promise: webdriver.promise.Promise = deferred.promise; deferred.errback(new Error('Error')); deferred.errback('Error'); @@ -933,8 +933,8 @@ function TestDeferred() { } function TestPromiseClass() { - var controlFlow: webdriver.promise.ControlFlow; - var promise: webdriver.promise.Promise; + let controlFlow: webdriver.promise.ControlFlow; + let promise: webdriver.promise.Promise; promise = new webdriver.promise.Promise((resolve: (value: string) => void, reject: () => void) => {}); promise = new webdriver.promise.Promise((resolve: (value: webdriver.promise.Promise) => void, reject: () => void) => {}); promise = new webdriver.promise.Promise((resolve: (value: string) => void, reject: () => void) => {}, controlFlow); @@ -946,7 +946,7 @@ function TestPromiseClass() { } function TestThenableClass() { - var thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => { + let thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => { resolve('a'); }); @@ -956,8 +956,8 @@ function TestThenableClass() { } async function TestAsyncAwaitable() { - var thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => resolve('foo')); - var str: string = await thenable; + let thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => resolve('foo')); + let str: string = await thenable; } function TestTestingModule() { @@ -973,7 +973,6 @@ function TestTestingModule() { testing.iit('My exclusive test.', () => { }); - }); testing.xdescribe('My disabled suite', () => {