Skip to content

Build your personal knowledge base with Trilium Notes

integration-test: Start writing test for language change

Elian Doran45e2b565efe0
diff --git a/integration-tests/i18n.spec.ts b/integration-tests/i18n.spec.ts
new file mode 100644
index 0000000000..28d898d9b8
--- /dev/null
+++ b/integration-tests/i18n.spec.ts
@@ -0,0 +1,20 @@
+import test, { expect } from "@playwright/test";
+
+test("User can change language from settings", async ({ page }) => {
+ // Clear all tabs
+ await page.locator('.note-tab:first-of-type').locator("div").nth(1).click({ button: 'right' });
+ await page.getByText('Close all tabs').click();
+
+ // Go to options
+ await page.locator('#launcher-pane div').filter({ hasText: 'Options Open New Window' }).getByRole('button').click();
+ await page.locator('#launcher-pane').getByText('Options').click();
+
+ // Check that the default value (English) is set.
+ await expect(page.locator('#center-pane')).toContainText('Theme');
+ const languageCombobox = await page.getByRole('combobox').first();
+ expect(languageCombobox).toHaveValue("en");
+
+ // Select Chinese and ensure the translation is set.
+ languageCombobox.selectOption("cn");
+ await expect(page.locator('#center-pane')).toContainText('主题');
+});
\ No newline at end of file