Skip to content

Commit 670dbdb

Browse files
author
Mu
committed
Finished tests for location tracker
1 parent a9ea505 commit 670dbdb

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed

test/e2e/mapml-viewer/localization.test.js

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ test.describe('<mapml-viewer> localization tests', () => {
8787
);
8888

8989
// check the the number of buttons match with cmLocaleList
90+
await page.waitForTimeout(200);
9091
const buttonCount = await buttons.count();
9192
expect(buttonCount).toBe(cmLocaleList.length);
9293

@@ -244,6 +245,7 @@ test.describe('<mapml-viewer> localization tests', () => {
244245
const curLocation = await map.locator(
245246
'.leaflet-pane.leaflet-tooltip-pane'
246247
);
248+
await page.waitForTimeout(500);
247249
const curLocationText = await curLocation.textContent();
248250
expect(curLocationText).toBe(locale.btnMyLocTrackOn);
249251

@@ -252,29 +254,40 @@ test.describe('<mapml-viewer> localization tests', () => {
252254
expect(showLocationText).toBeTruthy();
253255
expect(showLocationText).toBe(locale.btnLocTrackOn);
254256

257+
// compute starting and ending points for moving the map
258+
const boundingBox = await map.boundingBox();
259+
const startX = boundingBox.x + boundingBox.width / 2;
260+
const startY = boundingBox.y + boundingBox.height / 2;
261+
const endX = startX + 100;
262+
const endY = startY;
263+
264+
// move the current map
265+
await page.mouse.move(startX, startY);
266+
await page.mouse.down();
267+
await page.mouse.move(endX, endY, { steps: 20 });
268+
await page.mouse.up();
269+
270+
// my last location
271+
const lastLocation = await map.locator(
272+
'.leaflet-pane.leaflet-tooltip-pane'
273+
);
274+
await page.waitForTimeout(500);
275+
const lastLocationText = await lastLocation.textContent();
276+
expect(lastLocationText).toBe(locale.btnMyLastKnownLocTrackOn);
277+
278+
// hover text for show location - last location
279+
showLocationText = await showLocation.getAttribute('title');
280+
expect(showLocationText).toBeTruthy();
281+
expect(showLocationText).toBe(locale.btnLocTrackLastKnown);
282+
255283
// turn off show location
256284
await showLocation.click();
257-
258-
// when are btnLocTrackLastKnown and btnMyLastKnownLocTrackOn used?
259285
}
260286
});
261287

262-
test('Accessibility messages matches the locale key', async () => {
288+
test('Map feature options matches the locale key', async () => {
263289
// hover over map feature, controls after clicking on the feature
264-
const buttonNames = [
265-
'amZoom',
266-
'amColumn',
267-
'amRow',
268-
'amMaxZoom',
269-
'amMinZoom',
270-
'amZoomedOut',
271-
'amDraggedOut',
272-
'amEastBound',
273-
'amWestBound',
274-
'amNorthBound',
275-
'amSouthBound',
276-
'popupZoom'
277-
];
290+
const buttonNames = [];
278291

279292
for (const [language, locale] of locales) {
280293
// select the current map

0 commit comments

Comments
 (0)