@@ -5,8 +5,9 @@ import { byTestId, testIds } from '../../support/selectors';
55
66describe ( 'File Handling and Processing' , ( ) => {
77 const nodeFile = 'AngularTesting_nodelist_withseqs_TN93_BS.csv' ;
8+ const compatibleNodeFile = 'AngularTesting_nodes_Map.csv' ;
89 const linkFile = 'AngularTesting_Epi_linklist_BS.csv' ;
9- const additionalNodeFile = 'AngularTesting_nodes_Map.csv' ;
10+ const additionalNodeFile = compatibleNodeFile ;
1011 const loadNodeFile = ( ) => cy . loadFiles ( [ { name : nodeFile , datatype : 'node' } ] ) ;
1112
1213 beforeEach ( ( ) => {
@@ -235,4 +236,155 @@ describe('File Handling and Processing', () => {
235236 expect ( fileNames ) . to . include . members ( [ nodeFile , linkFile , additionalNodeFile ] ) ;
236237 } ) ;
237238 } ) ;
239+
240+ it ( 'preserves analysis styling when files are removed and added back' , ( ) => {
241+ const customNodeColor = '#cc3366' ;
242+
243+ cy . loadFiles ( [
244+ { name : nodeFile , datatype : 'node' } ,
245+ { name : linkFile , datatype : 'link' } ,
246+ ] ) ;
247+
248+ cy . get ( '#launch' ) . click ( { force : true } ) ;
249+ cy . window ( { timeout : 30000 } )
250+ . its ( 'commonService.session.network.isFullyLoaded' )
251+ . should ( 'be.true' ) ;
252+
253+ cy . window ( ) . then ( ( win ) => {
254+ const microbeTrace = win . commonService . visuals . microbeTrace ;
255+ microbeTrace . SelectedNodeColorVariable = customNodeColor ;
256+ microbeTrace . onNodeColorChanged ( true ) ;
257+ } ) ;
258+ cy . window ( )
259+ . its ( 'commonService.session.style.widgets.node-color' )
260+ . should ( 'equal' , customNodeColor ) ;
261+
262+ cy . contains ( '#file-table .file-table-row' , linkFile )
263+ . find ( '.flaticon-delete-1' )
264+ . click ( { force : true } ) ;
265+ cy . contains ( '#file-table .file-table-row' , linkFile ) . should ( 'not.exist' ) ;
266+ cy . get ( '#launch' ) . click ( { force : true } ) ;
267+ cy . window ( { timeout : 30000 } )
268+ . its ( 'commonService.session.network.isFullyLoaded' )
269+ . should ( 'be.true' ) ;
270+ cy . window ( )
271+ . its ( 'commonService.session.style.widgets.node-color' )
272+ . should ( 'equal' , customNodeColor ) ;
273+
274+ cy . loadFiles ( [ { name : linkFile , datatype : 'link' } ] ) ;
275+ cy . get ( '#launch' ) . click ( { force : true } ) ;
276+ cy . window ( { timeout : 30000 } )
277+ . its ( 'commonService.session.network.isFullyLoaded' )
278+ . should ( 'be.true' ) ;
279+ cy . window ( )
280+ . its ( 'commonService.session.style.widgets.node-color' )
281+ . should ( 'equal' , customNodeColor ) ;
282+ } ) ;
283+
284+ it ( 'preserves field-backed styling when files are updated without resetting settings' , ( ) => {
285+ const customNodeColor = '#cc3366' ;
286+ const shapeVariable = 'subtype' ;
287+
288+ cy . loadFiles ( [
289+ { name : nodeFile , datatype : 'node' } ,
290+ { name : linkFile , datatype : 'link' } ,
291+ ] ) ;
292+
293+ cy . get ( '#launch' ) . click ( { force : true } ) ;
294+ cy . window ( { timeout : 30000 } )
295+ . its ( 'commonService.session.network.isFullyLoaded' )
296+ . should ( 'be.true' ) ;
297+
298+ cy . window ( ) . then ( ( win ) => {
299+ const microbeTrace = win . commonService . visuals . microbeTrace ;
300+ microbeTrace . SelectedNodeColorVariable = customNodeColor ;
301+ microbeTrace . onNodeColorChanged ( true ) ;
302+ microbeTrace . onNodeShapeByChanged ( true , false , shapeVariable ) ;
303+ } ) ;
304+ cy . window ( )
305+ . its ( 'commonService.session.style.widgets.node-color' )
306+ . should ( 'equal' , customNodeColor ) ;
307+ cy . window ( )
308+ . its ( 'commonService.session.style.widgets.node-symbol-variable' )
309+ . should ( 'equal' , shapeVariable ) ;
310+
311+ cy . contains ( '#file-table .file-table-row' , nodeFile )
312+ . find ( '.flaticon-delete-1' )
313+ . click ( { force : true } ) ;
314+ cy . get ( '#launch' ) . click ( { force : true } ) ;
315+ cy . window ( { timeout : 30000 } )
316+ . its ( 'commonService.session.network.isFullyLoaded' )
317+ . should ( 'be.true' ) ;
318+ cy . window ( ) . then ( ( win ) => {
319+ expect ( win . commonService . session . data . nodeFields ) . not . to . include ( shapeVariable ) ;
320+ expect ( win . commonService . session . style . widgets [ 'node-symbol-variable' ] ) . to . equal ( shapeVariable ) ;
321+ expect ( win . commonService . GlobalSettingsModel . SelectedNodeSymbolVariable ) . to . equal ( shapeVariable ) ;
322+ expect ( win . commonService . session . style . widgets [ 'node-color' ] ) . to . equal ( customNodeColor ) ;
323+ } ) ;
324+
325+ cy . loadFiles ( [ { name : compatibleNodeFile , datatype : 'node' , field1 : '_id' , field2 : 'seq' } ] ) ;
326+ cy . get ( '#launch' ) . should ( 'contain.text' , 'Update' ) . click ( { force : true } ) ;
327+ cy . window ( { timeout : 30000 } )
328+ . its ( 'commonService.session.network.isFullyLoaded' )
329+ . should ( 'be.true' ) ;
330+ cy . window ( ) . then ( ( win ) => {
331+ expect ( win . commonService . session . data . nodeFields ) . to . include ( shapeVariable ) ;
332+ expect ( win . commonService . session . style . widgets [ 'node-symbol-variable' ] ) . to . equal ( shapeVariable ) ;
333+ expect ( win . commonService . GlobalSettingsModel . SelectedNodeSymbolVariable ) . to . equal ( shapeVariable ) ;
334+ expect ( win . commonService . session . style . widgets [ 'node-color' ] ) . to . equal ( customNodeColor ) ;
335+ } ) ;
336+ } ) ;
337+
338+ it ( 'resets all settings when files are updated with reset settings' , ( ) => {
339+ const customNodeColor = '#cc3366' ;
340+ const shapeVariable = 'subtype' ;
341+
342+ cy . loadFiles ( [
343+ { name : nodeFile , datatype : 'node' } ,
344+ { name : linkFile , datatype : 'link' } ,
345+ ] ) ;
346+
347+ cy . get ( '#launch' ) . click ( { force : true } ) ;
348+ cy . window ( { timeout : 30000 } )
349+ . its ( 'commonService.session.network.isFullyLoaded' )
350+ . should ( 'be.true' ) ;
351+
352+ cy . window ( ) . then ( ( win ) => {
353+ const microbeTrace = win . commonService . visuals . microbeTrace ;
354+ microbeTrace . SelectedNodeColorVariable = customNodeColor ;
355+ microbeTrace . onNodeColorChanged ( true ) ;
356+ microbeTrace . onNodeShapeByChanged ( true , false , shapeVariable ) ;
357+ win . commonService . session . style . widgets [ 'default-distance-metric' ] = 'tn93' ;
358+ win . commonService . session . style . widgets [ 'link-threshold' ] = 0.015 ;
359+ win . commonService . session . style . widgets [ 'default-view' ] = 'Map' ;
360+ win . commonService . GlobalSettingsModel . SelectedDistanceMetricVariable = 'tn93' ;
361+ win . commonService . GlobalSettingsModel . SelectedLinkThresholdVariable = 0.015 ;
362+ } ) ;
363+
364+ cy . contains ( '#file-table .file-table-row' , nodeFile )
365+ . find ( '.flaticon-delete-1' )
366+ . click ( { force : true } ) ;
367+ cy . get ( '#launch-reset-settings' , { timeout : 20000 } )
368+ . should ( 'exist' )
369+ . click ( { force : true } ) ;
370+ cy . window ( { timeout : 30000 } )
371+ . its ( 'commonService.session.network.isFullyLoaded' )
372+ . should ( 'be.true' ) ;
373+
374+ cy . window ( ) . then ( ( win ) => {
375+ const widgets = win . commonService . session . style . widgets ;
376+
377+ expect ( win . commonService . session . data . nodeFields ) . not . to . include ( shapeVariable ) ;
378+ expect ( widgets [ 'node-color' ] ) . to . equal ( '#1f77b4' ) ;
379+ expect ( win . commonService . session . style . widgets [ 'node-symbol-variable' ] ) . to . equal ( 'None' ) ;
380+ expect ( widgets [ 'default-distance-metric' ] ) . to . equal ( 'snps' ) ;
381+ expect ( widgets [ 'link-threshold' ] ) . to . equal ( 16 ) ;
382+ expect ( widgets [ 'default-view' ] ) . to . equal ( '2D Network' ) ;
383+ expect ( win . commonService . GlobalSettingsModel . SelectedNodeSymbolVariable ) . to . equal ( 'None' ) ;
384+ expect ( win . commonService . GlobalSettingsModel . SelectedDistanceMetricVariable ) . to . equal ( 'snps' ) ;
385+ expect ( win . commonService . GlobalSettingsModel . SelectedLinkThresholdVariable ) . to . equal ( 16 ) ;
386+ expect ( win . commonService . session . style . nodeColorsTable ) . to . deep . equal ( { } ) ;
387+ expect ( win . commonService . session . style . nodeSymbolsTable ) . to . deep . equal ( { } ) ;
388+ } ) ;
389+ } ) ;
238390} ) ;
0 commit comments