import type { Page } from '@playwright/test'; import { closeElectronApp, expect, getStableWindow, test } from './fixtures/electron'; async function openSettingsFromSidebarAccountMenu(page: Page): Promise { await page.getByTestId('sidebar-member-menu-trigger').click(); await page.getByTestId('sidebar-nav-settings').click(); } test.describe('Chinese-only UI language', () => { test('shows only Chinese in the setup wizard', async ({ launchElectronApp }) => { const app = await launchElectronApp(); try { const page = await getStableWindow(app); await expect(page.getByTestId('setup-page')).toBeVisible(); await expect(page.getByRole('button', { name: '中文', exact: true })).toBeVisible(); await expect(page.getByRole('button', { name: 'English', exact: true })).toHaveCount(0); await expect(page.getByRole('button', { name: '日本語', exact: true })).toHaveCount(0); await expect(page.getByRole('button', { name: 'Русский', exact: true })).toHaveCount(0); } finally { await closeElectronApp(app); } }); test('keeps only Chinese in Settings', async ({ launchElectronApp }) => { const app = await launchElectronApp({ skipSetup: true }); try { const page = await getStableWindow(app); await expect(page.getByTestId('ai-module-selection-page')).toBeVisible(); await page.getByTestId('ai-module-option-programming').click(); await expect(page.getByTestId('main-layout')).toBeVisible(); await openSettingsFromSidebarAccountMenu(page); await expect(page).toHaveURL(/\/settings$/); const languageSelect = page.locator('#language'); await expect(languageSelect).toHaveValue('zh'); await expect(languageSelect.locator('option')).toHaveCount(1); await expect(languageSelect.locator('option')).toHaveText('中文'); await expect(page.getByText('配置您的 Makelore 体验', { exact: true })).toHaveCount(0); await expect(page.getByText('自定义外观和风格', { exact: true })).toHaveCount(0); await expect(page.getByText('Check the local runtime status or restart it when needed.', { exact: true })).toHaveCount(0); await expect(page.getByText('保持 Makelore 最新', { exact: true })).toHaveCount(0); await expect(page.getByText('开启自动更新后,更新将自动下载并安装。', { exact: true })).toHaveCount(0); } finally { await closeElectronApp(app); } }); });