2025-12-03 17:58:47 +01:00
|
|
|
// wxBitmapButton Tests - Bitmap buttons, toggle buttons, disabled states
|
2026-07-07 10:50:24 +02:00
|
|
|
import { test, expect, waitForWxApp } from './utils/fixtures';
|
|
|
|
|
import { clickByLabel, clickByName, stableShot } from './utils/element-tracker';
|
2025-12-03 17:58:47 +01:00
|
|
|
|
|
|
|
|
test.describe('wxBitmapButton Tests', () => {
|
|
|
|
|
|
|
|
|
|
test('Bitmap buttons test app loads successfully', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_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, 'bitmapbuttons-01-loaded.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
|
|
|
|
|
expect(testLogger.errors.filter(e => !e.includes('favicon'))).toHaveLength(0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Toolbar-style buttons can be clicked', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-01-01 20:18:19 +01:00
|
|
|
// Click Select tool button using element registry (by name)
|
|
|
|
|
await clickByName(page, 'SelectTool');
|
2025-12-30 14:17:51 +01:00
|
|
|
// Click Line tool button
|
2026-01-01 20:18:19 +01:00
|
|
|
await clickByName(page, 'LineTool');
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'bitmapbuttons-02-toolbar-click.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Toggle buttons can be toggled', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_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 F.Cu checkbox to toggle it using element registry
|
|
|
|
|
await clickByLabel(page, 'F.Cu');
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'bitmapbuttons-03-toggle.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Toggle button can toggle multiple layers', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_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
|
|
|
// Toggle multiple layer checkboxes using element registry
|
|
|
|
|
await clickByLabel(page, 'F.Cu');
|
|
|
|
|
await clickByLabel(page, 'B.Cu');
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'bitmapbuttons-04-multi-toggle.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Disabled button can be re-enabled', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_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 Toggle Enable State button using element registry
|
|
|
|
|
await clickByLabel(page, 'Toggle Enable State');
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'bitmapbuttons-05-enable-toggle.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Shape buttons display different icons', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-01-01 20:18:19 +01:00
|
|
|
// Click different shape buttons using element registry (by name)
|
|
|
|
|
await clickByName(page, 'Rectangle');
|
|
|
|
|
await clickByName(page, 'Circle');
|
|
|
|
|
await clickByName(page, 'Triangle');
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'bitmapbuttons-06-shapes.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Art Provider buttons display system icons', async ({ page, testLogger }) => {
|
|
|
|
|
await page.goto('/standalone/bitmapbuttons/bitmapbuttons_test.html');
|
2026-07-07 10:50:24 +02:00
|
|
|
await waitForWxApp(page);
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-01-01 20:18:19 +01:00
|
|
|
// Click New, Open buttons using element registry (by name)
|
|
|
|
|
await clickByName(page, 'New');
|
|
|
|
|
await clickByName(page, 'Open');
|
2025-12-03 17:58:47 +01:00
|
|
|
|
2026-07-07 10:50:24 +02:00
|
|
|
await stableShot(page, 'bitmapbuttons-07-artprovider.png', { fullPage: true });
|
2025-12-03 17:58:47 +01:00
|
|
|
});
|
|
|
|
|
});
|