From 4674205dee7feee46fbaae307ddf1b786781ef85 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 17 Sep 2024 11:00:00 -0700 Subject: [PATCH] fix(trace-viewer): time delta between local and remote actions --- packages/trace-viewer/src/ui/modelUtil.ts | 2 +- tests/assets/trace-remote-time-diff.zip | Bin 0 -> 9102 bytes tests/library/trace-viewer.spec.ts | 6 ++++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/assets/trace-remote-time-diff.zip diff --git a/packages/trace-viewer/src/ui/modelUtil.ts b/packages/trace-viewer/src/ui/modelUtil.ts index a544d4dc3fab2..098b387c8fd6c 100644 --- a/packages/trace-viewer/src/ui/modelUtil.ts +++ b/packages/trace-viewer/src/ui/modelUtil.ts @@ -312,7 +312,7 @@ function monotonicTimeDeltaBetweenLibraryAndRunner(nonPrimaryContexts: ContextEn for (const action of context.actions) { if (!action.startTime) continue; - const key = matchByStepId ? action.stepId! : `${action.apiName}@${(action as any).wallTime}`; + const key = matchByStepId ? action.callId! : `${action.apiName}@${(action as any).wallTime}`; const libraryAction = libraryActions.get(key); if (libraryAction) return action.startTime - libraryAction.startTime; diff --git a/tests/assets/trace-remote-time-diff.zip b/tests/assets/trace-remote-time-diff.zip new file mode 100644 index 0000000000000000000000000000000000000000..e7d7c54c35c8cf883f7536464f1cebb52f110a06 GIT binary patch literal 9102 zcmZ{qV{j$j+T~Ad+qP}9JGOPgj-8XFW81cEbZpypI<`CN%>TYqGjr$8ytV78jjFwB z@8`q%@>|Ms5RjMv000)iugRv<4P!b|00jWx|8oQnAOyIYySOsDI-8i9YpBBkAVm7l zEdEt)AOrvyTWSlcizjLl{D5aSP}&p>n(d(kpH1|f z-{~)gR7n+w~pMBCpeR+D4!YaD?~F=PlJ9x)`C zWBlkT6+Vm(S-MM~R;&)0NYQMM)}uQ?F5nhvsQi82J!UD##zEZ^VWTo!!r1KgvUt_q ziI$Hi`ovc0m$f&pUs0tNNt1$I(zALNHss+6`a-xBr>1{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p+xVURy?7beqGH0w`u+@R@f(bbmsPa;NQp=Rh0;(aQAK{CA)V?pH}kTZzD z1fvx^hwI2Q={IINtrd1JCvj-1SdP_kJccqgLLm0_U0%V~-Y*Pf|I8ZO**D z!by2x(yW&a(_YpAt=*lGCRG6l@W0Sv!Y@LQNEnRsAzx=bglIFcdo@uvk5}Oj!e3$2 zfj_H_cTTlrii@vo3eKX6`rg(ZXQyQR&Hyw3-kNO8qFLf_jX;>Zx^W?Q1N1-CE^{$9L@4MRx2L^eHm<)NA&4wyk#@%WD5svwK3wh@?EmwzPC;IoWOznN?bzdZqsD zEJ?Y>w~^O5V|3;G>o3^<&Hg$kHU+i+iF*M5Ddc}+e=e>jrZz7B74rCR;2+f_AH2UP zBA~Cg7`d=rS6C2&ZDtA7mtNd7#CBf z&O&;70BJgklP|)uY_e$|IjMg*DOaAlc53g~CqP*a44fF^zl)&Y{_{=%;GdugpgG`Q ztA7uqK>g1^%6~x0f7kneY3IM|9sLt@`49H_kL3S{d;X{7|J}rYm)s}&Ka&5erT?8K U6!gD71o6*!`DYFw|JUw+0NpDkNdN!< literal 0 HcmV?d00001 diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.ts index 2b00949b199b2..44c1258eb7e8b 100644 --- a/tests/library/trace-viewer.spec.ts +++ b/tests/library/trace-viewer.spec.ts @@ -127,6 +127,12 @@ test('should complain about newer version of trace in old viewer', async ({ show await expect(traceViewer.page.getByText('The trace was created by a newer version of Playwright and is not supported by this version of the viewer.')).toBeVisible(); }); +test('should properly synchronize local and remote time', async ({ showTraceViewer, asset }, testInfo) => { + const traceViewer = await showTraceViewer([asset('trace-remote-time-diff.zip')]); + // The total duration should be sub 10s, rather than 16h. + await expect(traceViewer.page.locator('.timeline-time').last()).toHaveText('8.5s'); +}); + test('should contain action info', async ({ showTraceViewer }) => { const traceViewer = await showTraceViewer([traceFile]); await traceViewer.selectAction('locator.click');