@@ -31,9 +31,11 @@ export class AILabPlaygroundDetailsPage extends AILabBasePage {
3131 readonly temperatureSliderLocator : Locator ;
3232 readonly maxTokensSliderLocator : Locator ;
3333 readonly topPSliderLocator : Locator ;
34- readonly promptTextAreaLoctor : Locator ;
34+ readonly systemPromptTextAreaLocator : Locator ;
3535 readonly clearSystemPromptButtonLocator : Locator ;
3636 readonly editSystemPromptButtonLocator : Locator ;
37+ readonly promptTextAreaLocator : Locator ;
38+ readonly sendPromptButton : Locator ;
3739
3840 constructor ( page : Page , webview : Page , playgroundName : string ) {
3941 super ( page , webview , playgroundName ) ;
@@ -46,24 +48,26 @@ export class AILabPlaygroundDetailsPage extends AILabBasePage {
4648 this . temperatureSliderLocator = this . parametersSectionLocator . getByLabel ( 'temperature slider' , { exact : true } ) ;
4749 this . maxTokensSliderLocator = this . parametersSectionLocator . getByLabel ( 'max tokens slider' , { exact : true } ) ;
4850 this . topPSliderLocator = this . parametersSectionLocator . getByLabel ( 'top-p slider' , { exact : true } ) ;
49- this . promptTextAreaLoctor = this . conversationSectionLocator . getByLabel ( 'system-prompt-textarea' ) ;
51+ this . systemPromptTextAreaLocator = this . conversationSectionLocator . getByLabel ( 'system-prompt-textarea' ) ;
5052 this . clearSystemPromptButtonLocator = this . conversationSectionLocator . getByTitle ( 'Clear' , { exact : true } ) ;
5153 this . editSystemPromptButtonLocator = this . conversationSectionLocator . getByTitle ( 'Edit system prompt' , {
5254 exact : true ,
5355 } ) ;
56+ this . promptTextAreaLocator = this . webview . getByLabel ( 'prompt' , { exact : true } ) ;
57+ this . sendPromptButton = this . webview . getByRole ( 'button' , { name : 'Send prompt' } ) ;
5458 }
5559
5660 async waitForLoad ( ) : Promise < void > {
5761 await playExpect ( this . heading ) . toBeVisible ( ) ;
5862 }
5963
60- async definePrompt ( prompt : string ) : Promise < void > {
64+ async defineSystemPrompt ( systemPrompt : string ) : Promise < void > {
6165 await playExpect ( this . editSystemPromptButtonLocator ) . toBeVisible ( ) ;
6266 await this . editSystemPromptButtonLocator . click ( ) ;
63- await playExpect ( this . promptTextAreaLoctor ) . toBeVisible ( ) ;
64- await this . promptTextAreaLoctor . fill ( prompt ) ;
67+ await playExpect ( this . systemPromptTextAreaLocator ) . toBeVisible ( ) ;
68+ await this . systemPromptTextAreaLocator . fill ( systemPrompt ) ;
6569 await this . editSystemPromptButtonLocator . click ( ) ;
66- await playExpect ( this . promptTextAreaLoctor ) . not . toBeVisible ( ) ;
70+ await playExpect ( this . systemPromptTextAreaLocator ) . not . toBeVisible ( ) ;
6771 }
6872
6973 async deletePlayground ( ) : Promise < AILabPlaygroundsPage > {
@@ -72,4 +76,17 @@ export class AILabPlaygroundDetailsPage extends AILabBasePage {
7276 await handleConfirmationDialog ( this . page , 'Podman AI Lab' , true , 'Confirm' ) ;
7377 return new AILabPlaygroundsPage ( this . page , this . webview ) ;
7478 }
79+
80+ async submitUserInput ( prompt : string ) : Promise < void > {
81+ await this . promptTextAreaLocator . fill ( prompt ) ;
82+ await playExpect ( this . promptTextAreaLocator ) . toHaveValue ( prompt ) ;
83+ await playExpect ( this . sendPromptButton ) . toBeEnabled ( { timeout : 30_000 } ) ;
84+ await this . sendPromptButton . click ( ) ;
85+ }
86+
87+ async getAssistantResponse ( index : number ) : Promise < Locator > {
88+ await playExpect ( this . sendPromptButton ) . toBeVisible ( { timeout : 100_000 } ) ;
89+ const assistantResponse = this . conversationSectionLocator . getByLabel ( 'Assistant message' ) . nth ( index ) ;
90+ return assistantResponse ;
91+ }
7592}
0 commit comments