From 11c9418d3e379f3ac065b455e7584985fb47e7d8 Mon Sep 17 00:00:00 2001 From: Craig Date: Tue, 13 Sep 2016 10:43:58 -0700 Subject: [PATCH] chore(types): clean up TypeScript support (#3520) - fix exampleTypescript to have noGlobals - change the exampleTypescript tsconfig.json to include @types - alias promise as wdpromise everywhere - add browser method types applied from webdriver - remove gulpfile 'types' task - remove webdriver namespace from globals.d.ts this closes #3430, closes #3477, and closes #3500 --- exampleTypescript/.gitignore | 1 + exampleTypescript/conf.ts | 6 ++- gulpfile.js | 88 +++--------------------------------- lib/browser.ts | 60 ++++++++++++++---------- lib/element.ts | 86 +++++++++++++++++------------------ lib/globals.d.ts | 28 ++---------- lib/index.d.ts | 8 ++++ lib/locators.ts | 30 ++++++------ 8 files changed, 118 insertions(+), 189 deletions(-) create mode 100644 lib/index.d.ts 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/gulpfile.js b/gulpfile.js index 49c3956a8..9b250d39b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -49,9 +49,10 @@ gulp.task('checkVersion', function(done) { } }); -gulp.task('built:copy', function() { - return gulp.src(['lib/**/*.js','lib/globals.d.ts']) +gulp.task('built:copy', function(done) { + return gulp.src(['lib/**/*.js','lib/globals.d.ts','lib/index.d.ts']) .pipe(gulp.dest('built/')); + done(); }); gulp.task('webdriver:update', function(done) { @@ -88,91 +89,14 @@ gulp.task('tsc:globals', function(done) { }); gulp.task('prepublish', function(done) { - runSequence('checkVersion', ['jshint', 'format'], 'tsc', 'tsc:globals', 'types', - 'ambient', 'built:copy', done); + runSequence('checkVersion', ['jshint', 'format'], 'tsc', 'tsc:globals', + 'built:copy', done); }); gulp.task('pretest', function(done) { runSequence('checkVersion', ['webdriver:update', 'jshint', 'format'], 'tsc', 'tsc:globals', - 'types', 'ambient', 'built:copy', done); + '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 contents = ''; - contents += '/// \n'; - contents += '/// \n'; - contents += 'import {ActionSequence, By, WebDriver, WebElement, WebElementPromise, promise, promise as wdpromise, until} from \'selenium-webdriver\';\n'; - files.forEach(function(file) { - contents += parseTypingsFile(folder, file); - }); - - // remove files with d.ts - glob.sync(folder + '/**/*.d.ts').forEach(function(file) { - fs.unlinkSync(path.resolve(file)); - }); - - // write contents to 'built/index.d.ts' - 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, function(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..3679a73e1 100644 --- a/lib/browser.ts +++ b/lib/browser.ts @@ -1,6 +1,7 @@ // 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,20 +33,37 @@ for (let foo in webdriver) { exports[foo] = webdriver[foo]; } -// Explicitly define webdriver.WebDriver. +// Explicitly define webdriver.WebDriver +// TODO: extend WebDriver from selenium-webdriver typings export class Webdriver { - actions: () => ActionSequence = webdriver.WebDriver.actions; + actions: () => ActionSequence; + call: + (fn: (...var_args: any[]) => any, opt_scope?: any, + ...var_args: any[]) => wdpromise.Promise; + 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) => wdpromise.Promise; + setFileDetector: (detector: FileDetector) => void; + sleep: (ms: number) => wdpromise.Promise; + switchTo: () => TargetLocator; + takeScreenshot: () => wdpromise.Promise; + touchActions: () => TouchSequence; 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; - takeScreenshot: - () => wdpromise.Promise = webdriver.WebDriver.takeScreenshot; + opt_timeout?: number, opt_message?: string) => wdpromise.Promise; } /** @@ -268,7 +286,6 @@ export class ProtractorBrowser extends Webdriver { // include functions which are overridden by protractor below. let methodsToSync = ['getCurrentUrl', 'getPageSource', 'getTitle']; - // Mix all other driver functionality into Protractor. Object.getOwnPropertyNames(webdriver.WebDriver.prototype) .forEach((method: string) => { @@ -298,7 +315,7 @@ export class ProtractorBrowser extends Webdriver { this.resetUrl = DEFAULT_RESET_URL; this.ng12Hybrid = false; - this.driver.getCapabilities().then((caps: webdriver.Capabilities) => { + this.driver.getCapabilities().then((caps: Capabilities) => { // Internet Explorer does not accept data URLs, which are the default // reset URL for Protractor. // Safari accepts data urls, but SafariDriver fails after one is used. @@ -492,7 +509,7 @@ export class ProtractorBrowser extends Webdriver { 'Timed out waiting for Protractor to synchronize with ' + 'the page after ' + timeout + '. Please see ' + 'https://github.com/angular/protractor/blob/master/docs/faq.md'; - if (description.startsWith(' - Locator: ')) { + if (description.indexOf(' - Locator: ') == 0) { errMsg += '\nWhile waiting for element with locator' + description; } @@ -572,7 +589,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 : @@ -757,17 +774,14 @@ export class ProtractorBrowser extends Webdriver { 'return window.location.href;', msg('get url')) .then( (url: any) => { return url !== this.resetUrl; }, - (err: webdriver.ErrorCode) => { + (err: IError) => { if (err.code == 13) { // Ignore the error, and continue trying. This is - // because IE - // driver sometimes (~1%) will throw an unknown error - // from this - // execution. See + // because IE driver sometimes (~1%) will throw an + // unknown error from this execution. See // https://github.com/angular/protractor/issues/841 // This shouldn't mask errors because it will fail - // with the timeout - // anyway. + // with the timeout anyway. return false; } else { throw err; diff --git a/lib/element.ts b/lib/element.ts index a8f82f18d..18491e2da 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'; @@ -18,27 +18,28 @@ let WEB_ELEMENT_FUNCTIONS = [ ]; // Explicitly define webdriver.WebElement. +// TODO: extend WebElement from selenium-webdriver typings 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,14 +98,13 @@ export class WebdriverWebElement { export class ElementArrayFinder extends WebdriverWebElement { constructor( public browser_: ProtractorBrowser, - public getWebElements: () => promise.Promise = null, + public getWebElements: () => wdpromise.Promise = null, public locator_?: any, - public actionResults_: promise.Promise = null) { + public actionResults_: wdpromise.Promise = null) { super(); // TODO(juliemr): might it be easier to combine this with our docs and just - // wrap each - // one explicity with its own documentation? + // wrap each one explicity with its own documentation? WEB_ELEMENT_FUNCTIONS.forEach((fnName: string) => { this[fnName] = (...args: any[]) => { let actionFn = @@ -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..b72638fb2 100644 --- a/lib/globals.d.ts +++ b/lib/globals.d.ts @@ -13,6 +13,7 @@ declare namespace NodeJS { } interface Global { + // These are here because we tie these variables to the global namespace. browser: any; protractor: any; $: any; @@ -24,8 +25,8 @@ declare namespace NodeJS { DartObject: any; Command: any; CommandName: any; - // Helper function added by the debugger in protractor.ps - list: (locator: webdriver.Locator) => string[]; + // Helper function added by the debugger and element explorer + list: (locator: any) => string[]; [key: string]: any; } } @@ -35,27 +36,4 @@ declare interface IError extends Error { stack?: string; } -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/index.d.ts b/lib/index.d.ts new file mode 100644 index 000000000..0b49dddb3 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,8 @@ +/// +/// +export {ElementHelper, ProtractorBrowser} from './browser'; +export {Config} from './config'; +export {ElementArrayFinder, ElementFinder} from './element'; +export {ProtractorExpectedConditions} from './expectedConditions'; +export {ProtractorBy} from './locators'; +export {Ptor} from './ptor'; 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));