import * as fs from 'fs'; import * as path from 'path'; import { test, expect, _electron as electron } from '@playwright/test'; test.describe('Navigation', () => { test.describe.configure({ mode: 'serial' }); let electronApp: any; let window: any; test.beforeAll(async () => { electronApp = await electron.launch({ args: ['out/main/index.js', '--user-data-dir=C:/Users/encep/AppData/Local/Temp/playwright-d3ro-test-navigation'], env: { ...process.env, NODE_ENV: 'test', }, }); let found = false; for (const w of electronApp.windows()) { await w.waitForLoadState('domcontentloaded'); const t = await w.title(); if (t === 'D3RO Voice' || t === 'd3ro-voice') { window = w; found = true; break; } } if (!found) { window = await electronApp.waitForEvent('window', { predicate: async (page) => { await page.waitForLoadState('domcontentloaded'); const t = await page.title(); return t === 'D3RO Voice' || t === 'd3ro-voice'; } }); } // Bypass onboarding via IPC config set await window.evaluate(async () => { if (window.electronAPI && window.electronAPI.config) { await window.electronAPI.config.set({ key: 'onboardingCompleted', value: true }); await window.electronAPI.config.set({ key: 'appUsageMode', value: 'online' }); await window.electronAPI.config.set({ key: 'llmBackend', value: 'online' }); } }); // Wait for the config to propagate then reload the page await window.waitForTimeout(500); await window.reload(); await window.waitForLoadState('domcontentloaded'); // Wait for React to mount AppLayout await window.waitForTimeout(1000); }); test.afterAll(async () => { if (electronApp) { await electronApp.close(); } }); test('should navigate to all sidebar tabs correctly', async () => { // Dashboard await window.locator('text=/^(Dashboard|대시보드)$/').first().click(); await expect(window.locator('text=/^(Current Backend|현재 백엔드)$/').first()).toBeVisible(); // History await window.locator('text=/^(History|히스토리|기록)$/').first().click(); await expect(window.locator('text=/^(History|히스토리|변환 기록)$/').first()).toBeVisible(); // Dictionary await window.locator('text=/^(Dictionary|사전|단어장)$/').first().click(); await expect(window.locator('text=/^(Custom Dictionary|커스텀 사전|단어장)$/').first()).toBeVisible(); // Commands await window.locator('text=/^(Commands|명령어)$/').first().click(); await expect(window.locator('text=/^(LLM Commands|LLM 명령어)$/').first()).toBeVisible(); // Voice Conversation await window.locator('text=/^(Conversation|대화|음성 대화)$/').first().click(); await expect(window.locator('text=/^(Voice Conversation|음성 대화)$/').first()).toBeVisible(); // Knowledge Base await window.locator('text=/^(Knowledge|지식 베이스)$/').first().click(); await expect(window.locator('text=/^(Knowledge Base|지식 베이스)$/').first()).toBeVisible(); // Meeting Mode await window.locator('text=/^(Meeting|회의|회의 모드)$/').first().click(); await expect(window.locator('text=/^(Meeting Mode|회의 모드)$/').first()).toBeVisible(); }); });