step.duration reflects only the last retry attempt (HelperStep.run() overwrites startTime)
維護者通常 2 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 78/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, nodejs, playwright
研究方向
從 lib/step/helper.js 和 lib/step/func.js 開始,查看 run() 重設 startTime 的位置,接著比較它們與 lib/step/record.js 中防護條件的行為。檢查 lib/step/base.js 中 duration 的計算方式,並尋找現有的重試測試。完成標準是:duration 涵蓋從第一次嘗試到最終通過或失敗的整個過程。
由索引模型根據 Issue 內容生成。
描述
What happens
When a helper step is retried (e.g. by the retryFailedStep plugin), step.duration covers only the last attempt instead of the whole step.
In our run, a I.click(...) step was retried for ~50 seconds before it finally failed. The HTML report (@testomatio/reporter, which shows step.duration) listed it as 3ms, while the scenario took 49s 697ms.
Cause
lib/step/record.js deliberately keeps the start time of the first attempt:
() => {
if (!step.startTime) {
// step can be retries
event.emit(event.step.started, step)
step.startTime = +Date.now()
}
return (val = step.run(...args))
},
But HelperStep.run() in lib/step/helper.js overwrites it on every attempt:
run() {
this.args = Array.prototype.slice.call(arguments)
this.startTime = +Date.now()
...
So duration (endTime - startTime in lib/step/base.js) is measured from the start of the last retry. FuncStep.run() in lib/step/func.js has the same assignment.
Expected
step.duration covers all attempts, from the first start to the final pass or failure, as the guard in record.js intends. A possible fix is to set startTime in run() only when it isn't already set.
Steps to reproduce
- Enable
retryFailedStep. - Run a step that fails for a while and is retried, e.g.
I.click()on an element that never shows up. - Read
step.durationin anevent.step.finishedlistener, or look at the step time in any reporter that uses it. It shows only the last attempt's duration (a few ms).
Environment
- CodeceptJS 4.2.2 (also present on current
main) - Playwright helper, Bun runtime
Created by AI agent (Claude Code)
- 主要語言
- JavaScript
- 星號
- 4.2k
- 分支
- 754
- 平均合併
- 2 天 6 小時
- 30 天內合併 PR
- 33
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
codeceptjs/CodeceptJS 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
codeceptjs/CodeceptJS#5773 · 1 則留言 ·
維護者通常 2 天內回覆
-
`I.waitForFile` (FileSystem helper) fails if directory does not exist (yet)可能已有人在做 @danielrentz 於 275 天前認領。 未關閉stale
難度 2/5 1-3 小時 新手友好度 72/100
codeceptjs/CodeceptJS#5420 · 1 則留言 ·
維護者通常 2 天內回覆
-
stale
難度 2/5 1-3 小時 新手友好度 78/100
codeceptjs/CodeceptJS#4958 · 10 則留言 · 2 個 reaction ·
維護者通常 2 天內回覆
-
stale
難度 1/5 1 小時以內 新手友好度 72/100
codeceptjs/CodeceptJS#4778 · 3 則留言 ·
維護者通常 2 天內回覆
-
Scenario Steps report wrong line/column for TypeScript include modules可能已有人在做 @kobenguyent 今天認領。 未關閉
難度 3/5 1-2 天 新手友好度 72/100
codeceptjs/CodeceptJS#5772 · 1 個 reaction · 已指派 2 人 ·
維護者通常 2 天內回覆
查看 codeceptjs/CodeceptJS 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 85/100
pigeon189/zcode-fox-widget#17 · 1 則留言 ·
-
難度 1/5 1 小時以內 新手友好度 88/100
維護者通常 1 天內回覆
-
Let TypeScript accept an initial object in ReactiveDict可能已有人在做 @yograj-vijay-yadav 今天認領。 未關閉bug good first issue help wanted workshop
難度 2/5 1-3 小時 新手友好度 92/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
akitaonrails/FrankMD#268 ·
維護者通常 1 天內回覆
-
good first issue
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