@@ -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 } from "../config/constants" ;
5+ import { GRAPH_ID , Node_Add_Edge , Node_Import_Data } from "../config/constants" ;
66import { delay } from "../logic/utils" ;
77import { searchData , specialCharacters } from "../config/testData" ;
88import { CanvasAnalysisResult } from "../logic/canvasAnalysis" ;
@@ -126,4 +126,30 @@ test.describe("Code graph tests", () => {
126126 expect ( initialNodeAnalysis . red . length ) . toBeGreaterThan ( updatedNodeAnalysis . red . length ) ;
127127 } ) ;
128128
129+ colors . forEach ( ( color , index ) => {
130+ const checkboxIndex = index + 1 ;
131+ test ( `Verify that unchecking the ${ color } checkbox hides ${ color } nodes on the canvas` , async ( ) => {
132+ const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
133+ await codeGraph . selectGraph ( GRAPH_ID ) ;
134+ await codeGraph . selectCodeGraphCheckbox ( checkboxIndex . toString ( ) ) ;
135+ const result = await codeGraph . getCanvasAnalysis ( ) ;
136+ expect ( result [ color ] . length ) . toBe ( 0 ) ;
137+ } ) ;
138+ } )
139+
140+ test ( `Verify "Clear graph" button resets canvas view` , async ( ) => {
141+ const codeGraph = await browser . createNewPage ( CodeGraph , urls . baseUrl ) ;
142+ await codeGraph . selectGraph ( GRAPH_ID ) ;
143+ const initialAnalysis = await codeGraph . getCanvasAnalysis ( ) ;
144+ const initialNodeCount = initialAnalysis . green . length + initialAnalysis . yellow . length + initialAnalysis . red . length ;
145+ await codeGraph . clickOnshowPathBtn ( ) ;
146+ await codeGraph . insertInputForShowPath ( "1" , Node_Import_Data ) ;
147+ await codeGraph . insertInputForShowPath ( "2" , Node_Add_Edge ) ;
148+ await codeGraph . clickOnClearGraphBtn ( ) ;
149+ const finalAnalysis = await codeGraph . getCanvasAnalysis ( ) ;
150+ const finalNodeCount = finalAnalysis . green . length + finalAnalysis . yellow . length + finalAnalysis . red . length ;
151+ expect ( initialNodeCount ) . toBe ( finalNodeCount ) ;
152+
153+ } ) ;
154+
129155} ) ;
0 commit comments