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