diff --git a/test/e2e/mapml-viewer/localization.test.js b/test/e2e/mapml-viewer/localization.test.js index 3d487cc96..c408b706a 100644 --- a/test/e2e/mapml-viewer/localization.test.js +++ b/test/e2e/mapml-viewer/localization.test.js @@ -87,6 +87,7 @@ test.describe(' localization tests', () => { ); // check the the number of buttons match with cmLocaleList + await page.waitForTimeout(200); const buttonCount = await buttons.count(); expect(buttonCount).toBe(cmLocaleList.length); @@ -244,6 +245,7 @@ test.describe(' localization tests', () => { const curLocation = await map.locator( '.leaflet-pane.leaflet-tooltip-pane' ); + await page.waitForTimeout(500); const curLocationText = await curLocation.textContent(); expect(curLocationText).toBe(locale.btnMyLocTrackOn); @@ -252,29 +254,40 @@ test.describe(' localization tests', () => { expect(showLocationText).toBeTruthy(); expect(showLocationText).toBe(locale.btnLocTrackOn); + // compute starting and ending points for moving the map + const boundingBox = await map.boundingBox(); + const startX = boundingBox.x + boundingBox.width / 2; + const startY = boundingBox.y + boundingBox.height / 2; + const endX = startX + 100; + const endY = startY; + + // move the current map + await page.mouse.move(startX, startY); + await page.mouse.down(); + await page.mouse.move(endX, endY, { steps: 20 }); + await page.mouse.up(); + + // my last location + const lastLocation = await map.locator( + '.leaflet-pane.leaflet-tooltip-pane' + ); + await page.waitForTimeout(500); + const lastLocationText = await lastLocation.textContent(); + expect(lastLocationText).toBe(locale.btnMyLastKnownLocTrackOn); + + // hover text for show location - last location + showLocationText = await showLocation.getAttribute('title'); + expect(showLocationText).toBeTruthy(); + expect(showLocationText).toBe(locale.btnLocTrackLastKnown); + // turn off show location await showLocation.click(); - - // when are btnLocTrackLastKnown and btnMyLastKnownLocTrackOn used? } }); - test('Accessibility messages matches the locale key', async () => { + test('Map feature options matches the locale key', async () => { // hover over map feature, controls after clicking on the feature - const buttonNames = [ - 'amZoom', - 'amColumn', - 'amRow', - 'amMaxZoom', - 'amMinZoom', - 'amZoomedOut', - 'amDraggedOut', - 'amEastBound', - 'amWestBound', - 'amNorthBound', - 'amSouthBound', - 'popupZoom' - ]; + const buttonNames = []; for (const [language, locale] of locales) { // select the current map