[Flaky CI]: Playwright esm Tests - thirdPartyErrorsFilter third-party error can fire before Sentry.init

未關閉 適合新手
#26,203 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, playwright, typescript
領域
devtools, testing

研究方向

從 suites/integrations/thirdPartyErrorsFilter/test.ts、template.html 和 utils/generatePage.ts 開始,比較 first-party 錯誤和 third-party 錯誤觸發的時機。報告建議在 page.goto 後透過點擊按鈕觸發 third-party 錯誤,接著檢查測試是否收到事件並為其加上標籤。執行 esm 套件中指定的 Playwright 測試,以確認此行為。

由索引模型根據 Issue 內容生成。

描述

Waiting for: Product Owner
Flakiness Type

Timeout

Name of Job

CI: Build & Test / Playwright esm (1/4) Tests

Name of Test

suites/integrations/thirdPartyErrorsFilter/test.ts › tags event if contains at least one third-party frame (chromium)

Link to Test Run

https://github.com/getsentry/sentry-javascript/actions/runs/42369835136/job/128396391992

Details

Failed 3 times on develop between Nov 5 and Nov 7 (run, run, run), always page.waitForRequest: Test timeout of 30000ms exceeded. The other test in the file hasn't failed.

I think it's a script-ordering race. template.html loads thirdPartyScript.js as a blocking script, which throws from a setTimeout(..., 100). The init bundle is injected with scriptLoading: 'defer' (utils/generatePage.ts), so it only runs after parsing. If the deferred init takes longer than 100 ms on a slow runner, the error fires before Sentry.init has installed the global handler, and no event is ever sent. The first-party test avoids this because its error comes from page.click after page.goto.

I haven't reproduced it locally. Suggested fix: have thirdPartyScript.js throw from a click handler on its own button, and click it in the test after page.goto, mirroring the first-party test. The error still only has a frame from the third-party script, so the assertion means the same thing. Happy to open a PR if that sounds right.

主要語言
TypeScript
星號
8.8k
分支
1.9k
平均合併
1 天 21 小時
30 天內合併 PR
637

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getsentry/sentry-javascript 的其他 Issue

查看 getsentry/sentry-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。