2025-11-29 16:19:13 +01:00
|
|
|
// wxFileDialog Tests - File dialogs for KiCad open/save operations
|
2025-12-29 12:11:33 +01:00
|
|
|
// Uses element registry for semantic element identification
|
|
|
|
|
import { test, expect, tryLoadApp, waitForRegistry, clickByLabel } from './utils/fixtures';
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
test.describe('wxFileDialog Tests', () => {
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('FileDialog test app loads successfully', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-01-loaded.png', fullPage: true });
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
const hasStartup = testLogger.consoleLogs.some(l => l.includes('FileDialog test app started'));
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
expect(loaded, 'wxFileDialog app should load').toBe(true);
|
2025-11-29 20:54:54 +01:00
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Open file button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
await waitForRegistry(page);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
// Click "Open File..." button
|
2025-12-29 12:11:33 +01:00
|
|
|
await clickByLabel(page, 'Open File...');
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(500);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-02-open-clicked.png', fullPage: true });
|
|
|
|
|
|
|
|
|
|
expect(true).toBe(true); // Smoke test
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Save file button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
await waitForRegistry(page);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
// Click "Save File..." button
|
2025-12-29 12:11:33 +01:00
|
|
|
await clickByLabel(page, 'Save File...');
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(500);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-03-save-clicked.png', fullPage: true });
|
|
|
|
|
|
|
|
|
|
expect(true).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Open multiple button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
await waitForRegistry(page);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
// Click "Open Multiple..." button
|
2025-12-29 12:11:33 +01:00
|
|
|
await clickByLabel(page, 'Open Multiple...');
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(500);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-04-multiple-clicked.png', fullPage: true });
|
|
|
|
|
|
|
|
|
|
expect(true).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('All file dialog buttons accessible', async ({ page, testLogger }) => {
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.goto('/standalone/filedialog/filedialog_test.html');
|
|
|
|
|
const loaded = await tryLoadApp(page);
|
2026-01-01 20:18:19 +01:00
|
|
|
expect(loaded, 'App should load').toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
await waitForRegistry(page);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
|
|
|
|
// Try all three buttons
|
2025-12-29 12:11:33 +01:00
|
|
|
await clickByLabel(page, 'Open File...');
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(300);
|
2025-12-29 12:11:33 +01:00
|
|
|
await clickByLabel(page, 'Save File...');
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(300);
|
2025-12-29 12:11:33 +01:00
|
|
|
await clickByLabel(page, 'Open Multiple...');
|
2025-11-29 16:19:13 +01:00
|
|
|
await page.waitForTimeout(300);
|
|
|
|
|
|
|
|
|
|
await page.screenshot({ path: 'test-results/filedialog-05-all-buttons.png', fullPage: true });
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
});
|