@@ -8,7 +8,7 @@ import buildTestBundle, { bundlePath } from './buildTestBundle';
88import createMockRNServer from './mockRNServer' ;
99import autoUpdateFeed from '../auto_update.json' ;
1010
11- const delay = time => new Promise ( resolve => setTimeout ( resolve , time ) ) ;
11+ const delay = ( time ) => new Promise ( ( resolve ) => setTimeout ( resolve , time ) ) ;
1212
1313// eslint-disable-next-line
1414jasmine . DEFAULT_TIMEOUT_INTERVAL = 6e4 ;
@@ -23,6 +23,7 @@ describe('Application launch', () => {
2323 args : [ '--user-dir=__e2e__/tmp' , 'dist' ] ,
2424 env : {
2525 E2E_TEST : 1 ,
26+ PACKAGE : 'no' ,
2627 } ,
2728 } ) ;
2829 return app . start ( ) ;
@@ -83,32 +84,31 @@ describe('Application launch', () => {
8384 it ( "should contain Inspector monitor's component on Redux DevTools" , async ( ) => {
8485 const { client } = app ;
8586
86- const val = await client
87- . element ( '//div[contains(@class, "inspector-")]' )
88- . getText ( ) ;
87+ const el = await client . $ ( '//div[contains(@class, "inspector-")]' ) ;
88+ const val = await el . getText ( ) ;
8989 expect ( val ) . not . toBeNull ( ) ;
9090 } ) ;
9191
9292 it ( 'should contain an empty actions list on Redux DevTools' , async ( ) => {
9393 const { client } = app ;
9494
95- const val = await client
96- . element ( '//div[contains(@class, "actionListRows-")]' )
97- . getText ( ) ;
95+ const el = await client . $ ( '//div[contains(@class, "actionListRows-")]' ) ;
96+ const val = await el . getText ( ) ;
9897 expect ( val ) . toBe ( '' ) ;
9998 } ) ;
10099
101100 it ( 'should show waiting message on React DevTools' , async ( ) => {
102101 const { client } = app ;
103- const exist = await client . isExisting (
102+ const el = await client . $ (
104103 '//h2[text()="Waiting for React to connect…"]' ,
105104 ) ;
105+ const exist = await el . isExisting ( ) ;
106106 expect ( exist ) . toBe ( true ) ;
107107 } ) ;
108108
109109 const customRNServerPort = 8098 ;
110- const getURLFromConnection = server =>
111- new Promise ( resolve => {
110+ const getURLFromConnection = ( server ) =>
111+ new Promise ( ( resolve ) => {
112112 server . on ( 'connection' , ( socket , req ) => {
113113 resolve ( req . url ) ;
114114 } ) ;
@@ -136,12 +136,12 @@ describe('Application launch', () => {
136136 const portFile = path . join ( process . env [ homeEnv ] , '.rndebugger_port' ) ;
137137 const rndPort = fs . readFileSync ( portFile , 'utf-8' ) ;
138138
139- const sendSuccess = await new Promise ( resolve => {
139+ const sendSuccess = await new Promise ( ( resolve ) => {
140140 const socket = net . createConnection ( { port : rndPort } , ( ) => {
141141 let pass ;
142142 socket . setEncoding ( 'utf-8' ) ;
143143 socket . write ( JSON . stringify ( { path : rndPath } ) ) ;
144- socket . on ( 'data' , data => {
144+ socket . on ( 'data' , ( data ) => {
145145 pass = data === 'success' ;
146146 socket . end ( ) ;
147147 } ) ;
@@ -163,8 +163,8 @@ describe('Application launch', () => {
163163 } ) ;
164164
165165 describe ( 'Import fake script after' , ( ) => {
166- const getOneRequestHeaders = port =>
167- new Promise ( resolve => {
166+ const getOneRequestHeaders = ( port ) =>
167+ new Promise ( ( resolve ) => {
168168 const server = http . createServer ( ( req , res ) => {
169169 res . writeHead ( 200 , { 'Content-Type' : 'text/plain' } ) ;
170170 res . end ( '' ) ;
@@ -184,9 +184,9 @@ describe('Application launch', () => {
184184
185185 headersPromise = getOneRequestHeaders ( 8099 ) ;
186186
187- await new Promise ( resolve => {
188- wss . on ( 'connection' , socket => {
189- socket . on ( 'message' , message => {
187+ await new Promise ( ( resolve ) => {
188+ wss . on ( 'connection' , ( socket ) => {
189+ socket . on ( 'message' , ( message ) => {
190190 const data = JSON . parse ( message ) ;
191191 switch ( data . replyID ) {
192192 case 'createJSRuntime' :
@@ -233,32 +233,25 @@ describe('Application launch', () => {
233233
234234 it ( 'should have @@INIT action on Redux DevTools' , async ( ) => {
235235 const { client } = app ;
236- const val = await client
237- . element ( '//div[contains(@class, "actionListRows-")]' )
238- . getText ( ) ;
236+ const el = await client . $ ( '//div[contains(@class, "actionListRows-")]' ) ;
237+ const val = await el . getText ( ) ;
239238 expect ( val ) . toMatch ( / @ @ r e d u x \/ I N I T / ) ; // Last store is `RemoteDev store instance 1`
240239 } ) ;
241240
242241 let currentInstance = 'Autoselect instances' ; // Default instance
243242 const wait = ( ) => delay ( 750 ) ;
244- const selectInstance = async instance => {
243+ const selectInstance = async ( instance ) => {
245244 const { client } = app ;
246- await client
247- . element ( `//div[text()="${ currentInstance } "]` )
248- . click ( )
249- . then ( wait ) ;
245+ let el = await client . $ ( `//div[text()="${ currentInstance } "]` ) ;
246+ await el . click ( ) . then ( wait ) ;
250247 currentInstance = instance ;
251- return client
252- . element ( `//div[text()="${ instance } "]` )
253- . click ( )
254- . then ( wait ) ;
248+ el = await client . $ ( `//div[text()="${ instance } "]` ) ;
249+ return el . click ( ) . then ( wait ) ;
255250 } ;
256- const commit = ( ) => {
251+ const commit = async ( ) => {
257252 const { client } = app ;
258- client
259- . element ( '//div[text()="Commit"]' )
260- . click ( )
261- . then ( delay ( 100 ) ) ;
253+ const el = await client . $ ( '//div[text()="Commit"]' ) ;
254+ await el . click ( ) . then ( delay ( 100 ) ) ;
262255 } ;
263256
264257 const expectActions = {
@@ -304,13 +297,12 @@ describe('Application launch', () => {
304297 }
305298 } ;
306299
307- const checkInstance = async name => {
300+ const checkInstance = async ( name ) => {
308301 const { client } = app ;
309302
310303 await selectInstance ( name ) ;
311- const val = await client
312- . element ( '//div[contains(@class, "actionListRows-")]' )
313- . getText ( ) ;
304+ const el = await client . $ ( '//div[contains(@class, "actionListRows-")]' ) ;
305+ const val = await el . getText ( ) ;
314306 runExpectActions ( name , val ) ;
315307 await commit ( ) ;
316308 } ;
@@ -333,7 +325,7 @@ describe('Application launch', () => {
333325 const { client } = app ;
334326 const logs = await client . getRenderProcessLogs ( ) ;
335327 // Print renderer process logs
336- logs . forEach ( log =>
328+ logs . forEach ( ( log ) =>
337329 console . log (
338330 `Message: ${ log . message } \nSource: ${ log . source } \nLevel: ${ log . level } ` ,
339331 ) ,
@@ -350,13 +342,10 @@ describe('Application launch', () => {
350342 } ) ;
351343
352344 it ( 'should show apollo devtools panel' , async ( ) => {
353- const { client } = app ;
354345 expect (
355- (
356- await client . execute (
357- ( ) => window . __APOLLO_DEVTOOLS_SHOULD_DISPLAY_PANEL__ ,
358- )
359- ) . value ,
346+ await app . webContents . executeJavaScript (
347+ 'window.__APOLLO_DEVTOOLS_SHOULD_DISPLAY_PANEL__'
348+ ) ,
360349 ) . toBeTruthy ( ) ;
361350 } ) ;
362351 } ) ;
0 commit comments