diff --git a/kort7/tests/kort7.spec.js b/kort7/tests/kort7.spec.js index f716b89..bca0f97 100644 --- a/kort7/tests/kort7.spec.js +++ b/kort7/tests/kort7.spec.js @@ -36,6 +36,47 @@ test.describe('kort7 dual map demo', () => { await expect(selection).toContainText('hjørneindikator'); }); + test('renders uncertainty circles on the maps', async ({ page }) => { + await page.goto('/kort7.html'); + await waitForMaps(page); + + await expect.poll(async () => { + return await page.locator('path').evaluateAll((nodes) => + nodes.filter((node) => { + const strokeDasharray = node.getAttribute('stroke-dasharray'); + return strokeDasharray && strokeDasharray.length > 0; + }).length + ); + }).toBeGreaterThan(0); + }); + + test('shows off-map indicators on both views', async ({ page }) => { + await page.goto('/kort7.html'); + await expect(page.locator('#offmapIndicatorsApprox .offmap-indicator')).toHaveCount(2); + await expect(page.locator('#offmapIndicatorsTrue .offmap-indicator')).toHaveCount(2); + await expect(page.locator('#offmapIndicatorsApprox')).toContainText('Bil 9'); + await expect(page.locator('#offmapIndicatorsTrue')).toContainText('Bil 10'); + }); + + test('approximate and precise positions differ for the same vehicle', async ({ page }) => { + await page.goto('/kort7.html'); + await page.getByRole('button', { name: 'Pause' }).click(); + + const selection = page.locator('#selectedVehicleInfo'); + + const approxIndicator = page.locator('#offmapIndicatorsApprox .offmap-indicator').filter({ hasText: 'Bil 9' }); + await approxIndicator.click(); + const approxText = await selection.textContent(); + + const trueIndicator = page.locator('#offmapIndicatorsTrue .offmap-indicator').filter({ hasText: 'Bil 9' }); + await trueIndicator.click(); + const trueText = await selection.textContent(); + + expect(approxText).not.toEqual(trueText); + expect(approxText).toContain('Tilnærmet position'); + expect(trueText).toContain('Præcis position'); + }); + test('playback updates simulation status over time', async ({ page }) => { await page.goto('/kort7.html'); const status = page.locator('#status');