@@ -3,7 +3,7 @@ import BrowserWrapper from "../infra/ui/browserWrapper";
33import CodeGraph from "../logic/POM/codeGraph" ;
44import urls from "../config/urls.json" ;
55import { GRAPHRAG_SDK } from "../config/constants" ;
6- import { delay , findNodeByName } from "../logic/utils" ;
6+ import { findNodeByName } from "../logic/utils" ;
77import { nodesPath , categories , nodes , graphs } from "../config/testData" ;
88import { ApiCalls } from "../logic/api/apiCalls" ;
99import fs from 'fs' ;
@@ -50,8 +50,9 @@ test.describe("Canvas tests", () => {
5050 await codeGraph . clickZoomOut ( ) ;
5151 await codeGraph . clickCenter ( ) ;
5252 const updatedGraph = await codeGraph . getCanvasScaling ( ) ;
53- expect ( Math . abs ( initialGraph . scaleX - updatedGraph . scaleX ) ) . toBeLessThanOrEqual ( 0.1 ) ;
54- expect ( Math . abs ( initialGraph . scaleY - updatedGraph . scaleY ) ) . toBeLessThanOrEqual ( 0.1 ) ;
53+ expect ( Math . abs ( initialGraph . scaleX - updatedGraph . scaleX ) ) . toBeLessThanOrEqual ( 0.2 ) ;
54+ expect ( Math . abs ( initialGraph . scaleY - updatedGraph . scaleY ) ) . toBeLessThanOrEqual ( 0.2 ) ;
55+
5556 } )
5657
5758 nodes . slice ( 0 , 2 ) . forEach ( ( node ) => {
@@ -62,8 +63,8 @@ test.describe("Canvas tests", () => {
6263 const targetNode = findNodeByName ( initialGraph , node . nodeName ) ;
6364 await codeGraph . nodeClick ( targetNode . screenX , targetNode . screenY ) ;
6465 await codeGraph . clickOnRemoveNodeViaElementMenu ( ) ;
65- const updatedGraph = await codeGraph . getGraphDetails ( ) ;
66- const targetNodeForUpdateGraph = findNodeByName ( updatedGraph . elements . nodes , node . nodeName ) ;
66+ const updatedGraph = await codeGraph . getGraphNodes ( ) ;
67+ const targetNodeForUpdateGraph = findNodeByName ( updatedGraph , node . nodeName ) ;
6768 expect ( targetNodeForUpdateGraph . visible ) . toBe ( false ) ;
6869 } ) ;
6970 } )
@@ -77,8 +78,8 @@ test.describe("Canvas tests", () => {
7778 await codeGraph . nodeClick ( targetNode . screenX , targetNode . screenY ) ;
7879 await codeGraph . clickOnRemoveNodeViaElementMenu ( ) ;
7980 await codeGraph . clickOnUnhideNodesBtn ( ) ;
80- const updatedGraph = await codeGraph . getGraphDetails ( ) ;
81- const targetNodeForUpdateGraph = findNodeByName ( updatedGraph . elements . nodes , node . nodeName ) ;
81+ const updatedGraph = await codeGraph . getGraphNodes ( ) ;
82+ const targetNodeForUpdateGraph = findNodeByName ( updatedGraph , node . nodeName ) ;
8283 expect ( targetNodeForUpdateGraph . visible ) . toBe ( true ) ;
8384 } ) ;
8485 } )
@@ -89,9 +90,9 @@ test.describe("Canvas tests", () => {
8990 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
9091 await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
9192 await codeGraph . selectCodeGraphCheckbox ( checkboxIndex . toString ( ) ) ;
92- const result = await codeGraph . getGraphDetails ( ) ;
93- const findItem = result . categories . find ( ( item : { name : string ; } ) => item . name === category )
94- expect ( findItem . show ) . toBe ( false )
93+ const result = await codeGraph . getGraphNodes ( ) ;
94+ const findItem = result . find ( ( item : { category : string ; } ) => item . category === category ) ;
95+ expect ( findItem ?. visible ) . toBe ( false ) ;
9596 } ) ;
9697 } )
9798
@@ -103,15 +104,15 @@ test.describe("Canvas tests", () => {
103104 await codeGraph . clickOnShowPathBtn ( "Show the path" ) ;
104105 await codeGraph . insertInputForShowPath ( "1" , path . firstNode ) ;
105106 await codeGraph . insertInputForShowPath ( "2" , path . secondNode ) ;
106- const initialGraph = await codeGraph . getGraphDetails ( ) ;
107- const firstNode = findNodeByName ( initialGraph . elements . nodes , path . firstNode ) ;
108- const secondNode = findNodeByName ( initialGraph . elements . nodes , path . secondNode ) ;
107+ const initialGraph = await codeGraph . getGraphNodes ( ) ;
108+ const firstNode = findNodeByName ( initialGraph , path . firstNode ) ;
109+ const secondNode = findNodeByName ( initialGraph , path . secondNode ) ;
109110 expect ( firstNode . isPath ) . toBe ( true ) ;
110111 expect ( secondNode . isPath ) . toBe ( true ) ;
111112 await codeGraph . clickOnClearGraphBtn ( ) ;
112- const updateGraph = await codeGraph . getGraphDetails ( ) ;
113- const firstNode1 = findNodeByName ( updateGraph . elements . nodes , path . firstNode ) ;
114- const secondNode1 = findNodeByName ( updateGraph . elements . nodes , path . secondNode ) ;
113+ const updateGraph = await codeGraph . getGraphNodes ( ) ;
114+ const firstNode1 = findNodeByName ( updateGraph , path . firstNode ) ;
115+ const secondNode1 = findNodeByName ( updateGraph , path . secondNode ) ;
115116 expect ( firstNode1 . isPath ) . toBe ( false ) ;
116117 expect ( secondNode1 . isPath ) . toBe ( false ) ;
117118 } ) ;
0 commit comments