Skip to content

Commit 5eced26

Browse files
committed
[JS] Update npm libs to latets and minor bidi fixes
1 parent b03bfa1 commit 5eced26

7 files changed

Lines changed: 992 additions & 147 deletions

File tree

javascript/node/selenium-webdriver/bidi/browsingContext.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ class BrowsingContext {
2626
throw Error('WebDriver instance must support BiDi protocol')
2727
}
2828

29-
if (type != undefined && !['window', 'tab'].includes(type)) {
29+
if (type !== undefined && !['window', 'tab'].includes(type)) {
3030
throw Error(`Valid types are 'window' & 'tab'. Received: ${type}`)
3131
}
3232

3333
this.bidi = await this._driver.getBidi()
3434
this._id =
35-
browsingContextId == undefined
35+
browsingContextId === undefined
3636
? (await this.create(type, referenceContext))['result']['context']
3737
: browsingContextId
3838
}
@@ -65,7 +65,7 @@ class BrowsingContext {
6565
*/
6666
async navigate(url, readinessState = undefined) {
6767
if (
68-
readinessState != undefined &&
68+
readinessState !== undefined &&
6969
!['none', 'interactive', 'complete'].includes(readinessState)
7070
) {
7171
throw Error(
@@ -117,7 +117,7 @@ class BrowsingContext {
117117
}
118118

119119
/**
120-
* Closes the browing context
120+
* Closes the browsing context
121121
* @returns {Promise<void>}
122122
*/
123123
async close() {

javascript/node/selenium-webdriver/bidi/browsingContextInspector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class BrowsingContextInspector {
5454
} else {
5555
await this.bidi.subscribe(eventType)
5656
}
57-
this._on(callback)
57+
await this._on(callback)
5858
}
5959

6060
async _on(callback) {

javascript/node/selenium-webdriver/bidi/logInspector.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ class LogInspector {
5454
/**
5555
* Listen to Console logs
5656
* @param callback
57+
* @param filterBy
5758
* @returns {Promise<void>}
5859
*/
5960
async onConsoleEntry(callback, filterBy = undefined) {
60-
if (filterBy != undefined && !(filterBy instanceof FilterBy)) {
61+
if (filterBy !== undefined && !(filterBy instanceof FilterBy)) {
6162
throw Error(`Pass valid FilterBy object. Received: ${filterBy}`)
6263
}
6364

@@ -78,7 +79,7 @@ class LogInspector {
7879
params.stackTrace
7980
)
8081

81-
if (filterBy != undefined) {
82+
if (filterBy !== undefined) {
8283
if (params?.level === filterBy.getLevel()) {
8384
callback(consoleEntry)
8485
}
@@ -93,10 +94,11 @@ class LogInspector {
9394
/**
9495
* Listen to JS logs
9596
* @param callback
97+
* @param filterBy
9698
* @returns {Promise<void>}
9799
*/
98100
async onJavascriptLog(callback, filterBy = undefined) {
99-
if (filterBy != undefined && !(filterBy instanceof FilterBy)) {
101+
if (filterBy !== undefined && !(filterBy instanceof FilterBy)) {
100102
throw Error(`Pass valid FilterBy object. Received: ${filterBy}`)
101103
}
102104

@@ -114,7 +116,7 @@ class LogInspector {
114116
params.stackTrace
115117
)
116118

117-
if (filterBy != undefined) {
119+
if (filterBy !== undefined) {
118120
if (params?.level === filterBy.getLevel()) {
119121
callback(jsEntry)
120122
}
@@ -163,10 +165,11 @@ class LogInspector {
163165
/**
164166
* Listen to any logs
165167
* @param callback
168+
* @param filterBy
166169
* @returns {Promise<void>}
167170
*/
168171
async onLog(callback, filterBy = undefined) {
169-
if (filterBy != undefined && !(filterBy instanceof FilterBy)) {
172+
if (filterBy !== undefined && !(filterBy instanceof FilterBy)) {
170173
throw Error(`Pass valid FilterBy object. Received: ${filterBy}`)
171174
}
172175

@@ -183,7 +186,7 @@ class LogInspector {
183186
params.stackTrace
184187
)
185188

186-
if (filterBy != undefined) {
189+
if (filterBy !== undefined) {
187190
if (params?.level === filterBy.getLevel()) {
188191
callback(jsEntry)
189192
}
@@ -193,7 +196,7 @@ class LogInspector {
193196
callback(jsEntry)
194197
return
195198
}
196-
199+
197200
if (params?.type === 'console') {
198201
let consoleEntry = new ConsoleLogEntry(
199202
params.level,
@@ -205,8 +208,8 @@ class LogInspector {
205208
params.args,
206209
params.stackTrace
207210
)
208-
209-
if (filterBy != undefined) {
211+
212+
if (filterBy !== undefined) {
210213
if (params?.level === filterBy.getLevel()) {
211214
callback(consoleEntry)
212215
}
@@ -218,7 +221,7 @@ class LogInspector {
218221
}
219222

220223
if (
221-
params != undefined &&
224+
params !== undefined &&
222225
!['console', 'javascript'].includes(params?.type)
223226
) {
224227
let genericEntry = new GenericLogEntry(
@@ -229,7 +232,7 @@ class LogInspector {
229232
params.stackTrace
230233
)
231234

232-
if (filterBy != undefined) {
235+
if (filterBy !== undefined) {
233236
if (params?.level === filterBy.getLevel()) {
234237
callback(genericEntry)
235238
}

javascript/node/selenium-webdriver/bidi/protocolValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class RemoteValue {
123123
this.sharedId = null
124124

125125
if ('type' in remoteValue) {
126-
var typeString = remoteValue['type']
126+
const typeString = remoteValue['type']
127127
if (PrimitiveType.findByName(typeString) != null) {
128128
this.type = PrimitiveType.findByName(typeString)
129129
} else if (NonPrimitiveType.findByName(typeString) != null) {

javascript/node/selenium-webdriver/bidi/scriptManager.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,18 +285,18 @@ class ScriptManager {
285285
}
286286

287287
createEvaluateResult(response) {
288-
var type = response.result.type
289-
var realmId = response.result.realm
290-
var evaluateResult
288+
const type = response.result.type
289+
const realmId = response.result.realm
290+
let evaluateResult
291291

292292
if (type === EvaluateResultType.SUCCESS) {
293-
var result = response.result.result
293+
const result = response.result.result
294294
evaluateResult = new EvaluateResultSuccess(
295295
realmId,
296296
new RemoteValue(result)
297297
)
298298
} else {
299-
var exceptionDetails = response.result.exceptionDetails
299+
const exceptionDetails = response.result.exceptionDetails
300300
evaluateResult = new EvaluateResultException(
301301
realmId,
302302
new ExceptionDetails(exceptionDetails)
@@ -306,7 +306,7 @@ class ScriptManager {
306306
}
307307

308308
realmInfoMapper(realms) {
309-
var realmsList = []
309+
const realmsList = []
310310
realms.forEach((realm) => {
311311
realmsList.push(RealmInfo.fromJson(realm))
312312
})

0 commit comments

Comments
 (0)