@@ -10,6 +10,7 @@ const config = {
10
10
COLLABORATION_WS_URL : 'ws://localhost:4444/collaboration/ws/' ,
11
11
ENVIRONMENT : 'development' ,
12
12
FRONTEND_CSS_URL : null ,
13
+ FRONTEND_CUSTOM_TRANSLATIONS_URL : null ,
13
14
FRONTEND_FOOTER_FEATURE_ENABLED : true ,
14
15
FRONTEND_THEME : 'default' ,
15
16
MEDIA_BASE_URL : 'http://localhost:8083' ,
@@ -190,6 +191,67 @@ test.describe('Config', () => {
190
191
. first ( ) ,
191
192
) . toBeAttached ( ) ;
192
193
} ) ;
194
+
195
+ test ( 'it checks FRONTEND_CUSTOM_TRANSLATIONS_URL config' , async ( {
196
+ page,
197
+ } ) => {
198
+ // Create mock URL for translations
199
+ const mockTranslationsUrl =
200
+ 'http://dummyhost.example.com/translations/custom.json' ;
201
+
202
+ // Mock the config endpoint to include the custom translations URL
203
+ await page . route ( '**/api/v1.0/config/' , async ( route ) => {
204
+ const request = route . request ( ) ;
205
+ if ( request . method ( ) . includes ( 'GET' ) ) {
206
+ await route . fulfill ( {
207
+ json : {
208
+ ...config ,
209
+ FRONTEND_CUSTOM_TRANSLATIONS_URL : mockTranslationsUrl ,
210
+ } ,
211
+ } ) ;
212
+ } else {
213
+ await route . continue ( ) ;
214
+ }
215
+ } ) ;
216
+
217
+ // Mock the translations endpoint to return our custom translations
218
+ await page . route ( mockTranslationsUrl , async ( route ) => {
219
+ await route . fulfill ( {
220
+ json : {
221
+ en : {
222
+ translation : {
223
+ Docs : 'CustomDocsEn' ,
224
+ } ,
225
+ } ,
226
+ fr : {
227
+ translation : {
228
+ Docs : 'CustomDocsFR' ,
229
+ } ,
230
+ } ,
231
+ } ,
232
+ status : 200 ,
233
+ headers : {
234
+ 'Content-Type' : 'application/json' ,
235
+ 'Access-Control-Allow-Origin' : '*' ,
236
+ } ,
237
+ } ) ;
238
+ } ) ;
239
+
240
+ // Intercept requests to the translations URL
241
+ const translationsPromise = page . waitForRequest ( ( req ) => {
242
+ return req . url ( ) === mockTranslationsUrl ;
243
+ } ) ;
244
+
245
+ // Navigate to the page
246
+ await page . goto ( '/' ) ;
247
+
248
+ // Verify that the application attempted to load the translations
249
+ const translationsRequest = await translationsPromise ;
250
+ expect ( translationsRequest ) . toBeTruthy ( ) ;
251
+
252
+ // Extra test to prove that the translations were applied
253
+ await expect ( page . getByText ( 'CustomDocsEn' ) ) . toBeAttached ( ) ;
254
+ } ) ;
193
255
} ) ;
194
256
195
257
test . describe ( 'Config: Not loggued' , ( ) => {
0 commit comments