From 5a929e7ecaf2a2192eaf4bd462bd57c49a06d680 Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Fri, 2 Sep 2016 13:02:51 -0700 Subject: [PATCH] chore(types): clean up TypeScript support - fix exampleTypescript to have noGlobals - change the exampleTypescript tsconfig.json to include @types - alias promise as wdpromise everywhere - refactor gulpfile task 'types' to use multiple files from tsc - add browser method types applied from webdriver this closes #3430, closes #3477, and closes #3500 --- exampleTypescript/.gitignore | 1 + exampleTypescript/conf.ts | 6 ++- exampleTypescript/tsconfig.json | 3 +- gulpfile.js | 85 +++++---------------------------- lib/browser.ts | 57 ++++++++++++++++------ lib/element.ts | 84 ++++++++++++++++---------------- lib/globals.d.ts | 17 +------ lib/locators.ts | 30 ++++++------ 8 files changed, 120 insertions(+), 163 deletions(-) diff --git a/exampleTypescript/.gitignore b/exampleTypescript/.gitignore index 06f62bf6a..5ac933889 100644 --- a/exampleTypescript/.gitignore +++ b/exampleTypescript/.gitignore @@ -1,2 +1,3 @@ *.js node_modules +tmp/ diff --git a/exampleTypescript/conf.ts b/exampleTypescript/conf.ts index ac4757e70..42f6ffa6c 100644 --- a/exampleTypescript/conf.ts +++ b/exampleTypescript/conf.ts @@ -16,5 +16,9 @@ export let config: Config = { browserName: 'chrome' }, specs: [ 'spec.js' ], - seleniumAddress: 'http://localhost:4444/wd/hub' + seleniumAddress: 'http://localhost:4444/wd/hub', + + // You could set no globals to true to avoid jQuery '$' and protractor '$' + // collisions on the global namespace. + noGlobals: true }; diff --git a/exampleTypescript/tsconfig.json b/exampleTypescript/tsconfig.json index 8b088c60e..aa7469576 100644 --- a/exampleTypescript/tsconfig.json +++ b/exampleTypescript/tsconfig.json @@ -6,7 +6,8 @@ "sourceMap": false, "declaration": false, "noImplicitAny": false, - "outDir": "tmp" + "outDir": "tmp", + "types": ["node", "jasmine"] }, "exclude": [ "node_modules", diff --git a/gulpfile.js b/gulpfile.js index d945de1b4..b79b0553e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,7 +33,7 @@ var runSpawn = function(done, task, opt_arg, opt_io) { }; gulp.task('built:copy', function() { - return gulp.src(['lib/**/*','!lib/**/*.ts']) + return gulp.src(['lib/**/*.js','lib/globals.d.ts']) .pipe(gulp.dest('built/')); }); @@ -72,91 +72,28 @@ gulp.task('tsc:globals', function(done) { gulp.task('prepublish', function(done) { runSequence(['jshint', 'format'], 'tsc', 'tsc:globals', 'types', - 'ambient', 'built:copy', done); + 'built:copy', done); }); gulp.task('pretest', function(done) { runSequence( ['webdriver:update', 'jshint', 'format'], 'tsc', 'tsc:globals', - 'types', 'ambient', 'built:copy', done); + 'types', 'built:copy', done); }); gulp.task('default',['prepublish']); gulp.task('types', function(done) { - var folder = 'built'; - var files = ['browser', 'element', 'locators', 'expectedConditions', - 'config', 'plugins', 'ptor']; - var outputFile = path.resolve(folder, 'index.d.ts'); + var outputFile = path.resolve('built', 'index.d.ts'); var contents = ''; - contents += '/// \n'; - contents += '/// \n'; contents += '/// \n'; - contents += 'import {ActionSequence, By, WebDriver, WebElement, WebElementPromise, promise, promise as wdpromise, until} from \'selenium-webdriver\';\n'; - files.forEach(file => { - contents += parseTypingsFile(folder, file); - }); - - // remove files with d.ts - glob.sync(folder + '/**/*.d.ts').forEach(file => { - fs.unlinkSync(path.resolve(file)); - }); - - // write contents to 'built/index.d.ts' + contents += '/// \n'; + contents += 'export { ElementHelper, ProtractorBrowser } from \'./browser\';\n'; + contents += 'export { ElementArrayFinder, ElementFinder } from \'./element\';\n'; + contents += 'export { ProtractorExpectedConditions } from \'./expectedConditions\';\n'; + contents += 'export { ProtractorBy } from \'./locators\';\n'; + contents += 'export { Config } from \'./config\';\n'; + contents += 'export { Ptor } from \'./ptor\';\n'; fs.writeFileSync(outputFile, contents); done(); }); - -var parseTypingsFile = function(folder, file) { - var fileContents = fs.readFileSync(path.resolve(folder, file + '.d.ts')).toString(); - // Remove new lines inside types - fileContents = fileContents.replace( - /webdriver.promise.Promise<\{[a-zA-Z:,; \n]+\}>/g, (type) => { - return type.replace(/\n/g, ''); - } - ); - var lines = fileContents.split('\n'); - var contents = ''; - for (var linePos in lines) { - var line = lines[linePos]; - if (!line.startsWith('import')) { - if (line.indexOf('declare') !== -1) { - line = line.replace('declare', '').trim(); - } - - // Remove webdriver types, q, http proxy agent - line = removeTypes(line,'webdriver.ActionSequence'); - line = removeTypes(line,'webdriver.promise.Promise<[a-zA-Z{},:; ]+>'); - line = removeTypes(line,'webdriver.util.Condition'); - line = removeTypes(line,'webdriver.WebDriver'); - line = removeTypes(line,'webdriver.Locator'); - line = removeTypes(line,'webdriver.WebElement'); - line = removeTypes(line,'HttpProxyAgent'); - line = removeTypes(line,'Q.Promise<[a-zA-Z{},:; ]+>'); - contents += line + '\n'; - } - } - return contents; -} - -var removeTypes = function(line, webdriverType) { - var tempLine = line.trim(); - if (tempLine.startsWith('/**') || tempLine.startsWith('*')) { - return line; - } - return line.replace(new RegExp(webdriverType,'g'), 'any'); -} - -gulp.task('ambient', function(done) { - var fileContents = fs.readFileSync(path.resolve('built/index.d.ts')).toString(); - var contents = ''; - contents += 'declare namespace protractor {\n'; - contents += fileContents + '\n'; - contents += '}\n'; - contents += 'declare module "protractor" {\n'; - - contents += ' export = protractor; \n'; - contents += '}\n'; - fs.writeFileSync(path.resolve('built/ambient.d.ts'), contents); - done(); -}); diff --git a/lib/browser.ts b/lib/browser.ts index eae3e427a..c839051d7 100644 --- a/lib/browser.ts +++ b/lib/browser.ts @@ -1,6 +1,18 @@ // Util from NodeJs import * as net from 'net'; -import {ActionSequence, promise as wdpromise, until, WebDriver, WebElement} from 'selenium-webdriver'; +import { + ActionSequence, + Capabilities, + Command as WdCommand, + FileDetector, + Options, + promise as wdpromise, + Session, TargetLocator, + TouchSequence, until, + WebDriver, + WebElement +} from 'selenium-webdriver'; + import * as url from 'url'; import * as util from 'util'; @@ -32,18 +44,29 @@ for (let foo in webdriver) { exports[foo] = webdriver[foo]; } -// Explicitly define webdriver.WebDriver. +// Explicitly define webdriver.WebDriver export class Webdriver { - actions: () => ActionSequence = webdriver.WebDriver.actions; - wait: - (condition: wdpromise.Promise|until.Condition|Function, - opt_timeout?: number, - opt_message?: - string) => wdpromise.Promise = webdriver.WebDriver.wait; - sleep: (ms: number) => wdpromise.Promise = webdriver.WebDriver.sleep; - getCurrentUrl: - () => wdpromise.Promise = webdriver.WebDriver.getCurrentUrl; - getTitle: () => wdpromise.Promise = webdriver.WebDriver.getTitle; + actions: () => ActionSequence; + close: () => void; + controlFlow: () => wdpromise.ControlFlow; + executeScript: (script: string|Function, ...var_args: any[]) => wdpromise.Promise; + executeAsyncScript: (script: string|Function, ...var_args: any[]) => wdpromise.Promise; + getCapabilities: () => Capabilities; + getCurrentUrl: () => wdpromise.Promise; + getPageSource: () => wdpromise.Promise; + getSession: () => wdpromise.Promise; + getTitle: () => wdpromise.Promise; + getWindowHandle: () => wdpromise.Promise; + getAllWindowHandles: () => wdpromise.Promise; + manage: () => Options; + quit: () => void; + schedule: (command: WdCommand, description: string) => webdriver.promise.Promise; + setFileDetector: (detector: FileDetector) => void; + sleep: (ms: number) => wdpromise.Promise; + switchTo: () => TargetLocator; + touchActions: () => TouchSequence; + wait: (condition: wdpromise.Promise|until.Condition|Function, + opt_timeout?: number, opt_message?: string) => wdpromise.Promise; takeScreenshot: () => wdpromise.Promise = webdriver.WebDriver.takeScreenshot; } @@ -266,7 +289,13 @@ export class ProtractorBrowser extends Webdriver { // These functions should delegate to the webdriver instance, but should // wait for Angular to sync up before performing the action. This does not // include functions which are overridden by protractor below. - let methodsToSync = ['getCurrentUrl', 'getPageSource', 'getTitle']; + let methodsToSync = [ + 'actions', 'close', 'controlFlow', 'executeScript', 'executeAsyncScript', + 'getCapabilities', 'getCurrentUrl', 'getPageSource', 'getSession', + 'getTitle', 'getWindowHandle', 'getAllWindowHandles', 'manage', 'quit', + 'schedule', 'setFileDetector', 'sleep', 'switchTo', 'touchActions', + 'touchSequence', 'wait' + ]; // Mix all other driver functionality into Protractor. @@ -572,7 +601,7 @@ export class ProtractorBrowser extends Webdriver { * @returns {!webdriver.promise.Promise} A promise that will resolve to whether * the element is present on the page. */ - isElementPresent(locatorOrElement: webdriver.Locator| + isElementPresent(locatorOrElement: ProtractorBy| webdriver.WebElement): webdriver.promise.Promise { let element = ((locatorOrElement as any).isPresent) ? locatorOrElement : diff --git a/lib/element.ts b/lib/element.ts index a8f82f18d..27772a0ab 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -1,4 +1,4 @@ -import {By, error, promise, WebDriver, WebElement, WebElementPromise} from 'selenium-webdriver'; +import {By, error, ILocation, ISize, promise as wdpromise, WebDriver, WebElement, WebElementPromise} from 'selenium-webdriver'; import {ElementHelper} from './browser'; import {ProtractorBrowser} from './browser'; @@ -20,25 +20,25 @@ let WEB_ELEMENT_FUNCTIONS = [ // Explicitly define webdriver.WebElement. export class WebdriverWebElement { getDriver: () => WebDriver; - getId: () => promise.Promise; - getRawId: () => promise.Promise; - serialize: () => promise.Promise; - findElement: (subLocator: Locator) => promise.Promise; - click: () => promise.Promise; - sendKeys: - (...args: (string|promise.Promise)[]) => promise.Promise; - getTagName: () => promise.Promise; - getCssValue: (cssStyleProperty: string) => promise.Promise; - getAttribute: (attributeName: string) => promise.Promise; - getText: () => promise.Promise; - getSize: () => promise.Promise<{width: number, height: number}>; - getLocation: () => promise.Promise<{x: number, y: number}>; - isEnabled: () => promise.Promise; - isSelected: () => promise.Promise; - submit: () => promise.Promise; - clear: () => promise.Promise; - isDisplayed: () => promise.Promise; - takeScreenshot: (opt_scroll?: boolean) => promise.Promise; + getId: () => wdpromise.Promise; + getRawId: () => wdpromise.Promise; + serialize: () => wdpromise.Promise; + findElement: (subLocator: Locator) => wdpromise.Promise; + click: () => wdpromise.Promise; + sendKeys: (...args: (string| + wdpromise.Promise)[]) => wdpromise.Promise; + getTagName: () => wdpromise.Promise; + getCssValue: (cssStyleProperty: string) => wdpromise.Promise; + getAttribute: (attributeName: string) => wdpromise.Promise; + getText: () => wdpromise.Promise; + getSize: () => wdpromise.Promise; + getLocation: () => wdpromise.Promise; + isEnabled: () => wdpromise.Promise; + isSelected: () => wdpromise.Promise; + submit: () => wdpromise.Promise; + clear: () => wdpromise.Promise; + isDisplayed: () => wdpromise.Promise; + takeScreenshot: (opt_scroll?: boolean) => wdpromise.Promise; } /** @@ -97,9 +97,9 @@ export class WebdriverWebElement { export class ElementArrayFinder extends WebdriverWebElement { constructor( public browser_: ProtractorBrowser, - public getWebElements: () => promise.Promise = null, - public locator_?: any, - public actionResults_: promise.Promise = null) { + public getWebElements: () => wdpromise.Promise = null, + public locator_: any, + public actionResults_: wdpromise.Promise = null) { super(); // TODO(juliemr): might it be easier to combine this with our docs and just @@ -163,11 +163,11 @@ export class ElementArrayFinder extends WebdriverWebElement { */ all(locator: Locator): ElementArrayFinder { let ptor = this.browser_; - let getWebElements = (): promise.Promise => { + let getWebElements = (): wdpromise.Promise => { if (this.getWebElements === null) { // This is the first time we are looking for an element return ptor.waitForAngular('Locator: ' + locator) - .then((): promise.Promise => { + .then((): wdpromise.Promise => { if (locator.findElementsOverride) { return locator.findElementsOverride( ptor.driver, null, ptor.rootEl); @@ -192,7 +192,7 @@ export class ElementArrayFinder extends WebdriverWebElement { // Resolve the list of Promise> and merge // into // a single list - return promise.all(childrenPromiseList) + return wdpromise.all(childrenPromiseList) .then((resolved: webdriver.WebElement[]) => { return resolved.reduce( (childrenList: webdriver.WebElement[], @@ -239,7 +239,7 @@ export class ElementArrayFinder extends WebdriverWebElement { * of element that satisfy the filter function. */ filter(filterFn: Function): ElementArrayFinder { - let getWebElements = (): promise.Promise => { + let getWebElements = (): wdpromise.Promise => { return this.getWebElements().then((parentWebElements: WebElement[]) => { let list = parentWebElements.map( (parentWebElement: WebElement, index: number) => { @@ -385,7 +385,7 @@ export class ElementArrayFinder extends WebdriverWebElement { * @returns {!webdriver.promise.Promise} A promise which resolves to the * number of elements matching the locator. */ - count(): promise.Promise { + count(): wdpromise.Promise { return this.getWebElements().then( (arr: WebElement[]) => { return arr.length; }, (err: IError) => { @@ -458,7 +458,7 @@ export class ElementArrayFinder extends WebdriverWebElement { * @returns {Array.} Return a promise, which resolves to a list * of ElementFinders specified by the locator. */ - asElementFinders_(): promise.Promise { + asElementFinders_(): wdpromise.Promise { return this.getWebElements().then((arr: WebElement[]) => { return arr.map((webElem: WebElement) => { return ElementFinder.fromWebElement_( @@ -491,7 +491,7 @@ export class ElementArrayFinder extends WebdriverWebElement { * @returns {!webdriver.promise.Promise} A promise which will resolve to * an array of ElementFinders represented by the ElementArrayFinder. */ - then(fn: Function, errorFn: Function): promise.Promise { + then(fn: Function, errorFn: Function): wdpromise.Promise { if (this.actionResults_) { return this.actionResults_.then(fn, errorFn); } else { @@ -526,7 +526,7 @@ export class ElementArrayFinder extends WebdriverWebElement { * resolve to null. */ each(fn: (elementFinder: ElementFinder, index: number) => any): - promise.Promise { + wdpromise.Promise { return this.map(fn).then((): any => { return null; }); } @@ -563,14 +563,14 @@ export class ElementArrayFinder extends WebdriverWebElement { * of values returned by the map function. */ map(mapFn: (elementFinder: ElementFinder, index: number) => any): - promise.Promise { + wdpromise.Promise { return this.asElementFinders_().then((arr: ElementFinder[]) => { let list = arr.map((elementFinder: ElementFinder, index: number) => { let mapResult = mapFn(elementFinder, index); // All nested arrays and objects will also be fully resolved. - return promise.fullyResolved(mapResult); + return wdpromise.fullyResolved(mapResult); }); - return promise.all(list); + return wdpromise.all(list); }); }; @@ -606,8 +606,8 @@ export class ElementArrayFinder extends WebdriverWebElement { * @returns {!webdriver.promise.Promise} A promise that resolves to the final * value of the accumulator. */ - reduce(reduceFn: Function, initialValue: any): promise.Promise { - let valuePromise = promise.fulfilled(initialValue); + reduce(reduceFn: Function, initialValue: any): wdpromise.Promise { + let valuePromise = wdpromise.fulfilled(initialValue); return this.asElementFinders_().then((arr: ElementFinder[]) => { return arr.reduce( (valuePromise: any, elementFinder: ElementFinder, index: number) => { @@ -714,7 +714,7 @@ export class ElementArrayFinder extends WebdriverWebElement { export class ElementFinder extends WebdriverWebElement { parentElementArrayFinder: ElementArrayFinder; elementArrayFinder_: ElementArrayFinder; - then: (fn: Function, errorFn: Function) => promise.Promise = null; + then: (fn: Function, errorFn: Function) => wdpromise.Promise = null; constructor( public browser_: ProtractorBrowser, @@ -752,7 +752,7 @@ export class ElementFinder extends WebdriverWebElement { // This filter verifies that there is only 1 element returned by the // elementArrayFinder. It will warn if there are more than 1 element and // throw an error if there are no elements. - let getWebElements = (): promise.Promise => { + let getWebElements = (): wdpromise.Promise => { return elementArrayFinder.getWebElements().then( (webElements: WebElement[]) => { if (webElements.length === 0) { @@ -790,7 +790,7 @@ export class ElementFinder extends WebdriverWebElement { static fromWebElement_( browser: ProtractorBrowser, webElem: WebElement, locator: Locator): ElementFinder { - let getWebElements = () => { return promise.fulfilled([webElem]); }; + let getWebElements = () => { return wdpromise.fulfilled([webElem]); }; return new ElementArrayFinder(browser, getWebElements, locator) .toElementFinder_(); } @@ -965,7 +965,7 @@ export class ElementFinder extends WebdriverWebElement { * @returns {webdriver.promise.Promise} which resolves to whether * the element is present on the page. */ - isPresent(): promise.Promise { + isPresent(): wdpromise.Promise { return this.parentElementArrayFinder.getWebElements().then( (arr: any[]) => { if (arr.length === 0) { @@ -1005,7 +1005,7 @@ export class ElementFinder extends WebdriverWebElement { * @returns {webdriver.promise.Promise} which resolves to whether * the subelement is present on the page. */ - isElementPresent(subLocator: Locator): promise.Promise { + isElementPresent(subLocator: Locator): wdpromise.Promise { if (!subLocator) { throw new Error( 'SubLocator is not supplied as a parameter to ' + @@ -1051,7 +1051,7 @@ export class ElementFinder extends WebdriverWebElement { * @returns {!webdriver.promise.Promise.} A promise that will be * resolved to whether the two WebElements are equal. */ - equals(element: ElementFinder|WebElement): promise.Promise { + equals(element: ElementFinder|WebElement): wdpromise.Promise { return WebElement.equals( this.getWebElement(), (element as any).getWebElement ? (element as ElementFinder).getWebElement() : diff --git a/lib/globals.d.ts b/lib/globals.d.ts index 15dfa85e7..4765f64f1 100644 --- a/lib/globals.d.ts +++ b/lib/globals.d.ts @@ -25,7 +25,7 @@ declare namespace NodeJS { Command: any; CommandName: any; // Helper function added by the debugger in protractor.ps - list: (locator: webdriver.Locator) => string[]; + list: (locator: any) => string[]; [key: string]: any; } } @@ -38,24 +38,9 @@ declare interface IError extends Error { declare interface String { startsWith: Function; } declare namespace webdriver { - namespace promise { - interface Promise { - controlFlow: Function; - } - } - - namespace util { - interface Condition {} - } - class ErrorCode { code: number; } - - interface Locator { - toString(): string; - isPresent?: Function; - } } declare interface HttpProxyAgent { constructor(opts: Object): HttpProxyAgent; } diff --git a/lib/locators.ts b/lib/locators.ts index 41430d5c9..fa1cbb9ee 100644 --- a/lib/locators.ts +++ b/lib/locators.ts @@ -1,4 +1,4 @@ -import {By, promise, WebDriver, WebElement} from 'selenium-webdriver'; +import {By, promise as wdpromise, WebDriver, WebElement} from 'selenium-webdriver'; import * as util from 'util'; let webdriver = require('selenium-webdriver'); @@ -22,7 +22,7 @@ export class WebdriverBy { export interface Locator { findElementsOverride?: (driver: WebDriver, using: WebElement, - rootSelector: string) => promise.Promise; + rootSelector: string) => wdpromise.Promise; row?: (index: number) => Locator; column?: (index: string) => Locator; } @@ -77,7 +77,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { let findElementArguments: any[] = [script]; for (let i = 0; i < locatorArguments.length; i++) { findElementArguments.push(locatorArguments[i]); @@ -130,7 +130,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findBindings, bindingDescriptor, false, using, rootSelector)); @@ -163,7 +163,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findBindings, bindingDescriptor, true, using, rootSelector)); @@ -193,7 +193,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findByModel, model, using, rootSelector)); }, @@ -217,7 +217,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findByButtonText, searchText, using, rootSelector)); @@ -242,7 +242,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findByPartialButtonText, searchText, using, rootSelector)); @@ -258,7 +258,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findAllRepeaterRows, repeatDescriptor, exact, using, rootSelector)); @@ -268,7 +268,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findRepeaterRows, repeatDescriptor, exact, index, using, rootSelector)); @@ -280,7 +280,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findRepeaterElement, repeatDescriptor, exact, index, binding, using, rootSelector)); @@ -297,7 +297,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findRepeaterColumn, repeatDescriptor, exact, binding, using, rootSelector)); @@ -310,7 +310,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findRepeaterElement, repeatDescriptor, exact, index, binding, using, rootSelector)); @@ -427,7 +427,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findByCssContainingText, cssSelector, searchText, using, rootSelector)); @@ -462,7 +462,7 @@ export class ProtractorBy extends WebdriverBy { return { findElementsOverride: (driver: WebDriver, using: WebElement, rootSelector: string): - promise.Promise => { + wdpromise.Promise => { return driver.findElements(webdriver.By.js( clientSideScripts.findByOptions, optionsDescriptor, using, rootSelector));