@@ -14,8 +14,8 @@ import { InteractivePanel } from '../../datascience-ui/history-react/interactive
1414import { VariableExplorer } from '../../datascience-ui/interactive-common/variableExplorer' ;
1515import { NativeEditor } from '../../datascience-ui/native-editor/nativeEditor' ;
1616import { DataScienceIocContainer } from './dataScienceIocContainer' ;
17- import { addCode } from './interactiveWindowTestHelpers' ;
18- import { addCell , createNewEditor } from './nativeEditorTestHelpers' ;
17+ import { addCode , runMountedTest as interactiveRunMountedTest } from './interactiveWindowTestHelpers' ;
18+ import { addCell , createNewEditor , runMountedTest as nativeRunMountedTest } from './nativeEditorTestHelpers' ;
1919import { waitForUpdate } from './reactHelpers' ;
2020import { runDoubleTest , waitForMessage } from './testHelpers' ;
2121
@@ -65,6 +65,34 @@ suite('DataScience Interactive Window variable explorer tests', () => {
6565 return waitForMessage ( ioc , InteractiveWindowMessages . VariablesComplete ) ;
6666 }
6767
68+ async function checkVariableLoading ( wrapper : ReactWrapper < any , Readonly < { } > , React . Component > , targetRenderCount : number ) {
69+ const basicCode : string = `value = 'hello world'` ;
70+
71+ openVariableExplorer ( wrapper ) ;
72+
73+ await addCodeImpartial ( wrapper , 'a=1\na' ) ;
74+ await addCodeImpartial ( wrapper , basicCode , false , 4 ) ;
75+
76+ // Target a render count before loading is finished
77+ await waitForUpdate ( wrapper , VariableExplorer , targetRenderCount ) ;
78+
79+ let targetVariables : IJupyterVariable [ ] = [
80+ { name : 'a' , value : '1' , supportsDataExplorer : false , type : 'int' , size : 54 , shape : '' , count : 0 , truncated : false } ,
81+ { name : 'value' , value : 'Loading...' , supportsDataExplorer : false , type : 'str' , size : 54 , shape : '' , count : 0 , truncated : false }
82+ ] ;
83+ verifyVariables ( wrapper , targetVariables ) ;
84+
85+ // Now wait for one more update and then check the variables, we should have loaded the value var
86+ await waitForUpdate ( wrapper , VariableExplorer , 1 ) ;
87+
88+ targetVariables = [
89+ { name : 'a' , value : '1' , supportsDataExplorer : false , type : 'int' , size : 54 , shape : '' , count : 0 , truncated : false } ,
90+ // tslint:disable-next-line:quotemark
91+ { name : 'value' , value : "'hello world'" , supportsDataExplorer : false , type : 'str' , size : 54 , shape : '' , count : 0 , truncated : false }
92+ ] ;
93+ verifyVariables ( wrapper , targetVariables ) ;
94+ }
95+
6896 async function addCodeImpartial ( wrapper : ReactWrapper < any , Readonly < { } > , React . Component > , code : string , waitForVariables : boolean = true , expectedRenderCount : number = 4 , expectError : boolean = false ) : Promise < ReactWrapper < any , Readonly < { } > , React . Component > > {
6997 const variablesUpdated = waitForVariables ? waitForVariablesUpdated ( ) : Promise . resolve ( ) ;
7098 const nodes = wrapper . find ( 'InteractivePanel' ) ;
@@ -153,33 +181,14 @@ value = 'hello world'`;
153181 verifyVariables ( wrapper , targetVariables ) ;
154182 } , ( ) => { return ioc ; } ) ;
155183
156- runDoubleTest ( 'Variable explorer - Loading' , async ( wrapper ) => {
157- const basicCode : string = `value = 'hello world'` ;
158-
159- openVariableExplorer ( wrapper ) ;
160-
161- await addCodeImpartial ( wrapper , 'a=1\na' ) ;
162- await addCodeImpartial ( wrapper , basicCode , false , 4 ) ;
163-
164- // Here we are only going to wait for two renders instead of the needed three
165- // a should have the value updated, but value should still be loading
166- await waitForUpdate ( wrapper , VariableExplorer , 2 ) ;
167-
168- let targetVariables : IJupyterVariable [ ] = [
169- { name : 'a' , value : '1' , supportsDataExplorer : false , type : 'int' , size : 54 , shape : '' , count : 0 , truncated : false } ,
170- { name : 'value' , value : 'Loading...' , supportsDataExplorer : false , type : 'str' , size : 54 , shape : '' , count : 0 , truncated : false }
171- ] ;
172- verifyVariables ( wrapper , targetVariables ) ;
173-
174- // Now wait for one more update and then check the variables, we should have loaded the value var
175- await waitForUpdate ( wrapper , VariableExplorer , 1 ) ;
184+ // For the loading tests we check before the explorer is fully loaded, so split tests here to check
185+ // with different target render counts
186+ nativeRunMountedTest ( 'Variable Explorer - Native Loading' , async ( wrapper ) => {
187+ await checkVariableLoading ( wrapper , 3 ) ;
188+ } , ( ) => { return ioc ; } ) ;
176189
177- targetVariables = [
178- { name : 'a' , value : '1' , supportsDataExplorer : false , type : 'int' , size : 54 , shape : '' , count : 0 , truncated : false } ,
179- // tslint:disable-next-line:quotemark
180- { name : 'value' , value : "'hello world'" , supportsDataExplorer : false , type : 'str' , size : 54 , shape : '' , count : 0 , truncated : false }
181- ] ;
182- verifyVariables ( wrapper , targetVariables ) ;
190+ interactiveRunMountedTest ( 'Variable Explorer - Interactive Loading' , async ( wrapper ) => {
191+ await checkVariableLoading ( wrapper , 2 ) ;
183192 } , ( ) => { return ioc ; } ) ;
184193
185194 // Test our display of basic types. We render 8 rows by default so only 8 values per test
0 commit comments