mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 15:32:24 +01:00
Merge branch 'main' into fix/fix-equals-operator-in-search
This commit is contained in:
@@ -42,19 +42,19 @@ test("User can change language from settings", async ({ page, context }) => {
|
||||
|
||||
// Check that the default value (English) is set.
|
||||
await expect(app.currentNoteSplit).toContainText("First day of the week");
|
||||
const languageCombobox = app.currentNoteSplit.getByRole("combobox").first();
|
||||
await expect(languageCombobox).toHaveValue("en");
|
||||
const languageCombobox = app.dropdown(app.currentNoteSplit.locator(".options-section .dropdown").first());
|
||||
await expect(languageCombobox).toContainText("English");
|
||||
|
||||
// Select Chinese and ensure the translation is set.
|
||||
await languageCombobox.selectOption("cn");
|
||||
await languageCombobox.selectOptionByText("简体中文");
|
||||
await app.currentNoteSplit.locator("button[name=restart-app-button]").click();
|
||||
|
||||
await expect(app.currentNoteSplit).toContainText("一周的第一天", { timeout: 15000 });
|
||||
await expect(languageCombobox).toHaveValue("cn");
|
||||
await expect(languageCombobox).toContainText("简体中文");
|
||||
|
||||
// Select English again.
|
||||
await languageCombobox.selectOption("en");
|
||||
await languageCombobox.selectOptionByText("English");
|
||||
await app.currentNoteSplit.locator("button[name=restart-app-button]").click();
|
||||
await expect(app.currentNoteSplit).toContainText("Language", { timeout: 15000 });
|
||||
await expect(languageCombobox).toHaveValue("en");
|
||||
await expect(languageCombobox).toContainText("English");
|
||||
});
|
||||
|
||||
@@ -9,6 +9,10 @@ interface GotoOpts {
|
||||
|
||||
const BASE_URL = "http://127.0.0.1:8082";
|
||||
|
||||
interface DropdownLocator extends Locator {
|
||||
selectOptionByText: (text: string) => Promise<void>;
|
||||
}
|
||||
|
||||
export default class App {
|
||||
readonly page: Page;
|
||||
readonly context: BrowserContext;
|
||||
@@ -157,4 +161,14 @@ export default class App {
|
||||
})
|
||||
).toBeOK();
|
||||
}
|
||||
|
||||
dropdown(_locator: Locator): DropdownLocator {
|
||||
let locator = _locator as DropdownLocator;
|
||||
locator.selectOptionByText = async (text: string) => {
|
||||
await locator.locator(".dropdown-toggle").click();
|
||||
await locator.locator(".dropdown-item", { hasText: text }).click();
|
||||
};
|
||||
return locator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user