@@ -170,6 +170,67 @@ test.describe('Config', () => {
170
170
. first ( ) ,
171
171
) . toBeAttached ( ) ;
172
172
} ) ;
173
+
174
+ test ( 'it checks FRONTEND_CUSTOM_TRANSLATIONS_URL config' , async ( {
175
+ page,
176
+ } ) => {
177
+ // Create mock URL for translations
178
+ const mockTranslationsUrl =
179
+ 'http://dummyhost.example.com/translations/custom.json' ;
180
+
181
+ // Mock the config endpoint to include the custom translations URL
182
+ await page . route ( '**/api/v1.0/config/' , async ( route ) => {
183
+ const request = route . request ( ) ;
184
+ if ( request . method ( ) . includes ( 'GET' ) ) {
185
+ await route . fulfill ( {
186
+ json : {
187
+ ...config ,
188
+ FRONTEND_CUSTOM_TRANSLATIONS_URL : mockTranslationsUrl ,
189
+ } ,
190
+ } ) ;
191
+ } else {
192
+ await route . continue ( ) ;
193
+ }
194
+ } ) ;
195
+
196
+ // Mock the translations endpoint to return our custom translations
197
+ await page . route ( mockTranslationsUrl , async ( route ) => {
198
+ await route . fulfill ( {
199
+ json : {
200
+ en : {
201
+ translation : {
202
+ Docs : 'CustomDocsEn' ,
203
+ } ,
204
+ } ,
205
+ fr : {
206
+ translation : {
207
+ Docs : 'CustomDocsFR' ,
208
+ } ,
209
+ } ,
210
+ } ,
211
+ status : 200 ,
212
+ headers : {
213
+ 'Content-Type' : 'application/json' ,
214
+ 'Access-Control-Allow-Origin' : '*' ,
215
+ } ,
216
+ } ) ;
217
+ } ) ;
218
+
219
+ // Intercept requests to the translations URL
220
+ const translationsPromise = page . waitForRequest ( ( req ) => {
221
+ return req . url ( ) === mockTranslationsUrl ;
222
+ } ) ;
223
+
224
+ // Navigate to the page
225
+ await page . goto ( '/' ) ;
226
+
227
+ // Verify that the application attempted to load the translations
228
+ const translationsRequest = await translationsPromise ;
229
+ expect ( translationsRequest ) . toBeTruthy ( ) ;
230
+
231
+ // Extra test to prove that the translations were applied
232
+ await expect ( page . getByText ( 'CustomDocsEn' ) ) . toBeAttached ( ) ;
233
+ } ) ;
173
234
} ) ;
174
235
175
236
test . describe ( 'Config: Not loggued' , ( ) => {
0 commit comments