Skip to content

Commit 0c7d043

Browse files
yhy0217prushforth
authored andcommitted
change the way to test the layerControl that should only be visible when there is a non-hidden layer
1 parent 40db261 commit 0c7d043

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/e2e/layers/layerControl.test.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ test.describe('Playwright layerControl Tests', () => {
1818

1919
test('Control panel hidden when no layers/all layers hidden', async () => {
2020
const controlsHidden = await page.$eval(
21-
'css=body > mapml-viewer:nth-child(1) >> css=div > div.leaflet-control-container > div.leaflet-top.leaflet-right > div',
21+
'body > mapml-viewer >> css=div > div.leaflet-control-container > div.leaflet-top.leaflet-right > div',
2222
(elem) => elem.hasAttribute('hidden')
2323
);
2424
expect(controlsHidden).toEqual(true);
2525
});
2626

2727
test('Control panel shown when layers are on map', async () => {
28+
const map = await page.locator('body > mapml-viewer');
29+
await map.evaluate((map) => map.querySelector('layer-').removeAttribute('hidden'));
30+
await page.waitForTimeout(500);
2831
const controlsHidden = await page.$eval(
29-
'css=body > mapml-viewer:nth-child(2) >> css=div > div.leaflet-control-container > div.leaflet-top.leaflet-right > div',
32+
'body > mapml-viewer >> css=div > div.leaflet-control-container > div.leaflet-top.leaflet-right > div',
3033
(elem) => elem.hasAttribute('hidden')
3134
);
3235
expect(controlsHidden).toEqual(false);

0 commit comments

Comments
 (0)