@@ -31,9 +31,11 @@ export class AILabPlaygroundDetailsPage extends AILabBasePage {
31
31
readonly temperatureSliderLocator : Locator ;
32
32
readonly maxTokensSliderLocator : Locator ;
33
33
readonly topPSliderLocator : Locator ;
34
- readonly promptTextAreaLoctor : Locator ;
34
+ readonly systemPromptTextAreaLocator : Locator ;
35
35
readonly clearSystemPromptButtonLocator : Locator ;
36
36
readonly editSystemPromptButtonLocator : Locator ;
37
+ readonly promptTextAreaLocator : Locator ;
38
+ readonly sendPromptButton : Locator ;
37
39
38
40
constructor ( page : Page , webview : Page , playgroundName : string ) {
39
41
super ( page , webview , playgroundName ) ;
@@ -46,24 +48,26 @@ export class AILabPlaygroundDetailsPage extends AILabBasePage {
46
48
this . temperatureSliderLocator = this . parametersSectionLocator . getByLabel ( 'temperature slider' , { exact : true } ) ;
47
49
this . maxTokensSliderLocator = this . parametersSectionLocator . getByLabel ( 'max tokens slider' , { exact : true } ) ;
48
50
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' ) ;
50
52
this . clearSystemPromptButtonLocator = this . conversationSectionLocator . getByTitle ( 'Clear' , { exact : true } ) ;
51
53
this . editSystemPromptButtonLocator = this . conversationSectionLocator . getByTitle ( 'Edit system prompt' , {
52
54
exact : true ,
53
55
} ) ;
56
+ this . promptTextAreaLocator = this . webview . getByLabel ( 'prompt' , { exact : true } ) ;
57
+ this . sendPromptButton = this . webview . getByRole ( 'button' , { name : 'Send prompt' } ) ;
54
58
}
55
59
56
60
async waitForLoad ( ) : Promise < void > {
57
61
await playExpect ( this . heading ) . toBeVisible ( ) ;
58
62
}
59
63
60
- async definePrompt ( prompt : string ) : Promise < void > {
64
+ async defineSystemPrompt ( systemPrompt : string ) : Promise < void > {
61
65
await playExpect ( this . editSystemPromptButtonLocator ) . toBeVisible ( ) ;
62
66
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 ) ;
65
69
await this . editSystemPromptButtonLocator . click ( ) ;
66
- await playExpect ( this . promptTextAreaLoctor ) . not . toBeVisible ( ) ;
70
+ await playExpect ( this . systemPromptTextAreaLocator ) . not . toBeVisible ( ) ;
67
71
}
68
72
69
73
async deletePlayground ( ) : Promise < AILabPlaygroundsPage > {
@@ -72,4 +76,17 @@ export class AILabPlaygroundDetailsPage extends AILabBasePage {
72
76
await handleConfirmationDialog ( this . page , 'Podman AI Lab' , true , 'Confirm' ) ;
73
77
return new AILabPlaygroundsPage ( this . page , this . webview ) ;
74
78
}
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
+ }
75
92
}
0 commit comments