-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(types): update for selenium-webdriver types creating transpile errors #3848
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import * as net from 'net'; | ||
import {promise as wdpromise, WebElement} from 'selenium-webdriver'; | ||
import * as util from 'util' | ||
|
||
import {ProtractorBrowser} from './browser'; | ||
|
@@ -11,7 +12,7 @@ declare var global: any; | |
declare var process: any; | ||
|
||
let logger = new Logger('protractor'); | ||
let webdriver = require('selenium-webdriver'); | ||
const webdriver = require('selenium-webdriver'); | ||
|
||
export class DebugHelper { | ||
/** | ||
|
@@ -60,17 +61,15 @@ export class DebugHelper { | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: on line 55, prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, on line 42, I think I'd prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done and removed require('selenium-webdriver'); |
||
let context: Context = {require: require}; | ||
global.list = (locator: Locator) => { | ||
return (<Ptor>global.protractor) | ||
.browser.findElements(locator) | ||
.then((arr: webdriver.WebElement[]) => { | ||
let found: string[] = []; | ||
for (let i = 0; i < arr.length; ++i) { | ||
arr[i].getText().then((text: string) => { | ||
found.push(text); | ||
}); | ||
} | ||
return found; | ||
return (<Ptor>global.protractor).browser.findElements(locator).then((arr: WebElement[]) => { | ||
let found: string[] = []; | ||
for (let i = 0; i < arr.length; ++i) { | ||
arr[i].getText().then((text: string) => { | ||
found.push(text); | ||
}); | ||
} | ||
return found; | ||
}); | ||
}; | ||
for (let key in global) { | ||
context[key] = global[key]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: on line 80, prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
|
@@ -230,9 +229,9 @@ export class DebugHelper { | |
* is done. The promise will resolve to a boolean which represents whether | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: on lines 165, 166, and 188, prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
* this is the first time that the debugger is called. | ||
*/ | ||
private validatePortAvailability_(port: number): webdriver.promise.Promise<any> { | ||
private validatePortAvailability_(port: number): wdpromise.Promise<any> { | ||
if (this.debuggerValidated_) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: prefer |
||
return webdriver.promise.fulfilled(false); | ||
return wdpromise.fulfilled(false); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: prefer |
||
|
||
let doneDeferred = webdriver.promise.defer(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: prefer |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: way up on line 13, we have
const webdriver = ...
, but we only actually usewebdriver
in the for loop a couple lines later. Let's scopewebdriver
to that for loop so we don't have two copies of the same library floating around.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scoping the require('selenium-webdriver') in only the for loop