Skip to content

test: e2e foundation (chromium限定化 + helper関数拡充)#489

Merged
niryuu merged 2 commits into
geolonia:masterfrom
niryuu:411/e2e-foundation
May 18, 2026
Merged

test: e2e foundation (chromium限定化 + helper関数拡充)#489
niryuu merged 2 commits into
geolonia:masterfrom
niryuu:411/e2e-foundation

Conversation

@niryuu

@niryuu niryuu commented May 13, 2026

Copy link
Copy Markdown
Contributor

Closes #488
Part of #411

Summary

後続フェーズで予定している E2E テスト拡充 (~57 ケース) の共通基盤を整える PR。

  • playwright.config.ts を chromium only に
  • e2e/helper.ts に 11 個の共通ヘルパー (waitForStyleLoad, mockGeoloniaTiles, recordRequests, getCenter, hasLayer 等) を追加
  • e2e/sample.spec.ts で helper の sanity check (2 件)

詳細は #488 を参照。

変更内容

playwright.config.ts

firefox / webkit プロジェクトを削除し chromium のみに。embed は maplibre-gl の薄いラッパーであり、クロスブラウザ互換は maplibre 本体のテストに委ねる。e2e は iteration 速度を優先する方針。

e2e/helper.ts

追加関数 用途
waitForStyleLoad(page, selector?) loaded() + isStyleLoaded() 完了待ち
hasMapInstance(page, selector?) container.geoloniaMap の存在確認
getCenter / getZoom / getBearing / getPitch data 属性検証用のマップ状態取得
getStyleLayerIds(page, selector?) 適用済みレイヤ ID 一覧
hasLayer / hasSource レイヤ / ソース存在確認
mockGeoloniaTiles(page) geolonia 系エンドポイントを page.route でモック。レスポンスはミニマル style v8 (layers=[background])
recordRequests(page, predicate?) 認証パラメータ検証用にリクエスト URL を記録

e2e/sample.spec.ts (新規)

  • mockGeoloniaTiles で外部ネットワーク無しに地図初期化できることの確認
  • recordRequests でリクエスト観測できることの確認

後続フェーズでテストが充実したら削除可。

Test plan

  • npm run e2e で 10/10 グリーン (既存 8 + 新規 2)
  • 既存テストへの回帰なし
  • レビュアによる helper 設計の妥当性確認

Summary by CodeRabbit

  • Tests

    • テスト用ヘルパーを大幅拡張し、地図の読み込み/スタイル読み込み待機、中心座標やズーム等の取得、レイヤー/ソース存在確認を追加
    • Geolonia/Maplibre 関連リクエストの最小モックと、リクエスト記録機能を追加
    • 新しい E2E 指定でヘルパーの動作を検証
  • Chores

    • E2E テストを Chromium(Chrome)に限定し実行効率を向上

Review Change Stack

後続フェーズの E2E テスト拡充で共通利用する基盤を整備。

- playwright.config.ts を chromium 専用にして iteration 速度を優先
  (クロスブラウザ互換は maplibre 本体のテストに委ねる)
- e2e/helper.ts に waitForStyleLoad / mockGeoloniaTiles /
  recordRequests / getCenter 等の共通ヘルパー 11 関数を追加
- e2e/sample.spec.ts で helper の sanity check (2 件)

Refs geolonia#488, geolonia#411
@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

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: 6b63c39d-d053-4b6c-a25b-d2b529af621e

📥 Commits

Reviewing files that changed from the base of the PR and between dd8ac56 and 8cc3ace.

📒 Files selected for processing (1)
  • e2e/helper.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e/helper.ts

📝 Walkthrough

Walkthrough

Playwright の E2E 設定を Chromium のみに限定し、Maplibre/Geolonia に関するマップ状態照会ユーティリティ、Geolonia タイル等をモックする network モック、リクエスト記録ユーティリティを e2e ヘルパーに追加。追加ヘルパーを検証するサンプルのスモーク spec を追加。

Changes

E2E基盤整備:Chromium限定化とヘルパー関数拡充

