@@ -24,6 +24,7 @@ describe('Electron', function() {
24
24
const electronPath = path . join ( __dirname , '..' , '..' , 'node_modules' , '.bin' , electronName ) ;
25
25
state . application = await playwright . electron . launch ( electronPath , {
26
26
args : [ path . join ( __dirname , 'testApp.js' ) ] ,
27
+ // This is for our own extensive protocol logging, customers don't need it.
27
28
logger : {
28
29
isEnabled : ( name , severity ) => {
29
30
return name === 'browser' ||
@@ -44,6 +45,7 @@ describe('Electron', function() {
44
45
} ) ;
45
46
afterEach ( async ( state , testRun ) => {
46
47
await state . application . close ( ) ;
48
+ // This is for our own extensive protocol logging, customers don't need it.
47
49
if ( config . dumpProtocolOnFailure ) {
48
50
if ( testRun . ok ( ) )
49
51
testRun . output ( ) . splice ( 0 ) ;
@@ -115,9 +117,17 @@ describe('Electron', function() {
115
117
await page . goto ( 'data:text/html,<script>window.result = add(20, 22);</script>' ) ;
116
118
expect ( await page . evaluate ( ( ) => result ) ) . toBe ( 42 ) ;
117
119
} ) ;
120
+ it ( 'should wait for first window' , async ( { application } ) => {
121
+ application . evaluate ( ( { BrowserWindow } ) => {
122
+ const window = new BrowserWindow ( { width : 800 , height : 600 } ) ;
123
+ window . loadURL ( 'data:text/html,<title>Hello World!</title>' ) ;
124
+ } ) ;
125
+ const window = await application . firstWindow ( ) ;
126
+ expect ( await window . title ( ) ) . toBe ( 'Hello World!' ) ;
127
+ } ) ;
118
128
} ) ;
119
129
120
- describe ( 'Electron window' , function ( ) {
130
+ describe ( 'Electron per window' , function ( ) {
121
131
beforeAll ( async state => {
122
132
const electronPath = path . join ( __dirname , '..' , '..' , 'node_modules' , '.bin' , electronName ) ;
123
133
state . application = await playwright . electron . launch ( electronPath , {
0 commit comments