2025-12-03 17:58:47 +01:00
|
|
|
// wxPrintPreview Tests - Print preview, page setup
|
2026-07-07 10:50:24 +02:00
|
|
|
import { test, expect } from './utils/fixtures';
|
|
|
|
|
import { clickByLabel, waitForWxApp, stableShot } from './utils/element-tracker';
|
2025-12-03 17:58:47 +01:00
|
|
|
|
|
|
|
|
test.describe('wxPrintPreview Tests', () => {
|
|
|
|
|
|
|
|
|
|
test('Print preview test app loads successfully', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/printpreview/printpreview_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'printpreview-01-loaded.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
|
|
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Preview area displays schematic-like content', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/printpreview/printpreview_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
|
|
|
|
// Preview area should show sample schematic with grid, components, and title block
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'printpreview-02-preview-area.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Print Preview button opens preview frame', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/printpreview/printpreview_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click Print Preview button using element registry
|
|
|
|
|
const clicked = await clickByLabel(page, 'Print Preview');
|
|
|
|
|
expect(clicked, 'Print Preview button should be found and clicked').toBe(true);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'printpreview-03-preview-frame.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Page Setup button opens dialog', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/printpreview/printpreview_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click Page Setup button using element registry
|
|
|
|
|
const clicked = await clickByLabel(page, 'Page Setup');
|
|
|
|
|
expect(clicked, 'Page Setup button should be found and clicked').toBe(true);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'printpreview-04-page-setup.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Print settings display shows current configuration', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/printpreview/printpreview_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
|
|
|
|
// Settings display should show orientation, paper size, quality, color
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'printpreview-05-settings.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
});
|