-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathprojectionDefault.test.js
More file actions
51 lines (47 loc) · 1.64 KB
/
projectionDefault.test.js
File metadata and controls
51 lines (47 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { test, expect, chromium } from '@playwright/test';
test.describe('Playwright Viewer Default Projection', () => {
let page;
let context;
test.beforeAll(async () => {
context = await chromium.launchPersistentContext('');
page =
context.pages().find((page) => page.url() === 'about:blank') ||
(await context.newPage());
await page.goto('projectionDefault.html');
});
test.afterAll(async function () {
await context.close();
});
test.describe('Viewer with no projection attribute', () => {
test('Viewer defaults to OSMTILE', async () => {
const mapProjection = await page.$eval(
'body > mapml-viewer',
(map) => map.projection
);
const leafletProjection = await page.$eval(
'body > mapml-viewer',
(map) => map._map.options.projection
);
const leafletProjection1 = await page.$eval(
'body > mapml-viewer',
(map) => map._map.options.crs.code
);
const projectionAttribute = await page.$eval(
'body > mapml-viewer',
(map) => map.getAttribute('projection')
);
expect(mapProjection).toEqual('OSMTILE');
expect(leafletProjection).toEqual('OSMTILE');
expect(leafletProjection1).toEqual('EPSG:3857');
expect(projectionAttribute).toEqual(null);
});
test('layer renders', async () => {
await page.waitForTimeout(500);
const featureSVG = await page.$eval(
'body > mapml-viewer > map-layer > map-feature',
(feature) => feature._groupEl.firstChild.getAttribute('d')
);
expect(featureSVG).toEqual('M62 27L62 75L206 75L206 27L62 27z');
});
});
});