2025-12-29 12:11:33 +01:00
|
|
|
// wxDialog/wxMessageBox Tests - Modal dialogs for KiCad confirmations, errors, properties
|
|
|
|
|
// Uses element registry for semantic element identification
|
2026-07-07 10:50:24 +02:00
|
|
|
import { test, expect, waitForWxApp, clickByLabel } from './utils/fixtures';
|
|
|
|
|
import { stableShot } from './utils/element-tracker';
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-11-29 18:42:27 +01:00
|
|
|
test.describe('wxDialog/wxMessageBox Tests', () => {
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Dialog test app loads successfully', async ({ page, testLogger }) => {
|
2025-11-29 18:42:27 +01:00
|
|
|
await page.goto('/standalone/dialog/dialog_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-11-29 18:42:27 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'dialog-01-loaded.png', { fullPage: true });
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
const hasStartupLog = testLogger.consoleLogs.some(log =>
|
2025-11-29 16:19:13 +01:00
|
|
|
log.includes('DIALOG_TEST') && log.includes('started successfully')
|
|
|
|
|
);
|
|
|
|
|
|
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('Info dialog button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 18:42:27 +01:00
|
|
|
await page.goto('/standalone/dialog/dialog_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-11-29 18:42:27 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
// Click "Info Dialog" button
|
|
|
|
|
await clickByLabel(page, 'Info Dialog');
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await expect.poll(
|
|
|
|
|
() => testLogger.consoleLogs.some(l => l.includes('Opening Info dialog')),
|
|
|
|
|
{ message: 'Info dialog should open' }
|
|
|
|
|
).toBe(true);
|
2025-11-29 18:42:27 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'dialog-02-info-clicked.png', { fullPage: true });
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Yes/No dialog button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 18:42:27 +01:00
|
|
|
await page.goto('/standalone/dialog/dialog_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-11-29 18:42:27 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
// Click "Yes/No Dialog" button
|
|
|
|
|
await clickByLabel(page, 'Yes/No Dialog');
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await expect.poll(
|
|
|
|
|
() => testLogger.consoleLogs.some(l => l.includes('Opening Yes/No dialog')),
|
|
|
|
|
{ message: 'Yes/No dialog should open' }
|
|
|
|
|
).toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'dialog-03-yesno-clicked.png', { fullPage: true });
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
|
2025-11-29 20:54:54 +01:00
|
|
|
test('Error dialog button can be clicked', async ({ page, testLogger }) => {
|
2025-11-29 18:42:27 +01:00
|
|
|
await page.goto('/standalone/dialog/dialog_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-11-29 18:42:27 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
// Click "Error Dialog" button
|
|
|
|
|
await clickByLabel(page, 'Error Dialog');
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await expect.poll(
|
|
|
|
|
() => testLogger.consoleLogs.some(l => l.includes('Opening Error dialog')),
|
|
|
|
|
{ message: 'Error dialog should open' }
|
|
|
|
|
).toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'dialog-04-error-clicked.png', { fullPage: true });
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
test('Custom dialog button can be clicked', async ({ page }) => {
|
2025-11-29 18:42:27 +01:00
|
|
|
await page.goto('/standalone/dialog/dialog_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-11-29 18:42:27 +01:00
|
|
|
|
2025-12-29 12:11:33 +01:00
|
|
|
// Click "Custom Dialog" button
|
|
|
|
|
await clickByLabel(page, 'Custom Dialog');
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'dialog-05-custom-clicked.png', { fullPage: true });
|
2025-11-29 16:19:13 +01:00
|
|
|
|
2025-11-29 18:42:27 +01:00
|
|
|
expect(true).toBe(true);
|
2025-11-29 16:19:13 +01:00
|
|
|
});
|
|
|
|
|
});
|