Skip to content

Commit a424ff6

Browse files
committed
Try to log what gh action sees
1 parent ad21ccc commit a424ff6

File tree

1 file changed

+26
-37
lines changed

1 file changed

+26
-37
lines changed

test/e2e/core/touchDevice.test.js

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,35 @@ test.describe('Playwright touch device tests', () => {
2020

2121
test.only('Tap/Long press to show layer control', async () => {
2222
const layerControl = await page.locator('.leaflet-control-layers');
23-
await layerControl.tap();
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);
2723

28-
// expect the opacity setting not open after the click
29-
let opacity = await page.$eval(
30-
'.leaflet-control-layers-overlays > fieldset:nth-child(1) > div.mapml-layer-item-properties > div > button:nth-child(2)',
31-
(btn) => btn.getAttribute('aria-expanded')
32-
);
33-
expect(opacity).toEqual('false');
24+
// Initial state logging
25+
console.log("Initial class list:", await layerControl.evaluate(el => el.className));
26+
console.log("Initial _isExpanded:", await layerControl.evaluate(el => el._isExpanded));
3427

35-
// long press
36-
const viewer = await page.locator('mapml-viewer');
37-
await viewer.tap({ position: { x: 150, y: 150 } });
28+
// Initial tap
3829
await layerControl.tap();
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);
30+
await page.waitForTimeout(1000);
31+
32+
// Log after tap
33+
console.log("Class list after tap:", await layerControl.evaluate(el => el.className));
34+
console.log("Is expanded after tap:", await layerControl.evaluate(el => el._isExpanded));
35+
36+
// Long press simulation using touchstart/touchend
37+
await layerControl.evaluate((el) => el.dispatchEvent(new TouchEvent('touchstart')));
38+
await page.waitForTimeout(1000); // Extended delay for long press
39+
await layerControl.evaluate((el) => el.dispatchEvent(new TouchEvent('touchend')));
40+
41+
// Log after long press
42+
console.log("Class list after long press:", await layerControl.evaluate(el => el.className));
43+
console.log("Is expanded after long press:", await layerControl.evaluate(el => el._isExpanded));
44+
45+
46+
const layerControlExpanded = page.locator('.leaflet-control-layers-expanded');
47+
await layerControlExpanded.waitFor({ timeout: 10000 });
48+
4449

45-
// expect the layer context menu not show after the long press
46-
const aHandle = await page.evaluateHandle(() =>
47-
document.querySelector('mapml-viewer')
48-
);
49-
const nextHandle = await page.evaluateHandle(
50-
(doc) => doc.shadowRoot,
51-
aHandle
52-
);
53-
const resultHandle = await page.evaluateHandle(
54-
(root) => root.querySelector('.mapml-contextmenu.mapml-layer-menu'),
55-
nextHandle
56-
);
57-
const menuDisplay = await (
58-
await page.evaluateHandle(
59-
(elem) => window.getComputedStyle(elem).getPropertyValue('display'),
60-
resultHandle
61-
)
62-
).jsonValue();
63-
expect(menuDisplay).toEqual('none');
50+
const finalClassList = await layerControl.evaluate(el => el.className);
51+
console.log("Final class list:", finalClassList);
52+
expect(finalClassList).toMatch(/leaflet-control-layers-expanded/);
6453
});
6554
});

0 commit comments

Comments
 (0)