Skip to content

test(weather): make widget refresh startup test deterministic - #603

Merged
YinCheng0106 merged 1 commit into
mainfrom
test/weather-refresh-startup-sync
Oct 11, 2026
Merged

YinCheng0106 merged 1 commit into
mainfrom
test/weather-refresh-startup-sync

Conversation

@YinCheng0106

@YinCheng0106 YinCheng0106 commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

這個 PR 做了什麼

修正 testWeatherAndClockStartBeforeEitherCompletes 的排程相依等待方式。原測試在 main(2b63202c)使用 200 次 Task.yield() 等待工作啟動,在 iPhone 17 Pro/iOS 27.0 模擬器重現 XCTAssertTrue failed,官方測試腳本以 65 結束。

  • 測試:僅修改 ios/RunnerTests/SavedCurrentWeatherWidgetRefreshServiceTests.swift,weather 與 clock closure 各自發出 XCTest 啟動 expectation,透過非阻塞的 fulfillment 等待兩個事件,逾時上限為 5 秒。
  • 保留原本兩個 AsyncOperationGate;兩個啟動事件確認前不開啟 gate,並檢查寫入次數為 0。等待逾時後仍依序開啟兩個 gate,再等待 refresh task 完成,避免留下受阻工作。
  • 正式程式碼與共用測試 helper 均無變更;Gallery Preview 的四個檔案不包含在本 PR,未變更 Gallery 分支。

相關 issue

無

怎麼驗

使用既有 iPhone 17 Pro/iOS 27.0 模擬器(358044FD-784B-4516-8BBD-82DC1B851AF9),所有 iOS 測試均透過 tool/dev/test_ios.sh 執行。

  • main 原始測試:1 失敗、0 通過;XCTAssertTrue failed。
  • 修正後目標測試連續執行三次:各 1 通過、0 失敗、0 跳過,腳本結束碼皆為 0。
  • tool/check.sh 全數通過,Flutter coverage 測試 3,115 通過、10 跳過、0 失敗。
  • 完整 tool/dev/test_ios.sh:327 通過、0 失敗、0 跳過;數字取自完成的 .xcresult。
  • tool/check/commits.sh origin/main..HEAD:1 commit 通過。
  • git diff --check 通過;依 commit.md 執行提交前後的 tool/commit.sh,保留 Git hooks。
  • 無 UI 或正式程式碼變更;未進行實機或 Gallery 視覺驗收。編譯仍有既有 Sendable/XCTest 連結警告。

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
  • 一個 commit 一件事:僅修正既有並行啟動測試
  • tool/check.sh 的格式、分析與 Flutter coverage 測試通過
  • 目標 Swift 測試三次及完整 Swift 測試通過
  • 無新增使用者可見字串
  • UI 設計與深色模式檢查:本 PR 無 UI 變更,不適用

@github-actions

Copy link
Copy Markdown

✅ OpenCodeReview: Review skipped: no items were selected.

@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.26%. Comparing base (2b63202) to head (398eb77).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YinCheng0106
YinCheng0106 marked this pull request as ready for review October 11, 2026 08:03
Copilot AI balanced review requested due to automatic review settings October 11, 2026 08:03

This comment was marked as low quality.

@YinCheng0106
YinCheng0106 requested a review from a team October 11, 2026 08:10
@YinCheng0106
YinCheng0106 merged commit 1271afb into main Oct 11, 2026
8 checks passed
@YinCheng0106
YinCheng0106 deleted the test/weather-refresh-startup-sync branch October 11, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants