@@ -39,11 +39,11 @@ export default class CodeGraph extends BasePage {
39
39
}
40
40
41
41
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 } ') ]` ) ;
43
43
}
44
44
45
45
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 " ) ;
47
47
}
48
48
49
49
private get typeUrlInput ( ) : Locator {
@@ -161,10 +161,6 @@ export default class CodeGraph extends BasePage {
161
161
return this . page . locator ( "//button[@title='Center']" ) ;
162
162
}
163
163
164
- private get removeNodeViaElementMenu ( ) : Locator {
165
- return this . page . locator ( "//button[@title='Remove']" ) ;
166
- }
167
-
168
164
private get codeGraphCheckbox ( ) : ( checkbox : string ) => Locator {
169
165
return ( checkbox : string ) => this . page . locator ( `(//button[@role='checkbox'])[${ checkbox } ]` ) ;
170
166
}
@@ -173,6 +169,21 @@ export default class CodeGraph extends BasePage {
173
169
return this . page . locator ( "//button[p[text()='Clear Graph']]" ) ;
174
170
}
175
171
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
+
176
187
/* NavBar functionality */
177
188
async clickOnFalkorDbLogo ( ) : Promise < Page > {
178
189
await this . page . waitForLoadState ( 'networkidle' ) ;
@@ -232,8 +243,9 @@ export default class CodeGraph extends BasePage {
232
243
await this . lightbulbBtn . click ( ) ;
233
244
}
234
245
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 ( ) ) ! ;
237
249
}
238
250
239
251
async getLastChatElementButtonCount ( ) : Promise < number | null > {
@@ -318,6 +330,7 @@ export default class CodeGraph extends BasePage {
318
330
}
319
331
320
332
async getSearchAutoCompleteCount ( ) : Promise < number > {
333
+ await this . searchBarAutoCompleteOptions . first ( ) . waitFor ( { state : 'visible' } ) ;
321
334
return await this . searchBarAutoCompleteOptions . count ( ) ;
322
335
}
323
336
@@ -364,7 +377,7 @@ export default class CodeGraph extends BasePage {
364
377
}
365
378
366
379
async clickOnRemoveNodeViaElementMenu ( ) : Promise < void > {
367
- await this . removeNodeViaElementMenu . click ( ) ;
380
+ await this . elementMenuButton ( "Remove" ) . click ( ) ;
368
381
}
369
382
370
383
async rightClickOnNode ( x : number , y : number ) : Promise < void > {
@@ -395,4 +408,17 @@ export default class CodeGraph extends BasePage {
395
408
await this . page . mouse . move ( absEndX , absEndY ) ;
396
409
await this . page . mouse . up ( ) ;
397
410
}
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
+ }
398
424
}
0 commit comments