Skip to content

Commit

Permalink
Finished tests for location tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mu committed Oct 29, 2024
1 parent a9ea505 commit 670dbdb
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions test/e2e/mapml-viewer/localization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ test.describe('<mapml-viewer> 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);

Expand Down Expand Up @@ -244,6 +245,7 @@ test.describe('<mapml-viewer> 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);

Expand All @@ -252,29 +254,40 @@ test.describe('<mapml-viewer> 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
Expand Down

0 comments on commit 670dbdb

Please sign in to comment.