1
1
import { expect } from '@playwright/test'
2
2
import { acceptDisclaimer , closeSendPreference , sendChatMessage , useMockModel } from './utils/test-helpers'
3
3
import { TestByRole } from './fixtures'
4
+ import { FREE_MODEL , validModels } from '../src/config'
4
5
5
6
// Matrix of tests
6
7
const testMatrix : { role : keyof typeof TestByRole ; courses : ( string | undefined ) [ ] } [ ] = [
@@ -93,6 +94,11 @@ testMatrix.forEach((testConfig) => {
93
94
await expect ( page . getByTestId ( 'user-message' ) ) . toContainText ( 'tää tyhjennetään' )
94
95
await expect ( page . getByTestId ( 'assistant-message' ) ) . toContainText ( 'OVER' , { timeout : 6000 } )
95
96
97
+ await sendChatMessage ( page , 'ja tämä' )
98
+
99
+ await expect ( page . getByTestId ( 'user-message' ) ) . toContainText ( 'ja tämä' )
100
+ await expect ( page . getByTestId ( 'assistant-message' ) ) . toContainText ( 'OVER' , { timeout : 6000 } )
101
+
96
102
page . on ( 'dialog' , ( dialog ) => dialog . accept ( ) )
97
103
await page . getByTestId ( 'empty-conversation-button' ) . click ( )
98
104
@@ -154,7 +160,7 @@ testMatrix.forEach((testConfig) => {
154
160
await expect ( page . getByTestId ( 'assistant-message' ) . last ( ) ) . toContainText ( 'Temperature: 1' )
155
161
} )
156
162
157
- if ( course )
163
+ if ( course ) {
158
164
test ( 'Course chat RAG feature' , async ( { page } ) => {
159
165
await acceptDisclaimer ( page )
160
166
await useMockModel ( page )
@@ -181,6 +187,20 @@ testMatrix.forEach((testConfig) => {
181
187
// Three source items should be visible
182
188
await expect ( page . getByTestId ( 'sources-truncated-item' ) ) . toHaveCount ( 3 )
183
189
} )
190
+ }
191
+
192
+ if ( ! course ) {
193
+ test ( 'Every validModel is available in general chat' , async ( { page } ) => {
194
+ await acceptDisclaimer ( page )
195
+ await page . getByTestId ( 'model-selector' ) . first ( ) . click ( )
196
+
197
+ const modelNames = validModels . map ( ( modelConfig ) => ( modelConfig . name + FREE_MODEL === modelConfig . name ? ' (free)' : '' ) )
198
+
199
+ for ( const name of modelNames ) {
200
+ await expect ( page . getByText ( name , { exact : true } ) . first ( ) ) . toBeVisible ( )
201
+ }
202
+ } )
203
+ }
184
204
} )
185
205
} )
186
206
} )
0 commit comments