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

Aperta Adatta ai principianti
#26,203 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, playwright, typescript
Ambito
devtools, testing

Direzione di ricerca

Inizia da suites/integrations/thirdPartyErrorsFilter/test.ts, template.html e utils/generatePage.ts per confrontare quando si verificano gli errori first-party e third-party. Il report suggerisce di attivare l’errore third-party facendo clic su un pulsante dopo page.goto, quindi di verificare che il test riceva e contrassegni l’evento. Esegui il test Playwright indicato nella suite esm per confermare il comportamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
8.8k
Fork
1.9k
Merge medio
1g 21h
PR unite (30g)
637

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-javascript

Tutte le issue di getsentry/sentry-javascript

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.