@@ -23,6 +23,7 @@ const { Browser } = require('../../')
23
23
const { Pages, suite } = require ( '../../lib/test' )
24
24
const logInspector = require ( '../../bidi/logInspector' )
25
25
const BrowsingContext = require ( '../../bidi/browsingContext' )
26
+ const until = require ( '../../lib/until' )
26
27
27
28
suite (
28
29
function ( env ) {
@@ -209,6 +210,36 @@ suite(
209
210
await assert . rejects ( window2 . getTree ( ) , { message : 'no such frame' } )
210
211
} )
211
212
} )
213
+
214
+ describe ( 'Integration Tests' , function ( ) {
215
+ it ( 'can navigate and listen to errors' , async function ( ) {
216
+ let logEntry = null
217
+ const inspector = await logInspector ( driver )
218
+ await inspector . onJavascriptException ( function ( log ) {
219
+ logEntry = log
220
+ } )
221
+
222
+ const id = await driver . getWindowHandle ( )
223
+ const browsingContext = await BrowsingContext ( driver , {
224
+ browsingContextId : id ,
225
+ } )
226
+ const info = await browsingContext . navigate ( Pages . logEntryAdded )
227
+
228
+ assert . notEqual ( browsingContext . id , null )
229
+ assert . equal ( info . navigationId , null )
230
+ assert ( info . url . includes ( '/bidi/logEntryAdded.html' ) )
231
+
232
+ await driver . wait ( until . urlIs ( Pages . logEntryAdded ) )
233
+ await driver . findElement ( { id : 'jsException' } ) . click ( )
234
+
235
+ assert . equal ( logEntry . text , 'Error: Not working' )
236
+ assert . equal ( logEntry . type , 'javascript' )
237
+ assert . equal ( logEntry . level , 'error' )
238
+
239
+ await inspector . close ( )
240
+ await browsingContext . close ( )
241
+ } )
242
+ } )
212
243
} ,
213
244
{ browsers : [ Browser . FIREFOX ] }
214
245
)
0 commit comments