Skip to content

Commit 4d59da8

Browse files
committed
✅(tests) Add & adapt language tests
- Language will only be changed if different from current language - Added test for custom translations Signed-off-by: Robin Weber <[email protected]>
1 parent 11622be commit 4d59da8

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/frontend/apps/e2e/__tests__/app-impress/config.spec.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,36 @@ test.describe('Config', () => {
173173
.first(),
174174
).toBeAttached();
175175
});
176+
177+
test('it checks theme_customization.translations config', async ({
178+
page,
179+
}) => {
180+
await page.route('**/api/v1.0/config/', async (route) => {
181+
const request = route.request();
182+
if (request.method().includes('GET')) {
183+
await route.fulfill({
184+
json: {
185+
...CONFIG,
186+
theme_customization: {
187+
translations: {
188+
en: {
189+
translation: {
190+
Docs: 'MyCustomDocs',
191+
},
192+
},
193+
},
194+
},
195+
},
196+
});
197+
} else {
198+
await route.continue();
199+
}
200+
});
201+
202+
await page.goto('/');
203+
204+
await expect(page.getByText('MyCustomDocs')).toBeAttached();
205+
});
176206
});
177207

178208
test.describe('Config: Not loggued', () => {

src/frontend/apps/e2e/__tests__/app-impress/language.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,16 @@ export async function waitForLanguageSwitch(
128128
lang: TestLanguageValue,
129129
) {
130130
const header = page.locator('header').first();
131-
await header.getByRole('button', { name: 'arrow_drop_down' }).click();
131+
const languagePicker = header.locator('.--docs--language-picker-text');
132+
const isAlreadyTargetLanguage = await languagePicker
133+
.innerText()
134+
.then((text) => text.toLowerCase().includes(lang.label.toLowerCase()));
132135

136+
if (isAlreadyTargetLanguage) {
137+
return;
138+
}
139+
140+
await languagePicker.click();
133141
const responsePromise = page.waitForResponse(
134142
(resp) =>
135143
resp.url().includes('/user') && resp.request().method() === 'PATCH',

0 commit comments

Comments
 (0)