chore(e2e): port old test for changing language

This commit is contained in:
Elian Doran 2025-01-12 17:36:10 +02:00
parent 0db3bfd8ae
commit dc83ba51db
No known key found for this signature in database
2 changed files with 21 additions and 25 deletions

View File

@ -11,3 +11,24 @@ test("Displays translations in Settings", async ({ page }) => {
expect(app.currentNoteSplit).toContainText("Localization"); expect(app.currentNoteSplit).toContainText("Localization");
expect(app.currentNoteSplit).toContainText("Language"); 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");
});

View File

@ -1,30 +1,5 @@
import test, { expect } from "@playwright/test"; 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 }) => { test("Restores language on start-up on desktop", async ({ page, context }) => {
await page.goto("http://localhost:8082"); await page.goto("http://localhost:8082");
await expect(page.locator("#launcher-pane").first()).toContainText("Open New Window"); await expect(page.locator("#launcher-pane").first()).toContainText("Open New Window");