Skip to content

Commit ce19d84

Browse files
committed
test(e2e): i18n test broken due to button
1 parent 0754011 commit ce19d84

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

apps/client/src/widgets/react/Button.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useRef, useMemo } from "preact/hooks";
44
import { memo } from "preact/compat";
55

66
interface ButtonProps {
7+
name?: string;
78
/** Reference to the button element. Mostly useful for requesting focus. */
89
buttonRef?: RefObject<HTMLButtonElement>;
910
text: string;
@@ -18,7 +19,7 @@ interface ButtonProps {
1819
style?: CSSProperties;
1920
}
2021

21-
const Button = memo(({ buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style }: ButtonProps) => {
22+
const Button = memo(({ name, buttonRef: _buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style }: ButtonProps) => {
2223
// Memoize classes array to prevent recreation
2324
const classes = useMemo(() => {
2425
const classList: string[] = ["btn"];
@@ -54,6 +55,7 @@ const Button = memo(({ buttonRef: _buttonRef, className, text, onClick, keyboard
5455

5556
return (
5657
<button
58+
name={name}
5759
className={classes}
5860
type={onClick ? "button" : "submit"}
5961
onClick={onClick}

apps/client/src/widgets/type_widgets/options/i18n.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function DateSettings() {
107107

108108
<OptionsRow name="restart" centered>
109109
<Button
110+
name="restart-app-button"
110111
text={t("electron_integration.restart-app-button")}
111112
size="micro"
112113
onClick={restartDesktopApp}

apps/server-e2e/src/i18n.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test("User can change language from settings", async ({ page, context }) => {
4747

4848
// Select Chinese and ensure the translation is set.
4949
await languageCombobox.selectOption("cn");
50-
await app.currentNoteSplit.locator("button.restart-app-button").click();
50+
await app.currentNoteSplit.locator("button[name=restart-app-button]").click();
5151

5252
await expect(app.currentNoteSplit).toContainText("一周的第一天", { timeout: 15000 });
5353
await expect(languageCombobox).toHaveValue("cn");

0 commit comments

Comments
 (0)