141 lines
3.8 KiB
TypeScript
141 lines
3.8 KiB
TypeScript
/**
|
|
* Native App E2E Tests
|
|
*
|
|
* Tests that run against the actual Tauri desktop application.
|
|
* These tests validate real IPC commands and native functionality.
|
|
*/
|
|
|
|
/// <reference path="./globals.d.ts" />
|
|
|
|
import {
|
|
executeInApp,
|
|
waitForAppReady,
|
|
navigateTo,
|
|
getWindowTitle,
|
|
waitForLoadingComplete,
|
|
isVisible,
|
|
takeScreenshot,
|
|
} from './fixtures';
|
|
|
|
describe('NoteFlow Desktop App', () => {
|
|
before(async () => {
|
|
await waitForAppReady();
|
|
});
|
|
|
|
describe('app initialization', () => {
|
|
it('should load with correct window title', async () => {
|
|
const title = await getWindowTitle();
|
|
expect(title).toContain('NoteFlow');
|
|
});
|
|
|
|
it('should have Tauri IPC available', async () => {
|
|
// In Tauri 2.0, __TAURI__ may not be directly on window
|
|
// Instead, verify IPC works by checking if API functions exist
|
|
const result = await browser.execute(() => {
|
|
const api = window.__NOTEFLOW_API__;
|
|
return {
|
|
hasApi: !!api,
|
|
hasFunctions: !!(api?.listMeetings && api?.getPreferences),
|
|
};
|
|
});
|
|
expect(result.hasApi).toBe(true);
|
|
expect(result.hasFunctions).toBe(true);
|
|
});
|
|
|
|
it('should render the main layout', async () => {
|
|
const hasMain = await isVisible('main');
|
|
expect(hasMain).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('navigation', () => {
|
|
it('should navigate to meetings page', async () => {
|
|
await navigateTo('/meetings');
|
|
await waitForLoadingComplete();
|
|
|
|
const hasContent = await isVisible('main');
|
|
expect(hasContent).toBe(true);
|
|
});
|
|
|
|
it('should navigate to settings page', async () => {
|
|
await navigateTo('/settings');
|
|
await waitForLoadingComplete();
|
|
|
|
const hasContent = await isVisible('main');
|
|
expect(hasContent).toBe(true);
|
|
});
|
|
|
|
it('should navigate to recording page', async () => {
|
|
await navigateTo('/recording/new');
|
|
await waitForLoadingComplete();
|
|
|
|
const hasContent = await isVisible('main');
|
|
expect(hasContent).toBe(true);
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('gRPC Connection', () => {
|
|
before(async () => {
|
|
await waitForAppReady();
|
|
});
|
|
|
|
it('should show connection status indicator', async () => {
|
|
// The connection status component should be visible
|
|
const _hasStatus = await isVisible('[data-testid="connection-status"]');
|
|
// May or may not be visible depending on UI design
|
|
await takeScreenshot('connection-status');
|
|
});
|
|
|
|
it('should handle connection to backend', async () => {
|
|
// Check if the app can communicate with the gRPC server
|
|
// This tests real Tauri IPC → Rust → gRPC flow
|
|
const result = await executeInApp<{ meetings?: unknown[]; error?: string }>({
|
|
type: 'listMeetings',
|
|
limit: 1,
|
|
});
|
|
|
|
expect(result).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('Audio Device Access', () => {
|
|
before(async () => {
|
|
await waitForAppReady();
|
|
await navigateTo('/recording/new');
|
|
await waitForLoadingComplete();
|
|
});
|
|
|
|
it('should list available audio devices', async () => {
|
|
// Test real audio device enumeration via Tauri IPC
|
|
// Note: listAudioDevices is the API method name
|
|
const result = await executeInApp<{ success?: boolean; devices?: unknown[]; error?: string }>({
|
|
type: 'listAudioDevices',
|
|
});
|
|
|
|
expect(result).toBeDefined();
|
|
if (result.success) {
|
|
expect(Array.isArray(result.devices)).toBe(true);
|
|
}
|
|
});
|
|
});
|
|
|
|
describe('Preferences', () => {
|
|
before(async () => {
|
|
await waitForAppReady();
|
|
await navigateTo('/settings');
|
|
await waitForLoadingComplete();
|
|
});
|
|
|
|
it('should load user preferences', async () => {
|
|
const result = await executeInApp<{ success?: boolean; prefs?: Record<string, unknown>; error?: string }>({
|
|
type: 'getPreferences',
|
|
});
|
|
|
|
expect(result).toBeDefined();
|
|
if (result.success) {
|
|
expect(result.prefs).toBeDefined();
|
|
}
|
|
});
|
|
});
|