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'], 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: any) => { await page.waitForLoadState('domcontentloaded'); const t = await page.title(); return t === 'D3RO Voice' || t === 'd3ro-voice'; } }); } }); test.afterAll(async () => { if (electronApp) { await electronApp.close(); } }); test('should navigate to all sidebar tabs correctly', async () => { // Dashboard await window.locator('nav >> text="Dashboard"').click(); await expect(window.locator('text="Dashboard"').first()).toBeVisible(); // History await window.locator('nav >> text="History"').click(); await expect(window.locator('text="History"').first()).toBeVisible(); // Dictionary await window.locator('nav >> text="Dictionary"').click(); await expect(window.locator('text="Dictionary"').first()).toBeVisible(); // Commands await window.locator('nav >> text="Commands"').click(); await expect(window.locator('text="Commands"').first()).toBeVisible(); // Voice Conversation await window.locator('nav >> text="Voice Conversation"').click(); await expect(window.locator('text="Voice Conversation"').first()).toBeVisible(); // Knowledge Base await window.locator('nav >> text="Knowledge Base"').click(); await expect(window.locator('text="Knowledge Base"').first()).toBeVisible(); // Meeting Mode await window.locator('nav >> text="Meeting Mode"').click(); await expect(window.locator('text="Meeting Mode"').first()).toBeVisible(); }); });