@@ -18,21 +18,16 @@ test.describe('Playwright touch device tests', () => {
1818 await context . close ( ) ;
1919 } ) ;
2020
21- test ( 'Tap/Long press to show layer control' , async ( ) => {
22- const layerControl = await page . locator (
23- 'div > div.leaflet-control-container > div.leaflet-top.leaflet-right > div'
24- ) ;
21+ test . only ( 'Tap/Long press to show layer control' , async ( ) => {
22+ const layerControl = await page . locator ( '.leaflet-control-layers' ) ;
2523 await layerControl . tap ( ) ;
26- let className = await layerControl . evaluate (
27- ( el ) =>
28- el . classList . contains ( 'leaflet-control-layers-expanded' ) &&
29- el . _isExpanded
30- ) ;
31- expect ( className ) . toEqual ( true ) ;
24+ await page . waitForSelector ( '.leaflet-control-layers-expanded' , { timeout : 5000 } ) ;
25+ //await expect(layerControl).toHaveClass(/leaflet-control-layers-expanded/);
26+ await expect ( layerControl ) . toHaveJSProperty ( '_isExpanded' , true ) ;
3227
3328 // expect the opacity setting not open after the click
3429 let opacity = await page . $eval (
35- 'div > div.leaflet-control-container > div.leaflet-top.leaflet-right > div > section > div .leaflet-control-layers-overlays > fieldset:nth-child(1) > div.mapml-layer-item-properties > div > button:nth-child(2)' ,
30+ '.leaflet-control-layers-overlays > fieldset:nth-child(1) > div.mapml-layer-item-properties > div > button:nth-child(2)' ,
3631 ( btn ) => btn . getAttribute ( 'aria-expanded' )
3732 ) ;
3833 expect ( opacity ) . toEqual ( 'false' ) ;
@@ -41,14 +36,11 @@ test.describe('Playwright touch device tests', () => {
4136 const viewer = await page . locator ( 'mapml-viewer' ) ;
4237 await viewer . tap ( { position : { x : 150 , y : 150 } } ) ;
4338 await layerControl . tap ( ) ;
44- await layerControl . tap ( { delay : 800 } ) ; // Simulates a long tap/press
45-
46- className = await layerControl . evaluate (
47- ( el ) =>
48- el . classList . contains ( 'leaflet-control-layers-expanded' ) &&
49- el . _isExpanded
50- ) ;
51- expect ( className ) . toEqual ( true ) ;
39+ const isCI = process . env . CI === 'true' ; // GitHub Actions sets CI=true
40+ await layerControl . tap ( { delay : isCI ? 1200 : 800 } ) ;
41+ await page . waitForSelector ( '.leaflet-control-layers-expanded' , { timeout : 5000 } ) ;
42+ //await expect(layerControl).toHaveClass(/leaflet-control-layers-expanded/);
43+ await expect ( layerControl ) . toHaveJSProperty ( '_isExpanded' , true ) ;
5244
5345 // expect the layer context menu not show after the long press
5446 const aHandle = await page . evaluateHandle ( ( ) =>
0 commit comments