2025-12-03 17:58:47 +01:00
// Specialized wxWidgets Controls Tests - Treebook, RearrangeCtrl, BitmapComboBox
2026-07-07 10:50:24 +02:00
import { test , expect } from './utils/fixtures' ;
import { clickByLabel , clickComboButton , selectComboItem , clickListboxItem , clickTreeItem , waitForWxApp , stableShot } from './utils/element-tracker' ;
2025-12-03 17:58:47 +01:00
test . describe ( 'Specialized wxWidgets Controls Tests' , ( ) = > {
test ( 'Specialized controls test app loads successfully' , async ( { page , testLogger } ) = > {
await page . goto ( '/standalone/specialized/specialized_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 , 'specialized-01-loaded.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
expect ( testLogger . errors . filter ( e = > ! e . includes ( 'favicon' ) ) ) . toHaveLength ( 0 ) ;
} ) ;
test ( 'wxTreebook displays tree with pages' , async ( { page , testLogger } ) = > {
await page . goto ( '/standalone/specialized/specialized_test.html' ) ;
2026-07-07 10:50:24 +02:00
await waitForWxApp ( page ) ;
2025-12-03 17:58:47 +01:00
// Treebook should show General page by default with tree on left
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-02-treebook-initial.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
2026-01-01 20:18:19 +01:00
test ( 'wxTreebook can navigate between pages' , async ( { page , testLogger } ) = > {
2025-12-03 17:58:47 +01:00
await page . goto ( '/standalone/specialized/specialized_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 on Display page using element registry
await clickTreeItem ( page , 'Display' ) ;
2026-07-07 10:50:24 +02:00
await page . waitForTimeout ( 200 ) ; // eslint-disable-line -- documented interaction dwell: treebook page-switch settle before the next tree click (no console observable in this app)
2026-01-01 20:18:19 +01:00
// Click on Printing page using element registry
await clickTreeItem ( page , 'Printing' ) ;
2025-12-03 17:58:47 +01:00
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-03-treebook-subpage.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
test ( 'wxTreebook can expand tree nodes' , async ( { page , testLogger } ) = > {
await page . goto ( '/standalone/specialized/specialized_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 on Editing page using element registry
2026-01-01 20:18:19 +01:00
await clickTreeItem ( page , 'Editing' ) ;
2025-12-03 17:58:47 +01:00
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-04-treebook-expand.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
test ( 'wxBitmapComboBox displays layer swatches' , async ( { page , testLogger } ) = > {
await page . goto ( '/standalone/specialized/specialized_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 on layer combo box to open dropdown using element tracking
const opened = await clickComboButton ( page ) ;
expect ( opened , 'Should be able to open BitmapComboBox dropdown' ) . toBe ( true ) ;
2025-12-03 17:58:47 +01:00
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-05-bitmapcombo-dropdown.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
test ( 'wxBitmapComboBox can select different layer' , async ( { page , testLogger } ) = > {
await page . goto ( '/standalone/specialized/specialized_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
// Select B.Cu layer using element tracking
const selected = await selectComboItem ( page , 'B.Cu' ) ;
expect ( selected , 'Should be able to select B.Cu from dropdown' ) . toBe ( true ) ;
2025-12-03 17:58:47 +01:00
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-06-bitmapcombo-select.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
test ( 'wxRearrangeCtrl displays layer order' , async ( { page , testLogger } ) = > {
await page . goto ( '/standalone/specialized/specialized_test.html' ) ;
2026-07-07 10:50:24 +02:00
await waitForWxApp ( page ) ;
2025-12-03 17:58:47 +01:00
// RearrangeCtrl should show list of layers with checkboxes
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-07-rearrange-list.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
2025-12-30 14:17:51 +01:00
test ( 'wxRearrangeCtrl Get Layer Status button works' , async ( { page , testLogger } ) = > {
2025-12-03 17:58:47 +01:00
await page . goto ( '/standalone/specialized/specialized_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 Get Layer Status button using element registry
await clickByLabel ( page , 'Get Layer Status' ) ;
2025-12-03 17:58:47 +01:00
2026-07-07 10:50:24 +02:00
await stableShot ( page , 'specialized-08-get-order.png' , { fullPage : true } ) ;
2025-12-03 17:58:47 +01:00
} ) ;
} ) ;