@@ -15,9 +15,10 @@ describe('Main', () => {
15
15
expect ( title ) . toBe ( 'React Native Debugger - Connected (port 8081)' ) ;
16
16
} ) ;
17
17
18
+ const delay200 = ( ) => delay ( 200 ) ;
19
+ const delay500 = ( ) => delay ( 500 ) ;
20
+
18
21
describe ( 'Context Menu' , ( ) => {
19
- const delay200 = ( ) => delay ( 200 ) ;
20
- const delay500 = ( ) => delay ( 500 ) ;
21
22
it ( 'should show AsyncStorage content as expected' , async ( ) => {
22
23
const { client } = rndebugger ;
23
24
await client . execute ( ( ) => window . invokeDevMethod ( 'showAsyncStorage' ) ) . then ( delay200 ) ;
@@ -43,10 +44,9 @@ describe('Main', () => {
43
44
. tap ( )
44
45
. then ( delay500 ) ;
45
46
46
- await client . execute ( ( ) => window . invokeDevMethod ( 'clearAsyncStorage' ) ) . then ( delay200 ) ;
47
+ await client . execute ( ( ) => window . invokeDevMethod ( 'clearAsyncStorage' ) ) . then ( delay500 ) ;
47
48
await client . execute ( ( ) => window . invokeDevMethod ( 'showAsyncStorage' ) ) . then ( delay200 ) ;
48
49
const logs = await client . getRenderProcessLogs ( ) ;
49
- // Print renderer process logs
50
50
expect (
51
51
logs . some ( log => log . message . indexOf ( '[RNDebugger] No AsyncStorage content.' ) > - 1 )
52
52
) . toBeTruthy ( ) ;
@@ -64,7 +64,6 @@ describe('Main', () => {
64
64
65
65
await client . execute ( ( ) => window . invokeDevMethod ( 'networkInspect' ) ) . then ( delay200 ) ;
66
66
const logs = await client . getRenderProcessLogs ( ) ;
67
- // Print renderer process logs
68
67
expect (
69
68
logs . some (
70
69
log =>
@@ -74,4 +73,32 @@ describe('Main', () => {
74
73
) . toBeTruthy ( ) ;
75
74
} ) ;
76
75
} ) ;
76
+
77
+ describe ( 'React DevTools' , ( ) => {
78
+ const waitingForReactConnect = client =>
79
+ client . waitUntilTextExists (
80
+ '#react-devtools-container > div > div:nth-child(1) > ul > li:nth-child(1)' ,
81
+ 'Elements' ,
82
+ 1000
83
+ ) ;
84
+
85
+ it ( 'should connected to React DevTools' , async ( ) => {
86
+ const { client } = rndebugger ;
87
+ await waitingForReactConnect ( client ) ;
88
+ } ) ;
89
+
90
+ it ( 'should reconnect to React DevTools if open the tab' , async ( ) => {
91
+ const { client } = rndebugger ;
92
+ await waitingForReactConnect ( client ) ;
93
+ await rndebugger . webContents . send ( 'toggle-devtools' , 'react' ) . then ( delay500 ) ;
94
+
95
+ const logs = await client . getRenderProcessLogs ( ) ;
96
+ expect ( logs . some ( log => log . message . indexOf ( 'closing devtools' ) > - 1 ) ) . toBeTruthy ( ) ;
97
+
98
+ await rndebugger . webContents . send ( 'toggle-devtools' , 'react' ) . then ( ( ) => delay ( 2000 ) ) ;
99
+
100
+ await client . getRenderProcessLogs ( ) ;
101
+ await waitingForReactConnect ( client ) ;
102
+ } ) ;
103
+ } ) ;
77
104
} ) ;
0 commit comments