fix(trace-utils): format timestamps with hours when trace duration ex…#41268
Open
Git-Raini wants to merge 1 commit into
Open
fix(trace-utils): format timestamps with hours when trace duration ex…#41268Git-Raini wants to merge 1 commit into
Git-Raini wants to merge 1 commit into
Conversation
…ceeds 60 minutes Previously, formatTimestamp capped at minutes, producing '120:00.000' for traces lasting two hours. This change adds hour-level formatting so long-running traces render correctly as '2:00:00.000'. Fixes microsoft#40068
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: format timestamps with hours when trace duration exceeds 60 minutes
Summary
Fixes #40068 — Trace timeline displays incorrect time format when test or fixture duration exceeds 60 minutes.
Problem
When a trace session lasts longer than 60 minutes (e.g. an
APIRequestContextfixture that runs for hours), the trace viewer's CLI timeline shows:instead of:
This is confusing and makes it difficult to read long-running test traces.
Root Cause
formatTimestamp(ms, base)inpackages/playwright-core/src/tools/trace/traceUtils.tsonly formats up tominutes:seconds.millis. Durations ≥ 60 min overflow into raw minute counts.Solution
Updated
formatTimestampto:H:MM:SS.mmmwhenhours > 0M:SS.mmmformat for sub-hour traces (backward-compatible)Files Changed
packages/playwright-core/src/tools/trace/traceUtils.ts— 10 insertions(+), 3 deletions(-)Benefits