Skip to content

Commit 372b8d9

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 322f98a commit 372b8d9

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
@@ -119,6 +119,36 @@ test.describe('Config', () => {
119119
.first(),
120120
).toBeAttached();
121121
});
122+
123+
test('it checks theme_customization.translations config', async ({
124+
page,
125+
}) => {
126+
await page.route('**/api/v1.0/config/', async (route) => {
127+
const request = route.request();
128+
if (request.method().includes('GET')) {
129+
await route.fulfill({
130+
json: {
131+
...CONFIG,
132+
theme_customization: {
133+
translations: {
134+
en: {
135+
translation: {
136+
Docs: 'MyCustomDocs',
137+
},
138+
},
139+
},
140+
},
141+
},
142+
});
143+
} else {
144+
await route.continue();
145+
}
146+
});
147+
148+
await page.goto('/');
149+
150+
await expect(page.getByText('MyCustomDocs')).toBeAttached();
151+
});
122152
});
123153

124154
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)