forked from geolonia/embed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.spec.ts
More file actions
35 lines (31 loc) · 1.25 KB
/
Copy pathsample.spec.ts
File metadata and controls
35 lines (31 loc) · 1.25 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
/**
* PR0 sanity-check: helper.ts のヘルパー群が機能していることを確認する最小テスト。
* 後続フェーズで具体的なテストが充実したら削除してよい。
*/
import { test, expect } from '@playwright/test';
import {
TEST_URL,
mockGeoloniaTiles,
waitForStyleLoad,
hasMapInstance,
getStyleLayerIds,
recordRequests,
} from './helper';
test.describe('PR0 helper sanity', () => {
test('mockGeoloniaTiles を適用すると minimal style だけが読み込まれる', async ({ page }) => {
await mockGeoloniaTiles(page);
await page.goto(`${TEST_URL}/nocontrol.html`);
await waitForStyleLoad(page);
expect(await hasMapInstance(page)).toBe(true);
const layers = await getStyleLayerIds(page);
expect(layers).toEqual(['background']);
});
test('recordRequests で geolonia 系へのリクエストを観測できる', async ({ page }) => {
await mockGeoloniaTiles(page);
const styleRequests = recordRequests(page, (url) => url.includes('cdn.geolonia.com/style/'));
await page.goto(`${TEST_URL}/nocontrol.html`);
await waitForStyleLoad(page);
expect(styleRequests.length).toBeGreaterThan(0);
expect(styleRequests[0]).toMatch(/cdn\.geolonia\.com\/style\/.+\.json/);
});
});