test: e2e foundation (chromium限定化 + helper関数拡充)#489
Conversation
後続フェーズの 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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughPlaywright の E2E 設定を Chromium のみに限定し、Maplibre/Geolonia に関するマップ状態照会ユーティリティ、Geolonia タイル等をモックする network モック、リクエスト記録ユーティリティを e2e ヘルパーに追加。追加ヘルパーを検証するサンプルのスモーク spec を追加。 ChangesE2E基盤整備:Chromium限定化とヘルパー関数拡充
Sequence DiagramsequenceDiagram
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
e2e/helper.tse2e/sample.spec.tsplaywright.config.ts
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
対応しました。 |
sanak
left a comment
There was a problem hiding this comment.
ローカル環境でe2eテストが成功することを確認しました。
ヘルパー関数の方もOKだと思います!
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.tsfirefox / webkit プロジェクトを削除し chromium のみに。embed は maplibre-gl の薄いラッパーであり、クロスブラウザ互換は maplibre 本体のテストに委ねる。e2e は iteration 速度を優先する方針。
e2e/helper.tswaitForStyleLoad(page, selector?)loaded()+isStyleLoaded()完了待ちhasMapInstance(page, selector?)container.geoloniaMapの存在確認getCenter / getZoom / getBearing / getPitchgetStyleLayerIds(page, selector?)hasLayer / hasSourcemockGeoloniaTiles(page)page.routeでモック。レスポンスはミニマル style v8 (layers=[background])recordRequests(page, predicate?)e2e/sample.spec.ts(新規)mockGeoloniaTilesで外部ネットワーク無しに地図初期化できることの確認recordRequestsでリクエスト観測できることの確認後続フェーズでテストが充実したら削除可。
Test plan
npm run e2eで 10/10 グリーン (既存 8 + 新規 2)Summary by CodeRabbit
Tests
Chores