File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
javascript/node/selenium-webdriver Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,10 @@ class ScriptManager {
359
359
await this . subscribeAndHandleEvent ( 'script.realmCreated' , callback )
360
360
}
361
361
362
+ async onRealmDestroyed ( callback ) {
363
+ await this . subscribeAndHandleEvent ( 'script.realmDestroyed' , callback )
364
+ }
365
+
362
366
async subscribeAndHandleEvent ( eventType , callback ) {
363
367
if ( this . _browsingContextIds != null ) {
364
368
await this . bidi . subscribe ( eventType , this . _browsingContextIds )
Original file line number Diff line number Diff line change @@ -1006,6 +1006,27 @@ suite(
1006
1006
assert . notEqual ( realmInfo . realmId , null )
1007
1007
assert . equal ( realmInfo . realmType , RealmType . WINDOW )
1008
1008
} )
1009
+
1010
+ xit ( 'can listen to realm destroyed message' , async function ( ) {
1011
+ const manager = await ScriptManager ( undefined , driver )
1012
+
1013
+ let realmInfo = null
1014
+
1015
+ await manager . onRealmDestroyed ( ( result ) => {
1016
+ realmInfo = result
1017
+ } )
1018
+
1019
+ const id = await driver . getWindowHandle ( )
1020
+ const browsingContext = await BrowsingContext ( driver , {
1021
+ browsingContextId : id ,
1022
+ } )
1023
+
1024
+ await browsingContext . close ( )
1025
+
1026
+ assert . notEqual ( realmInfo , null )
1027
+ assert . notEqual ( realmInfo . realmId , null )
1028
+ assert . equal ( realmInfo . realmType , RealmType . WINDOW )
1029
+ } )
1009
1030
} )
1010
1031
} ,
1011
1032
{ browsers : [ Browser . FIREFOX ] }
You can’t perform that action at this time.
0 commit comments