Skip to content

Build your personal knowledge base with Trilium Notes

chore(e2e): port old test for changing language

Elian Dorandc83ba51dbb0
diff --git a/e2e/i18n.spec.ts b/e2e/i18n.spec.ts
index 87019c2017..7dc4850794 100644
--- a/e2e/i18n.spec.ts
+++ b/e2e/i18n.spec.ts
@@ -11,3 +11,24 @@ test("Displays translations in Settings", async ({ page }) => {
expect(app.currentNoteSplit).toContainText("Localization");
expect(app.currentNoteSplit).toContainText("Language");
});
+
+test("User can change language from settings", async ({ page }) => {
+ const app = new App(page);
+ await app.goto();
+
+ await app.closeAllTabs();
+ await app.goToSettings();
+ await app.noteTree.getByText("Appearance").click();
+
+ // Check that the default value (English) is set.
+ await expect(app.currentNoteSplit).toContainText("Theme");
+ const languageCombobox = await app.currentNoteSplit.getByRole("combobox").first();
+ await expect(languageCombobox).toHaveValue("en");
+
+ // Select Chinese and ensure the translation is set.
+ languageCombobox.selectOption("cn");
+ await expect(app.currentNoteSplit).toContainText("主题");
+
+ // Select English again.
+ languageCombobox.selectOption("en");
+});
diff --git a/integration-tests/i18n.spec.ts b/integration-tests/i18n.spec.ts
index 1c3fc1d36b..16a49fdbc1 100644
--- a/integration-tests/i18n.spec.ts
+++ b/integration-tests/i18n.spec.ts
@@ -1,30 +1,5 @@
import test, { expect } from "@playwright/test";
-test("User can change language from settings", async ({ page }) => {
- await page.goto("http://localhost:8082");
-
- // 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 -> Appearance
- await page.locator("#launcher-pane div").filter({ hasText: "Options Open New Window" }).getByRole("button").click();
- await page.locator("#launcher-pane").getByText("Options").click();
- await page.locator("#center-pane").getByText("Appearance").click();
-
- // Check that the default value (English) is set.
- await expect(page.locator("#center-pane")).toContainText("Theme");
- const languageCombobox = await page.getByRole("combobox").first();
- await expect(languageCombobox).toHaveValue("en");
-
- // Select Chinese and ensure the translation is set.
- languageCombobox.selectOption("cn");
- await expect(page.locator("#center-pane")).toContainText("主题");
-
- // Select English again.
- languageCombobox.selectOption("en");
-});
-
test("Restores language on start-up on desktop", async ({ page, context }) => {
await page.goto("http://localhost:8082");
await expect(page.locator("#launcher-pane").first()).toContainText("Open New Window");