Skip to content

test(e2e): backport maps-core PR #81 — robust minimal style fixture#492

Merged
niryuu merged 1 commit into
masterfrom
490/backport-minimal-style-fixture
Jun 3, 2026
Merged

test(e2e): backport maps-core PR #81 — robust minimal style fixture#492
niryuu merged 1 commit into
masterfrom
490/backport-minimal-style-fixture

Conversation

@niryuu

@niryuu niryuu commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Closes #490
Part of #411

Summary

maps-core PR geolonia/maps-core#81 で適用された E2E flaky 対策と同じ解決策を embed の helper に backport。

embed の E2E は現状 4 spec / 10 ケースで外部依存は external-style.spec.ts (smoke) のみだが、mockGeoloniaTiles が返す minimal style が以下の点で robust ではなかった:

  • glyphs フィールド未設定 → MapLibre が symbol layer の add を silently skip する条件
  • attribution を持つ source が無い → attribution 取得テストで集計対象が空

将来の Phase 1a 以降 (data 属性、marker/popup、コントロール、SimpleStyle 等) で symbol layer や attribution を使うテストが追加されたときに flaky 化する前に予防的に修正する。

変更内容

e2e/helper.ts

mockGeoloniaTiles が返す minimal style を maps-core の sample-basic-style.json と同等構造に:

{
  "version": 8,
  "glyphs": "/glyphs/{fontstack}/{range}.pbf",
  "sources": {
    "fixture": {
      "type": "geojson",
      "data": { "type": "FeatureCollection", "features": [] },
      "attribution": "<a href=\"https://example.com\">Test fixture</a>"
    }
  },
  "layers": [
    { "id": "background", "type": "background", "paint": { "background-color": "#cccccc" } },
    { "id": "fixture", "type": "fill", "source": "fixture", "paint": { "fill-color": "#cccccc" } }
  ]
}

e2e/sample.spec.ts

getStyleLayerIds の期待値を ['background', 'fixture'] に更新。

docs/e2e/sample-basic-style.json (新規)

同一の fixture を JSON ファイルとしても配置。後続フェーズで HTML テストページから data-style="./sample-basic-style.json" で参照可能。

維持する外部依存

maps-core PR #81 と同じ方針で、external-style.spec.ts は外部 URL (tile.openstreetmap.jp) のままにする。外部 fetch 検証が目的のため。

Test plan

  • npm run e2e -- --reporter=list で 10/10 グリーン
  • external-style.spec.ts も pass (外部 URL のまま動作)
  • レビュアによる minimal style 構造の妥当性確認

Summary by CodeRabbit

  • 新機能

    • サンプルのMapbox v8スタイルJSONが追加され、より詳細なスタイル設定とアトリビューション検証に対応しました。
  • テスト

    • サニティチェックテストの期待スタイルレイヤを更新し、追加レイヤおよびアトリビューション用fixtureへの対応を確認する内容に改善しました。
  • ドキュメント

    • スタイルJSONおよびテスト内の用途や注意点に関するコメントを追加・更新しました。

E2E flaky 対策。maps-core PR #81 と同じ解決策を embed の helper に backport。

- e2e/helper.ts の mockGeoloniaTiles が返す minimal style を強化:
  - glyphs フィールド (symbol layer が silently skip されないため必須)
  - dummy fixture source + attribution (attribution テストで集計対象を作る)
  - background + fixture fill レイヤ
- e2e/sample.spec.ts の期待 layers を ['background', 'fixture'] に更新
- docs/e2e/sample-basic-style.json を新規追加。後続フェーズで
  data-style="./sample-basic-style.json" として参照可能

10/10 グリーン確認済み。external-style.spec.ts は smoke として外部 URL を保持。

Closes #490
Part of #411
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1dac60ad-5024-4539-ab99-aae11e78ff53

📥 Commits

Reviewing files that changed from the base of the PR and between c8d6d07 and 5372306.

📒 Files selected for processing (3)
  • docs/e2e/sample-basic-style.json
  • e2e/helper.ts
  • e2e/sample.spec.ts

📝 Walkthrough

Walkthrough

E2E テストの最小スタイル定義を Mapbox Style v8 互換の完全形式に統一。新しい参照スタイル JSON を導入し、mock ヘルパーを拡張してそれに合わせ、テスト期待値を更新した。

Changes

E2E最小スタイル統一

Layer / File(s) Summary
Minimal Style v8 参照定義
docs/e2e/sample-basic-style.json
glyphs テンプレート URL、fixture GeoJSON ソース(attribution 付き)、background・fixture fill レイヤを含む完全な Mapbox Style v8 JSON を導入。
Mock ヘルパーと E2E テスト統一
e2e/helper.ts, e2e/sample.spec.ts
mockGeoloniaTiles が返すスタイルを glyphs、fixture ソース、fixture レイヤで拡張し、テスト期待値を ['background'] から ['background', 'fixture'] に更新。glyphs パス参照は network エラーを回避するため 404 ルート で処理。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • geolonia/embed#489: Both PRs modify e2e/helper.ts's mockGeoloniaTiles minimal style v8 behavior (and the corresponding e2e/sample.spec.ts layer expectations), with the main PR extending the mocked layers from ['background'] to ['background', 'fixture'].

Suggested reviewers

  • smellman
  • sanak

Poem

🐰✨ 最小スタイルが整い

Glyphs と fixture が仲間入り

Attribution も集計され

E2E の地盤固まる!🗺️🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRタイトルはmaps-core PR #81のバックポートという主要な変更を正確に要約しており、E2Eテストの堅牢な最小スタイルフィクスチャの導入について明確に説明している。
Linked Issues check ✅ Passed PR #490の目標である「maps-core PR #81と同じE2E通信緩和ソリューションをembedに適用すること」がこのPRで完全に実装されている。mockGeoloniaTilesの更新、glyphsフィールドの追加、GeoJSONソースとレイヤの追加、期待値の更新が全て含まれている。
Out of Scope Changes check ✅ Passed 全ての変更がPR #490で要求されたmaps-core PR #81のバックポート範囲内である。docs/e2e/sample-basic-style.jsonの追加、e2e/helper.tsの更新、e2e/sample.spec.tsの更新は全て最小スタイルフィクスチャの堅牢化という目標に直結しており、外部URLの検証テストは継続されている。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 490/backport-minimal-style-fixture

Comment @coderabbitai help to get the list of available commands and usage tips.

@niryuu
niryuu requested a review from a team June 2, 2026 22:39

@smellman smellman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@smellman
smellman requested a review from a team June 3, 2026 02:16

@sanak sanak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@niryuu
niryuu merged commit 4636cff into master Jun 3, 2026
11 checks passed
@niryuu
niryuu deleted the 490/backport-minimal-style-fixture branch June 3, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Backport: E2Eテストの通信を緩和

3 participants