@@ -252,17 +252,14 @@ test.describe("Code graph tests", () => {
252252 await codeGraph . clickOnshowPathBtn ( ) ;
253253 await codeGraph . insertInputForShowPath ( "1" , firstNode ) ;
254254 await codeGraph . insertInputForShowPath ( "2" , secondNode ) ;
255- const result = await codeGraph . getCanvasAnalysis ( ) ;
256- console . log ( result ) ;
257-
255+ const result = await codeGraph . getCanvasAnalysis ( ) ;
258256 const res = [ ] ;
259257 for ( const node of result . green ) {
260258 await codeGraph . rightClickOnNode ( node . x , node . y ) ;
261259 const details = await codeGraph . getNodeDetailsHeader ( ) ;
262260 await codeGraph . clickOnNodeDetailsCloseBtn ( ) ;
263261 res . push ( details ) ;
264262 }
265- console . log ( res ) ;
266263
267264 expect ( res . some ( ( item ) => item . includes ( firstNode . toUpperCase ( ) ) ) ) . toBe ( true ) ;
268265 expect ( res . some ( ( item ) => item . includes ( secondNode . toUpperCase ( ) ) ) ) . toBe ( true ) ;
@@ -302,5 +299,30 @@ test.describe("Code graph tests", () => {
302299 ) ;
303300 expect ( containsDetails ) . toBe ( true ) ;
304301 } ) ;
305-
306- } ) ;
302+
303+ test ( `Validate view node panel keys for required and optional fields` , async ( ) => {
304+ const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
305+ await codeGraph . selectGraph ( GRAPH_ID ) ;
306+ const analysis = await codeGraph . getCanvasAnalysis ( ) ;
307+ const requiredKeys : string [ ] = [ 'id' , 'name' , 'args' , 'path' , 'src_end' , 'src_start' ] ;
308+ const optionalKeys : string [ ] = [ 'src' ] ;
309+ await Promise . all (
310+ analysis . green . slice ( 0 , 2 ) . map ( async ( node ) => {
311+ await codeGraph . rightClickOnNode ( node . x , node . y ) ;
312+ const elements = await codeGraph . getNodeDetailsPanelElements ( ) ;
313+
314+ requiredKeys . forEach ( ( key ) => {
315+ const isKeyPresent = elements . some ( ( element ) => element . includes ( key ) ) ;
316+ expect ( isKeyPresent ) . toBe ( true ) ;
317+ } ) ;
318+ optionalKeys . forEach ( ( key ) => {
319+ const isKeyPresent = elements . some ( ( element ) => element . includes ( key ) ) ;
320+ if ( isKeyPresent ) {
321+ expect ( isKeyPresent ) . toBe ( true ) ;
322+ }
323+ } ) ;
324+ } )
325+ ) ;
326+ } ) ;
327+
328+ } ) ;
0 commit comments