Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(i18n): cover Japanese locale browser E2E and native smoke

Toyo Saga6bfc61d7eb16
diff --git a/app/test/e2e/specs/japanese-locale.browser.ts b/app/test/e2e/specs/japanese-locale.browser.ts
new file mode 100644
index 0000000000..555fe98ade
--- /dev/null
+++ b/app/test/e2e/specs/japanese-locale.browser.ts
@@ -0,0 +1,141 @@
+import { expect, type Page, test } from '@playwright/test';
+
+import {
+ bootAuthenticatedPage,
+ dismissWalkthroughIfPresent,
+} from '../../playwright/helpers/core-rpc';
+
+async function settings(page: Page, user: string) {
+ await bootAuthenticatedPage(page, user, '/settings/account');
+ await dismissWalkthroughIfPresent(page);
+}
+
+async function expectJapanese(page: Page) {
+ await expect(page.getByRole('combobox', { name: '言語', exact: true })).toHaveValue('ja');
+ await expect(page.locator('html')).toHaveAttribute('lang', 'ja');
+ await expect(page.locator('html')).toHaveAttribute('dir', 'ltr');
+ await expect(page.locator('[data-walkthrough="tab-chat"]')).toContainText('チャット');
+}
+
+test.describe('Japanese UI locale', () => {
+ test.describe.configure({ timeout: 180_000 });
+
+ test('selects Japanese through Settings, restores it after reload, and switches back', async ({
+ page,
+ }) => {
+ await settings(page, 'pw-japanese-switch');
+ await page
+ .getByRole('combobox', { name: 'Language', exact: true })
+ .selectOption({ label: '🇯🇵 日本語' });
+ await expectJapanese(page);
+ // Wait for redux-persist to write, rather than dispatching or seeding a locale.
+ await expect
+ .poll(() =>
+ page.evaluate(() => Object.values(localStorage).some(value => value.includes('\\"ja\\"')))
+ )
+ .toBe(true);
+ await page.reload();
+ await expectJapanese(page);
+ await page.getByRole('combobox', { name: '言語', exact: true }).selectOption('en');
+ await expect(page.getByRole('combobox', { name: 'Language', exact: true })).toHaveValue('en');
+ await expect(page.locator('html')).toHaveAttribute('lang', 'en');
+ await expect(page.locator('[data-walkthrough="tab-chat"]')).toContainText('Chat');
+ await expect
+ .poll(() =>
+ page.evaluate(() => Object.values(localStorage).some(value => value.includes('\\"en\\"')))
+ )
+ .toBe(true);
+ await page.reload();
+ await expect(page.getByRole('combobox', { name: 'Language', exact: true })).toHaveValue('en');
+ });
+
+ test('detects ja-JP on a fresh browser and preserves a manual English override', async ({
+ browser,
+ }) => {
+ const context = await browser.newContext({
+ locale: 'ja-JP',
+ viewport: { width: 1280, height: 720 },
+ });
+ const page = await context.newPage();
+ try {
+ await settings(page, 'pw-japanese-detect');
+ expect(await page.evaluate(() => navigator.language)).toBe('ja-JP');
+ await expectJapanese(page);
+ await expect(page.getByRole('combobox', { name: '言語', exact: true })).toBeInViewport();
+ await page.getByRole('combobox', { name: '言語', exact: true }).selectOption('en');
+ await expect
+ .poll(() =>
+ page.evaluate(() => Object.values(localStorage).some(value => value.includes('\\"en\\"')))
+ )
+ .toBe(true);
+ await page.reload();
+ await expect(page.getByRole('combobox', { name: 'Language', exact: true })).toHaveValue('en');
+ expect(await page.evaluate(() => navigator.language)).toBe('ja-JP');
+ } finally {
+ await context.close();
+ }
+ });
+
+ test('renders Japanese memory counts and model attribution at the default viewport', async ({
+ page,
+ }) => {
+ const fixtures: Record<string, unknown> = {
+ 'openhuman.memory_engine_get': {
+ result: { engine: 'tinycortex', has_key: true, status: 'ready', fetch_modes: [] },
+ logs: [],
+ },
+ 'openhuman.memory_engines_list': { result: { engines: [] }, logs: [] },
+ 'openhuman.memory_explore': {
+ result: {
+ facet: 'kind',
+ buckets: [{ value: 'document', count: 7 }],
+ total: 7,
+ missing: 0,
+ more_buckets: 0,
+ truncated: false,
+ },
+ logs: [],
+ },
+ 'openhuman.memory_items_list': { result: { items: [] }, logs: [] },
+ 'openhuman.tokenjuice_savings_stats': {
+ attributionModel: 'Qwen3.8-Flash-Next',
+ total: {
+ events: 3,
+ originalTokens: 1000,
+ compactedTokens: 500,
+ tokensSaved: 500,
+ costSavedUsd: 0,
+ },
+ byModel: {},
+ byCompressor: {},
+ cache: { entries: 0, bytes: 0 },
+ },
+ };
+ // Only data-dependent read results are fixtures; authentication, locale
+ // persistence and navigation still run through the shared Core harness.
+ await page.route('**/rpc', async route => {
+ const request = route.request().postDataJSON();
+ if (request && Object.prototype.hasOwnProperty.call(fixtures, request.method)) {
+ await route.fulfill({
+ json: { jsonrpc: '2.0', id: request.id, result: fixtures[request.method] },
+ });
+ } else {
+ await route.continue();
+ }
+ });
+ await page.setViewportSize({ width: 1280, height: 720 });
+ await settings(page, 'pw-japanese-interpolation');
+ await page.getByRole('combobox', { name: 'Language', exact: true }).selectOption('ja');
+ await page.goto('/#/connections?tab=brain&brain=explorer');
+ const count = page.getByText('この場所の項目: 7件', { exact: true });
+ await expect(count).toBeVisible();
+ await count.scrollIntoViewIfNeeded();
+ await expect(count).toBeInViewport();
+ await page.goto('/#/connections?tab=usage#tokens');
+ const attribution = page.getByText('Qwen3.8-Flash-Next のコストで計算', { exact: true });
+ await expect(attribution).toBeVisible();
+ await attribution.scrollIntoViewIfNeeded();
+ await expect(attribution).toBeInViewport();
+ await expect(page.getByText('3 回の圧縮で', { exact: true })).toBeVisible();
+ });
+});
diff --git a/app/test/playwright/specs/japanese-locale.spec.ts b/app/test/playwright/specs/japanese-locale.spec.ts
new file mode 100644
index 0000000000..26d744a77c
--- /dev/null
+++ b/app/test/playwright/specs/japanese-locale.spec.ts
@@ -0,0 +1,2 @@
+// The shared browser E2E suite lives beside the desktop flows.
+import '../../e2e/specs/japanese-locale.browser';
diff --git a/docs/JAPANESE-UI-VALIDATION.md b/docs/JAPANESE-UI-VALIDATION.md
new file mode 100644
index 0000000000..ce3bd4d159
--- /dev/null
+++ b/docs/JAPANESE-UI-VALIDATION.md
@@ -0,0 +1,68 @@
+# Japanese UI validation
+
+Validation performed on 2026-10-04 after the locale refresh at
+`673e33a87f0936582173304818d4b84bef80ea1b`.
+The follow-up changes add tests and documentation; the application code in the
+native build is that exact revision.
+
+## Automated browser E2E
+
+`app/test/playwright/specs/japanese-locale.spec.ts` imports the shared suite in
+`app/test/e2e/specs/japanese-locale.browser.ts`. The existing Playwright web lane
+discovers the wrapper. Run the focused suite with the repository's mock backend
+and standalone Core:
+
+```sh
+pnpm --filter openhuman-app test:e2e:web:build
+bash app/scripts/e2e-web-session.sh test/playwright/specs/japanese-locale.spec.ts
+```
+
+All three tests passed:
+
+- Select 日本語 through Settings, verify Japanese Chat labels and `html[lang=ja]`,
+ reload and verify persistence, then select English and reload again.
+- Start a fresh `ja-JP` browser context, verify automatic Japanese selection,
+ and verify that a saved English choice wins after reload.
+- At 1280×720, navigate to Memory v2 Explorer and Token Usage. Verify `7件`,
+ `Qwen3.8-Flash-Next`, and `3 回の圧縮で` replace the interpolation tokens and
+ remain visible. Only data-dependent read RPC results are fixtures; locale
+ changes, storage, navigation and authentication use the shared Core harness.
+
+E2E TypeScript, ESLint, Prettier and the coverage-matrix guard passed. Using Node
+24, the focused LanguageSelect, localeSlice, i18n and attachment suites passed
+150 tests. A prior run with mixed Node versions failed one gzip attachment test;
+that failure disappeared when the runtime matched CI.
+
+## Native macOS smoke
+
+Built the production frontend and unsigned debug `.app` with the PR's pinned
+Rust toolchain and recursive submodules. Used a separate application identifier
+and disposable workspace, leaving the installed app and production memory
+intact. No WebDriver or mocked model was used for these native checks.
+
+Observed:
+
+- Fresh first-run UI displayed 日本語 in the language/runtime picker.
+- Settings, Chat, Connections, Memory v2 and Gateway labels rendered in Japanese.
+- Settings switched Japanese → English → Japanese immediately.
+- An actual app quit/relaunch preserved English; a previous reconnect/relaunch
+ preserved Japanese.
+- The remote Core connection test succeeded over an SSH loopback tunnel.
+- The Japanese routing dialog tested a custom OpenAI-compatible provider through
+ the real model router and received `Hello! How can I help you today?` from
+ Qwen3.8-Flash-Next. The provider and model name were visible in the response.
+
+## Integration limits
+
+The existing production Core rejected the new UI's `reasoning_effort` parameter
+on `channel.web_chat`. Therefore the native smoke used a separately built Core
+at the same revision, running on the remote Mac Studio with isolated data.
+Production Core and memory were not upgraded or migrated.
+
+The legacy `local-openai` agent path reached the actual model but did not complete
+a simple arithmetic request: its main wire request contained a synthetic
+`Continue with the task described above.` user turn and the model attempted
+unrelated tools. This is an integration finding, not a successful chat-answer
+E2E result. The isolated Memory service was not configured, so Memory Explorer
+showed its connection error; successful item/count rendering is covered by the
+browser fixture test above. No iOS or Android native smoke was performed.
diff --git a/docs/RELEASE-MANUAL-SMOKE.md b/docs/RELEASE-MANUAL-SMOKE.md
index 44dd1f7e7f..ac0cdd19dc 100644
--- a/docs/RELEASE-MANUAL-SMOKE.md
+++ b/docs/RELEASE-MANUAL-SMOKE.md
@@ -22,7 +22,7 @@ Applies to every release, all platforms.
### Japanese UI
-- [ ] **Japanese language selection** — In the first-run language picker and Settings → Language, select **🇯🇵 日本語**. Verify that the labels immediately become Japanese, then visit Chat, Brain, Connections, and Gateway. Restart and confirm the selected language is retained. Switch back to English and confirm the labels update again.
+- [ ] **Japanese language selection** — In the first-run language picker and Settings → Language, select **🇯🇵 日本語**. Verify that the labels immediately become Japanese, then visit Chat, Connections → Memory, Connections → LLM, and Gateway. Restart and confirm the selected language is retained. Switch back to English and confirm the labels update again.
- [ ] **Japanese browser language** — With a fresh profile and browser language `ja-JP`, verify that Japanese is selected automatically. Check a message containing a count or model name: the value must appear in place of its placeholder and remain readable at the default window size.
### Conversation resume
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index bf954201f7..0dd9ea5bfc 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -19,6 +19,7 @@ Canonical mapping of every product feature to its test source(s). Drives gap-fil
| `RI` | Rust integration (`tests/*.rs`) |
| `VU` | Vitest unit (`app/src/**/*.test.ts(x)`) |
| `WD` | WDIO E2E (`app/test/e2e/specs/*.spec.ts`) — Linux `tauri-driver` + macOS Appium Mac2 |
+| `PW` | Playwright browser E2E (`app/test/playwright/specs/*.spec.ts`) |
| `MS` | Manual smoke (release-cut checklist) |
**Update contract** — when a PR adds, removes, or changes a feature leaf, the matrix row must be updated in the same PR. Tracking guard: see #965.
@@ -615,7 +616,7 @@ The thread JSONL store moved to `tinyagents_session::threads` (`vendor/tinyagent
| ID | Feature | Layer | Test path(s) | Status | Notes |
| --- | --- | --- | --- | --- | --- |
-| 13.7.1 | Japanese UI locale | VU+MS | `app/src/components/LanguageSelect.test.tsx`, `app/src/components/settings/panels/__tests__/ComposioPanel.test.tsx`, `app/src/store/localeSlice.test.ts`, `app/src/lib/i18n/__tests__/I18nContext.test.tsx`, `app/src/lib/i18n/__tests__/{coverage,mascotDismissPath}.test.ts`, `docs/RELEASE-MANUAL-SMOKE.md` | ✅ | Native-script picker, Japanese browser-language detection, switching back to English, unknown-key fallback, complete dictionary, exact interpolation placeholders, and matching menu labels in mascot dismissal instructions |
+| 13.7.1 | Japanese UI locale | VU+PW+MS | `app/src/components/LanguageSelect.test.tsx`, `app/src/components/settings/panels/__tests__/ComposioPanel.test.tsx`, `app/src/store/localeSlice.test.ts`, `app/src/lib/i18n/__tests__/I18nContext.test.tsx`, `app/src/lib/i18n/__tests__/{coverage,mascotDismissPath}.test.ts`, `app/test/e2e/specs/japanese-locale.browser.ts` (discovered through `app/test/playwright/specs/japanese-locale.spec.ts`), `docs/RELEASE-MANUAL-SMOKE.md` | ✅ | Browser E2E asserts settings selection, reload persistence, fresh ja-JP detection, a saved English override, Memory v2 counts and model attribution at 1280x720. Native-script picker, Japanese browser-language detection, switching back to English, unknown-key fallback, complete dictionary, exact interpolation placeholders, and matching menu labels in mascot dismissal instructions |
---