@@ -21,6 +21,18 @@ export default class CodeGraph extends BasePage {
2121 return this . page . locator ( "//div[@role='dialog']" )
2222 }
2323
24+ private get tipBtn ( ) : Locator {
25+ return this . page . locator ( "//button[@title='Tip']" )
26+ }
27+
28+ private get genericMenu ( ) : Locator {
29+ return this . page . locator ( "//div[contains(@role, 'menu')]" )
30+ }
31+
32+ private get tipMenuCloseBtn ( ) : Locator {
33+ return this . page . locator ( "//div[@role='menu']//button[@title='Close']" )
34+ }
35+
2436 /* CodeGraph Locators*/
2537 private get comboBoxbtn ( ) : Locator {
2638 return this . page . locator ( "//button[@role='combobox']" )
@@ -115,6 +127,22 @@ export default class CodeGraph extends BasePage {
115127 return this . page . locator ( "//div[@role='region']//ol//li" ) ;
116128 }
117129
130+ private get notificationErrorCloseBtn ( ) : Locator {
131+ return this . page . locator ( "//div[@role='region']//ol//li/button" ) ;
132+ }
133+
134+ private get questionOptionsMenu ( ) : Locator {
135+ return this . page . locator ( "//button[@data-name='questionOptionsMenu']" ) ;
136+ }
137+
138+ private get selectQuestionInMenu ( ) : ( questionNumber : string ) => Locator {
139+ return ( questionNumber : string ) => this . page . locator ( `//div[contains(@role, 'menu')]/button[${ questionNumber } ]` ) ;
140+ }
141+
142+ private get lastQuestionInChat ( ) : Locator {
143+ return this . page . locator ( "//main[@data-name='main-chat']/*[last()-1]/p" ) ;
144+ }
145+
118146 /* Canvas Locators*/
119147
120148 private get canvasElement ( ) : Locator {
@@ -172,6 +200,18 @@ export default class CodeGraph extends BasePage {
172200 return await this . createNewProjectDialog . isVisible ( ) ;
173201 }
174202
203+ async clickonTipBtn ( ) : Promise < void > {
204+ await this . tipBtn . click ( ) ;
205+ }
206+
207+ async isTipMenuVisible ( ) : Promise < boolean > {
208+ return await this . genericMenu . isVisible ( ) ;
209+ }
210+
211+ async clickonTipMenuCloseBtn ( ) : Promise < void > {
212+ await this . tipMenuCloseBtn . click ( ) ;
213+ }
214+
175215 /* Chat functionality */
176216 async clickOnshowPathBtn ( ) : Promise < void > {
177217 await this . showPathBtn . click ( ) ;
@@ -232,9 +272,27 @@ export default class CodeGraph extends BasePage {
232272 }
233273
234274 async isNotificationError ( ) : Promise < boolean > {
275+ await delay ( 500 ) ;
235276 return await this . notificationError . isVisible ( ) ;
236277 }
237278
279+ async clickOnNotificationErrorCloseBtn ( ) : Promise < void > {
280+ await this . notificationErrorCloseBtn . click ( ) ;
281+ }
282+
283+ async clickOnQuestionOptionsMenu ( ) : Promise < void > {
284+ await this . questionOptionsMenu . click ( ) ;
285+ }
286+
287+ async selectAndGetQuestionInOptionsMenu ( questionNumber : string ) : Promise < string > {
288+ await this . selectQuestionInMenu ( questionNumber ) . click ( ) ;
289+ return await this . selectQuestionInMenu ( questionNumber ) . innerHTML ( ) ;
290+ }
291+
292+ async getLastQuestionInChat ( ) : Promise < string > {
293+ return await this . lastQuestionInChat . innerText ( ) ;
294+ }
295+
238296 /* CodeGraph functionality */
239297 async selectGraph ( graph : string ) : Promise < void > {
240298 await this . comboBoxbtn . click ( ) ;
@@ -322,4 +380,18 @@ export default class CodeGraph extends BasePage {
322380 async clickOnClearGraphBtn ( ) : Promise < void > {
323381 await this . clearGraphBtn . click ( ) ;
324382 }
383+
384+ async changeNodePosition ( x : number , y : number ) : Promise < void > {
385+ const box = ( await this . canvasElement . boundingBox ( ) ) ! ;
386+ const targetX = x + 100 ;
387+ const targetY = y + 50 ;
388+ const absStartX = box . x + x ;
389+ const absStartY = box . y + y ;
390+ const absEndX = box . x + targetX ;
391+ const absEndY = box . y + targetY ;
392+ await this . page . mouse . move ( absStartX , absStartY ) ;
393+ await this . page . mouse . down ( ) ;
394+ await this . page . mouse . move ( absEndX , absEndY ) ;
395+ await this . page . mouse . up ( ) ;
396+ }
325397}
0 commit comments