@@ -39,11 +39,11 @@ export default class CodeGraph extends BasePage {
3939 }
4040
4141 private get selectGraphInComboBox ( ) : ( graph : string ) => Locator {
42- return ( graph : string ) => this . page . locator ( `//div[@role='presentation']//div[@role='option'][ ${ graph } ]` ) ;
42+ return ( graph : string ) => this . page . locator ( `//div[@role='presentation']//div//span[contains(text(), ' ${ graph } ') ]` ) ;
4343 }
4444
4545 private get lastElementInChat ( ) : Locator {
46- return this . page . locator ( "//main[@data-name='main-chat']/*[last()]/p " ) ;
46+ return this . page . locator ( "//main[@data-name='main-chat']/*[last()]/span " ) ;
4747 }
4848
4949 private get typeUrlInput ( ) : Locator {
@@ -161,10 +161,6 @@ export default class CodeGraph extends BasePage {
161161 return this . page . locator ( "//button[@title='Center']" ) ;
162162 }
163163
164- private get removeNodeViaElementMenu ( ) : Locator {
165- return this . page . locator ( "//button[@title='Remove']" ) ;
166- }
167-
168164 private get codeGraphCheckbox ( ) : ( checkbox : string ) => Locator {
169165 return ( checkbox : string ) => this . page . locator ( `(//button[@role='checkbox'])[${ checkbox } ]` ) ;
170166 }
@@ -173,6 +169,21 @@ export default class CodeGraph extends BasePage {
173169 return this . page . locator ( "//button[p[text()='Clear Graph']]" ) ;
174170 }
175171
172+ private get elementMenuButton ( ) : ( buttonID : string ) => Locator {
173+ return ( buttonID : string ) => this . page . locator ( `//button[@title='${ buttonID } ']` ) ;
174+ }
175+
176+ private get nodedetailsPanelHeader ( ) : Locator {
177+ return this . page . locator ( "//div[@data-name='node-details-panel']/header/p" ) ;
178+ }
179+
180+ private get nodedetailsPanelcloseBtn ( ) : Locator {
181+ return this . page . locator ( "//div[@data-name='node-details-panel']/header/button" ) ;
182+ }
183+ private get canvasMetricsPanel ( ) : ( itemId : string ) => Locator {
184+ return ( itemId : string ) => this . page . locator ( `//div[@data-name='metrics-panel']/p[${ itemId } ]` ) ;
185+ }
186+
176187 /* NavBar functionality */
177188 async clickOnFalkorDbLogo ( ) : Promise < Page > {
178189 await this . page . waitForLoadState ( 'networkidle' ) ;
@@ -232,8 +243,9 @@ export default class CodeGraph extends BasePage {
232243 await this . lightbulbBtn . click ( ) ;
233244 }
234245
235- async getTextInLastChatElement ( ) : Promise < string | null > {
236- return await this . lastElementInChat . textContent ( ) ;
246+ async getTextInLastChatElement ( ) : Promise < string > {
247+ await delay ( 2500 ) ;
248+ return ( await this . lastElementInChat . textContent ( ) ) ! ;
237249 }
238250
239251 async getLastChatElementButtonCount ( ) : Promise < number | null > {
@@ -318,6 +330,7 @@ export default class CodeGraph extends BasePage {
318330 }
319331
320332 async getSearchAutoCompleteCount ( ) : Promise < number > {
333+ await this . searchBarAutoCompleteOptions . first ( ) . waitFor ( { state : 'visible' } ) ;
321334 return await this . searchBarAutoCompleteOptions . count ( ) ;
322335 }
323336
@@ -364,7 +377,7 @@ export default class CodeGraph extends BasePage {
364377 }
365378
366379 async clickOnRemoveNodeViaElementMenu ( ) : Promise < void > {
367- await this . removeNodeViaElementMenu . click ( ) ;
380+ await this . elementMenuButton ( "Remove" ) . click ( ) ;
368381 }
369382
370383 async rightClickOnNode ( x : number , y : number ) : Promise < void > {
@@ -395,4 +408,17 @@ export default class CodeGraph extends BasePage {
395408 await this . page . mouse . move ( absEndX , absEndY ) ;
396409 await this . page . mouse . up ( ) ;
397410 }
411+
412+ async getNodeDetailsHeader ( ) : Promise < string > {
413+ await this . elementMenuButton ( "View Node" ) . click ( ) ;
414+ const text = await this . nodedetailsPanelHeader . innerHTML ( ) ;
415+ await this . nodedetailsPanelcloseBtn . click ( ) ;
416+ return text ;
417+ }
418+
419+ async getMetricsPanelInfo ( ) : Promise < { nodes : string , edges : string } > {
420+ const nodes = await this . canvasMetricsPanel ( "1" ) . innerHTML ( ) ;
421+ const edges = await this . canvasMetricsPanel ( "2" ) . innerHTML ( ) ;
422+ return { nodes, edges }
423+ }
398424}
0 commit comments