-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(types): update for selenium-webdriver types creating transpile errors #3848
Conversation
2142d83
to
3d5f84a
Compare
3d5f84a
to
87ebf34
Compare
There is a test that leaves a browser session open. Will investigate. |
Narrowed down to this test. It passes but the browser is still open: spec/driverProviderLocalConf.js. We can fix this later. |
Also we are setting a specific version of @types/selenium-webdriver to make sure we don't run into this problem again. |
When angular/protractor#3848 is ready it should fix the webdriver types issues, and the pinning can be reverted. The zone.js problem is being tracked on angular/zone.js#554. Fix #325
When angular/protractor#3848 is ready it should fix the webdriver types issues, and the pinning can be reverted. The zone.js problem is being tracked on angular/zone.js#554. Fix #325
@@ -4,10 +4,15 @@ | |||
* server. | |||
*/ | |||
import * as q from 'q'; | |||
import {DeferredExecutor, Executor, Session, WebDriver} from 'selenium-webdriver'; |
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.
DeferredExecutor, Executor, and Session look unused?
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.
Nice catch. I had a few issues with mock last night... I'll remove this.
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.
Removing DeferredExecutor
and Executor
. The Session constructor is used at getNewDriver
.
87ebf34
to
6395c1c
Compare
LGTM! |
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.
Lots of nits and one important issue in the package.json
@@ -15,7 +15,7 @@ | |||
"@types/jasmine": "^2.5.36", | |||
"@types/node": "^6.0.46", | |||
"@types/q": "^0.0.32", | |||
"@types/selenium-webdriver": "~2.53.31", | |||
"@types/selenium-webdriver": "2.53.31", |
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.
Should probably be "2.53.37". Additionally, we should maybe fix all the other @types
in a similar way and put something in release.md
about updating types.
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.
Done.
@@ -562,7 +562,7 @@ export class ProtractorBrowser extends Webdriver { | |||
* @returns {!webdriver.promise.Promise} A promise that will be resolved to an |
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 use webdriver
in the for loop a couple lines later. Let's scope webdriver
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
@@ -60,17 +61,15 @@ export class DebugHelper { | |||
} |
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: on line 55, prefer wdpromise
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.
Also, on line 42, I think I'd prefer (wdpromise.ControlFlow as any).prototype
and get rid of the webdriver
variable entirely
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.
done and removed require('selenium-webdriver');
@@ -230,9 +229,9 @@ export class DebugHelper { | |||
* is done. The promise will resolve to a boolean which represents whether | |||
* this is the first time that the debugger is called. | |||
*/ | |||
private validatePortAvailability_(port: number): webdriver.promise.Promise<any> { |
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: prefer wdpromise
if (this.debuggerValidated_) { | ||
return webdriver.promise.fulfilled(false); |
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: prefer wdpromise
@@ -1,6 +1,6 @@ | |||
import {By, promise as wdpromise, WebDriver, WebElement} from 'selenium-webdriver'; | |||
|
|||
let webdriver = require('selenium-webdriver'); | |||
const webdriver = require('selenium-webdriver'); |
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: if you can address my other nit in this file, remove this declaration.
@@ -23,7 +23,7 @@ export class Ptor { | |||
By: ProtractorBy; | |||
by: ProtractorBy; | |||
wrapDriver: | |||
(webdriver: webdriver.WebDriver, baseUrl?: string, rootElement?: string, | |||
(webdriver: WebDriver, baseUrl?: string, rootElement?: string, | |||
untrackOutstandingTimeouts?: boolean) => ProtractorBrowser; | |||
ExpectedConditions: ProtractorExpectedConditions; | |||
|
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: below, for everything under // Export selenium webdriver.
, prefer the imported version vs the webdriver.
version
@@ -23,7 +23,7 @@ export class Ptor { | |||
By: ProtractorBy; |
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: up on line 11, prefer const webdriver = ...
. Or possibly just remove the declaration entirely if you can address my other nit in this file
@@ -1,5 +1,6 @@ | |||
import {EventEmitter} from 'events'; | |||
import * as q from 'q'; | |||
import {Session} from 'selenium-webdriver'; |
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: add promise as wdpromise
to this and replace all the instances of webdriver.promise
below with wdpromise
@@ -1,5 +1,6 @@ | |||
import {EventEmitter} from 'events'; | |||
import * as q from 'q'; | |||
import {Session} from 'selenium-webdriver'; | |||
import * as util from 'util'; | |||
|
|||
import {ProtractorBrowser} from './browser'; |
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: below on line 17, prefer const webdriver = ...
. Or, if you can address my other nit from this file, remove the declaration entirely.
…the webdriver typings. Protractor 4.0.14 incorporates DefinitelyTyped/DefinitelyTyped#13382, fixing angular/protractor#3848
When angular/protractor#3848 is ready it should fix the webdriver types issues, and the pinning can be reverted. The zone.js problem is being tracked on angular/zone.js#554. Fix angular/quickstart#325
No description provided.