Files
makelore/tests/e2e/language-chinese-only.spec.ts
inman 26b52d76e3
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled
feat: 完善图像工作区与创作工具体验
2026-08-16 14:08:27 +08:00

53 lines
2.4 KiB
TypeScript

import type { Page } from '@playwright/test';
import { closeElectronApp, expect, getStableWindow, test } from './fixtures/electron';
async function openSettingsFromSidebarAccountMenu(page: Page): Promise<void> {
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);
}
});
});