@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
22import BrowserWrapper from "../infra/ui/browserWrapper" ;
33import CodeGraph from "../logic/POM/codeGraph" ;
44import urls from "../config/urls.json" ;
5- import { GRAPH_ID , PROJECT_NAME } from "../config/constants" ;
5+ import { GRAPHRAG_SDK } from "../config/constants" ;
66import { delay , findNodeByName } from "../logic/utils" ;
77import { nodesPath , categories , nodes , graphs } from "../config/testData" ;
88import { ApiCalls } from "../logic/api/apiCalls" ;
@@ -21,7 +21,7 @@ test.describe("Canvas tests", () => {
2121
2222 test ( `Verify zoom in functionality on canvas` , async ( ) => {
2323 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
24- await codeGraph . selectGraph ( GRAPH_ID ) ;
24+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
2525 const initialGraph = await codeGraph . getCanvasScaling ( ) ;
2626 await codeGraph . clickZoomIn ( ) ;
2727 await codeGraph . clickZoomIn ( ) ;
@@ -32,7 +32,7 @@ test.describe("Canvas tests", () => {
3232
3333 test ( `Verify zoom out functionality on canvas` , async ( ) => {
3434 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
35- await codeGraph . selectGraph ( GRAPH_ID ) ;
35+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
3636 const initialGraph = await codeGraph . getCanvasScaling ( ) ;
3737 await codeGraph . clickZoomOut ( ) ;
3838 await codeGraph . clickZoomOut ( ) ;
@@ -43,7 +43,7 @@ test.describe("Canvas tests", () => {
4343
4444 test ( `Verify center graph button centers nodes in canvas` , async ( ) => {
4545 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
46- await codeGraph . selectGraph ( GRAPH_ID ) ;
46+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
4747 await codeGraph . clickCenter ( ) ;
4848 const initialGraph = await codeGraph . getCanvasScaling ( ) ;
4949 await codeGraph . clickZoomOut ( ) ;
@@ -57,7 +57,7 @@ test.describe("Canvas tests", () => {
5757 nodes . slice ( 0 , 2 ) . forEach ( ( node ) => {
5858 test ( `Validate node hide functionality via element menu in canvas for ${ node . nodeName } ` , async ( ) => {
5959 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
60- await codeGraph . selectGraph ( GRAPH_ID ) ;
60+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
6161 const initialGraph = await codeGraph . getGraphDetails ( ) ;
6262 const convertCoordinates = await codeGraph . transformNodeCoordinates ( initialGraph ) ;
6363 const targetNode = findNodeByName ( convertCoordinates , node . nodeName ) ;
@@ -72,7 +72,7 @@ test.describe("Canvas tests", () => {
7272 nodes . slice ( 0 , 2 ) . forEach ( ( node ) => {
7373 test ( `Validate unhide node functionality after hiding a node in canvas for ${ node . nodeName } ` , async ( ) => {
7474 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
75- await codeGraph . selectGraph ( GRAPH_ID ) ;
75+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
7676 const initialGraph = await codeGraph . getGraphDetails ( ) ;
7777 const convertCoordinates = await codeGraph . transformNodeCoordinates ( initialGraph ) ;
7878 const targetNode = findNodeByName ( convertCoordinates , node . nodeName ) ;
@@ -89,7 +89,7 @@ test.describe("Canvas tests", () => {
8989 const checkboxIndex = index + 1 ;
9090 test ( `Verify that unchecking the ${ category } checkbox hides ${ category } nodes on the canvas` , async ( ) => {
9191 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
92- await codeGraph . selectGraph ( GRAPH_ID ) ;
92+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
9393 await codeGraph . selectCodeGraphCheckbox ( checkboxIndex . toString ( ) ) ;
9494 const result = await codeGraph . getGraphDetails ( ) ;
9595 const findItem = result . categories . find ( ( item : { name : string ; } ) => item . name === category )
@@ -100,8 +100,9 @@ test.describe("Canvas tests", () => {
100100 nodesPath . forEach ( ( path ) => {
101101 test ( `Verify "Clear graph" button resets canvas view for path ${ path . firstNode } and ${ path . secondNode } ` , async ( ) => {
102102 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
103- await codeGraph . selectGraph ( GRAPH_ID ) ;
104- await codeGraph . clickOnShowPathBtn ( ) ;
103+ await browser . setPageToFullScreen ( ) ;
104+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
105+ await codeGraph . clickOnShowPathBtn ( "Show the path" ) ;
105106 await codeGraph . insertInputForShowPath ( "1" , path . firstNode ) ;
106107 await codeGraph . insertInputForShowPath ( "2" , path . secondNode ) ;
107108 const initialGraph = await codeGraph . getGraphDetails ( ) ;
@@ -127,12 +128,12 @@ test.describe("Canvas tests", () => {
127128 expect ( result . elements . links . length ) . toBeGreaterThan ( 1 ) ;
128129 } ) ;
129130 } )
130-
131+
131132 for ( let index = 0 ; index < 3 ; index ++ ) {
132133 const nodeIndex : number = index + 1 ;
133134 test ( `Validate canvas node dragging for node: ${ index } ` , async ( ) => {
134135 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
135- await codeGraph . selectGraph ( GRAPH_ID ) ;
136+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
136137 const initialGraph = await codeGraph . getGraphDetails ( ) ;
137138 const convertCoordinates = await codeGraph . transformNodeCoordinates ( initialGraph ) ;
138139 await codeGraph . changeNodePosition ( convertCoordinates [ nodeIndex ] . screenX , convertCoordinates [ nodeIndex ] . screenY ) ;
@@ -144,21 +145,21 @@ test.describe("Canvas tests", () => {
144145
145146 test ( `Validate node and edge counts in canvas match API data` , async ( ) => {
146147 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
147- await codeGraph . selectGraph ( GRAPH_ID ) ;
148+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
148149 const { nodes, edges } = await codeGraph . getMetricsPanelInfo ( ) ;
149150 const api = new ApiCalls ( ) ;
150- const response = await api . projectInfo ( PROJECT_NAME ) ;
151+ const response = await api . projectInfo ( GRAPHRAG_SDK ) ;
151152 expect ( response . result . info . node_count ) . toEqual ( parseInt ( nodes ) ) ;
152153 expect ( response . result . info . edge_count ) . toEqual ( parseInt ( edges ) ) ;
153154 } ) ;
154155
155156
156157 test ( `Validate displayed nodes match API response after selecting a graph via UI` , async ( ) => {
157158 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
158- await codeGraph . selectGraph ( GRAPH_ID ) ;
159+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
159160 const graphData = await codeGraph . getGraphDetails ( ) ;
160161 const api = new ApiCalls ( ) ;
161- const response = await api . getProject ( PROJECT_NAME ) ;
162+ const response = await api . getProject ( GRAPHRAG_SDK ) ;
162163 const isMatching = graphData . elements . nodes . slice ( 0 , 2 ) . every (
163164 ( node : any , index : number ) => node . name === response . result . entities . nodes [ index ] . properties . name
164165 ) ;
@@ -168,8 +169,8 @@ test.describe("Canvas tests", () => {
168169 nodesPath . forEach ( ( { firstNode, secondNode} ) => {
169170 test ( `Verify successful node path connection in canvas between ${ firstNode } and ${ secondNode } via UI` , async ( ) => {
170171 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
171- await codeGraph . selectGraph ( GRAPH_ID ) ;
172- await codeGraph . clickOnShowPathBtn ( ) ;
172+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
173+ await codeGraph . clickOnShowPathBtn ( "Show the path" ) ;
173174 await codeGraph . insertInputForShowPath ( "1" , firstNode ) ;
174175 await codeGraph . insertInputForShowPath ( "2" , secondNode ) ;
175176 const result = await codeGraph . getGraphDetails ( ) ;
@@ -183,16 +184,16 @@ test.describe("Canvas tests", () => {
183184 nodesPath . forEach ( ( path ) => {
184185 test ( `Validate node path connection in canvas ui and confirm via api for path ${ path . firstNode } and ${ path . secondNode } ` , async ( ) => {
185186 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
186- await codeGraph . selectGraph ( GRAPH_ID ) ;
187- await codeGraph . clickOnShowPathBtn ( ) ;
187+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
188+ await codeGraph . clickOnShowPathBtn ( "Show the path" ) ;
188189 await codeGraph . insertInputForShowPath ( "1" , path . firstNode ) ;
189190 await codeGraph . insertInputForShowPath ( "2" , path . secondNode ) ;
190191 const result = await codeGraph . getGraphDetails ( ) ;
191192 const firstNodeRes = findNodeByName ( result . elements . nodes , path . firstNode ) ;
192193 const secondNodeRes = findNodeByName ( result . elements . nodes , path . secondNode ) ;
193194
194195 const api = new ApiCalls ( ) ;
195- const response = await api . showPath ( PROJECT_NAME , firstNodeRes . id , secondNodeRes . id ) ;
196+ const response = await api . showPath ( GRAPHRAG_SDK , firstNodeRes . id , secondNodeRes . id ) ;
196197 const callsRelationObject = response . result . paths [ 0 ] . find ( item => item . relation === "CALLS" )
197198 expect ( callsRelationObject ?. src_node ) . toBe ( firstNodeRes . id ) ;
198199 expect ( callsRelationObject ?. dest_node ) . toBe ( secondNodeRes . id ) ;
@@ -201,7 +202,7 @@ test.describe("Canvas tests", () => {
201202
202203 test ( `Verify file download is triggered and saved after clicking download` , async ( ) => {
203204 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
204- await codeGraph . selectGraph ( GRAPH_ID ) ;
205+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
205206 const download = await codeGraph . downloadImage ( ) ;
206207 const downloadPath = await download . path ( ) ;
207208 expect ( fs . existsSync ( downloadPath ) ) . toBe ( true ) ;
@@ -211,7 +212,7 @@ test.describe("Canvas tests", () => {
211212 test ( `Verify tooltip appears when hovering over node: ${ node . nodeName } ` , async ( ) => {
212213 const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
213214 await browser . setPageToFullScreen ( ) ;
214- await codeGraph . selectGraph ( GRAPH_ID ) ;
215+ await codeGraph . selectGraph ( GRAPHRAG_SDK ) ;
215216 await codeGraph . getGraphDetails ( ) ;
216217 await codeGraph . fillSearchBar ( node . nodeName ) ;
217218 await codeGraph . selectSearchBarOptionBtn ( "1" ) ;
0 commit comments