zeroclaw/web/playwright.config.ts
argenis de la rosa 3f5c57634b feat(web): replace native language selects with custom dropdown and fix RTL text alignment
This commit modernizes the language selector UI across the ZeroClaw web dashboard by replacing
native <select> elements with a shared custom dropdown component featuring styled flag icons,
proper RTL/LTR text direction support, and consistent left-aligned text for all languages.

Changes:
- Add LanguageSelector component with custom dropdown, flag badges, and check mark for selected option
- Wire document direction updates on locale change for Arabic, Hebrew, Urdu, and other RTL languages
- Fix RTL text alignment in dropdown options by applying dir attribute only to text spans
- Update pairing dialog and authenticated header to use the shared LanguageSelector
- Add locale metadata helpers: getLanguageOption, getLanguageOptionLabel, getLocaleDirection, applyLocaleToDocument
- Add Vitest configuration and unit tests for i18n helpers
- Add Playwright E2E tests verifying all 31 locales with flag visibility and lang/dir attributes

Testing:
- Unit tests: 5 passed (npm run test:unit)
- Build: passed (npm run build)
- E2E tests: 34 passed (npx playwright test)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:50:21 -04:00

35 lines
1010 B
TypeScript

import { defineConfig } from '@playwright/test';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const FRONTEND_PORT = Number(process.env.PW_WEB_PORT ?? '4173');
const BACKEND_PORT = Number(process.env.PW_API_PORT ?? '4174');
const rootDir = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
testDir: './e2e',
timeout: 60_000,
expect: {
timeout: 10_000,
},
use: {
baseURL: `http://127.0.0.1:${FRONTEND_PORT}`,
headless: true,
trace: 'on-first-retry',
},
webServer: [
{
command: `node e2e/mock-server.mjs`,
url: `http://127.0.0.1:${BACKEND_PORT}/health`,
reuseExistingServer: true,
cwd: rootDir,
},
{
command: `VITE_API_TARGET=http://127.0.0.1:${BACKEND_PORT} VITE_WS_TARGET=ws://127.0.0.1:${BACKEND_PORT} npm run dev -- --host 127.0.0.1 --port ${FRONTEND_PORT}`,
url: `http://127.0.0.1:${FRONTEND_PORT}/_app/`,
reuseExistingServer: true,
cwd: rootDir,
},
],
});