Layer / File(s) Summary
Playwright 実行設定を Chromium 限定化
playwright.config.ts
projects をマルチブラウザ(chromium/firefox/webkit)から chromium のみに変更。理由を示す日本語コメントを追加。
既存マップロード待機の整理
e2e/helper.ts
既存の TEST_URL / LOAD_TIMEOUTwaitForMapLoad は維持しつつ公開関数として整理(コメント更新)。
スタイル読み込み待機 / マップ存在確認
e2e/helper.ts
waitForStyleLoad(page, selector?) を追加(geoloniaMap.loaded()isStyleLoaded() を page.waitForFunction で待機)。hasMapInstance(page, selector?) を追加し geoloniaMap の存在確認を実装。
マップ状態取得ユーティリティ
e2e/helper.ts
getCenter / getZoom / getBearing / getPitch を追加し、page.evaluate 経由で map の中心座標と姿勢を取得。
スタイル構造検査ユーティリティ
e2e/helper.ts
getStyleLayerIds を追加して style.layers[].id を取得。hasLayer / hasSource を追加して指定レイヤ/ソースの有無を判定。
Geolonia タイル等モック
e2e/helper.ts
mockGeoloniaTiles(page) を追加。page.route を使い Geolonia スタイル JSON、スプライト/グリフ/フォント(404 返却)、TileJSON(固定レスポンス)、ベクトルタイル(PBF 用正規表現で 204)および legacy API エンドポイントを最小レスポンスでモックするルールを登録。
リクエスト記録ユーティリティ
e2e/helper.ts
recordRequests(page, predicate?) を追加。page.on('request', ...) で発生したリクエスト URL を指定 predicate でフィルタして収集・返却。
ヘルパーのスモークテスト
e2e/sample.spec.ts
mockGeoloniaTileswaitForStyleLoad を組み合わせてマップ初期化(map インスタンス存在/スタイルに background レイヤのみ)を検証するテストと、recordRequests で Geolonia style JSON へのリクエストが発生することを検証するテストを追加。

Sequence Diagram

sequenceDiagram
  participant Test as Test Runner (Playwright)
  participant Browser as Browser Page
  participant Map as Maplibre / geoloniaMap
  participant Tiles as Geolonia CDN / Tileserver

  Test->>Browser: open test page (mockGeoloniaTiles applied)
  Browser->>Tiles: request style JSON
  Tiles-->>Browser: mocked style JSON (minimal layers)
  Browser->>Map: initialize / load style
  Map-->>Browser: loaded() && isStyleLoaded() true
  Browser-->>Test: waitForStyleLoad resolves
  Browser->>Test: emit network requests (recordRequests collected)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 兎が跳ねて、ヘルパー増えたよ
スタイル待ちして地図を覗く
モックでそっと外を隠しつつ
リクエスト集めて、次へ跳ねる 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR タイトルは Chromium 限定化とヘルパー関数拡充という変更の主要な内容を適切に表現している。
Linked Issues check ✅ Passed 実装内容は #488 のスコープ(playwright.config.ts の Chromium 限定化、helper.ts の 11 個関数追加、sample.spec.ts のサニティチェック)を満たしており、既存テストに回帰なし。
Out of Scope Changes check ✅ Passed 変更内容は #488#411 のスコープ内に収まっており、E2E テスト基盤整備に関連する変更のみとなっている。

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@niryuu niryuu self-assigned this May 13, 2026
@niryuu
niryuu requested a review from a team May 13, 2026 00:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/helper.ts`:
- Around line 117-133: The PBF route regex doesn't match the host returned in
TileJSON (tiles.geolonia.com), so update the second page.route call (the one
handling PBF/vector tiles) to match both tiles.geolonia.com and subdomains;
change the regex used in the route for PBF in e2e/helper.ts (the
/\.tiles\.geolonia\.com\/.*\.pbf/ route) so it also accepts tiles.geolonia.com
(for example by allowing an optional leading subdomain or explicitly including
tiles.geolonia.com) ensuring the PBF mock consistently intercepts the same host
specified in the tilejson tiles array.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7905b6d4-9d0c-48f6-98a4-432dc37ac904

📥 Commits

Reviewing files that changed from the base of the PR and between 1423e5b and dd8ac56.

📒 Files selected for processing (3)
  • e2e/helper.ts
  • e2e/sample.spec.ts
  • playwright.config.ts

Comment thread e2e/helper.ts

@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.

@niryuu coderabbitaiの修正案に対応してほしいです。

PR geolonia#489 への CodeRabbit 指摘対応。

mockGeoloniaTiles 内で TileJSON が返す URL と PBF リクエストを
捕捉する regex が独立に書かれており、片方を変更したらもう片方が
取りこぼす可能性があった。両者を GEOLONIA_TILE_HOST 定数から派生
させる形に変更し、構造的に乖離を防ぐ。

PBF regex はサブドメイン有無どちらも捕捉するように拡張
(`tiles.geolonia.com` / `osm.v3.tiles.geolonia.com` どちらも対応)。

Refs geolonia#488, geolonia#411
@niryuu

niryuu commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

@niryuu coderabbitaiの修正案に対応してほしいです。

対応しました。

@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 May 15, 2026 05:32

@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.

ローカル環境でe2eテストが成功することを確認しました。
ヘルパー関数の方もOKだと思います!

@niryuu
niryuu merged commit 4620423 into geolonia:master May 18, 2026
10 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 18, 2026
2 tasks
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.

E2E foundation: chromium限定化 + helper関数拡充

3 participants