Intermittent browser/extensions/newtab/test/browser/browser_newtab_ping.js | test_newtab_dwell_time_in_ping - dwell_time is in the newtab ping - null == true
Categories
(Firefox :: New Tab Page, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: florian, Assigned: florian)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
test_newtab_dwell_time_in_ping notifies user-interaction-active-non-synthesized by hand, sleeps 100 ms, closes the tab and asserts that Glean.newtab.dwellTime has a sample. TelemetryFeed credits each session's dwell stopwatch only up to the timestamp of the last "active" notification, which is deliberate: an idle tick means the user did nothing since then.
Because the test fabricates that notification instead of generating input, it has no control over the idle deadline. EventStateManager's user-activity timer is armed by any trusted event, which test-synthesized events are, and its tick notifies user-interaction-inactive-non-synthesized, the topic the feed observes. When a tick lands inside the test's 100 ms window the feed credits zero and stops the clock, so no sample is accumulated and the ping carries no newtab.dwell_time:
TEST-UNEXPECTED-FAIL | test_newtab_dwell_time_in_ping - dwell_time is in the newtab ping - null == true
The per-test profiles show the tick: user-interaction-inactive-non-synthesized from UITimerCallback::Notify 93 ms after the test's own "active" notification and 31 ms before its cleanup. It has failed this way twice on central in the 21 days to 2026-09-16, and much more often under test-verify, which runs the file about 30 times per task.
The fix is to stub the feed's now(), which exists so tests can drive the clock, and notify "active" twice with the fake clock advanced in between, the shape a continuing interaction has. An idle tick then credits the interval between the two notifications wherever it lands.
Test dashboard: https://tests.firefox.dev/test.html?test=browser/extensions/newtab/test/browser/browser_newtab_ping.js
| Assignee | ||
Comment 1•1 month ago
|
||
test_newtab_dwell_time_in_ping fabricated one "active" notification and slept
100ms, but TelemetryFeed credits dwell only up to its last "active"
notification, so EventStateManager's idle tick, whose deadline the test does not
control, could land in the sleep, stop the stopwatch at zero and submit a ping
with no newtab.dwell_time.
Notify twice with the feed's clock advanced in between, so a tick anywhere in
the window still has an interval to credit.
Updated•1 month ago
|
Comment 3•1 month ago
|
||
| bugherder | ||
Updated•1 month ago
|
Description
•