codeceptjs / codeceptjs/CodeceptJS

Bug: retryOnFailedStep works only for the first test in the same run

オープン
#5,598 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
stale
主要言語
JavaScript
スター
4.2k
フォーク
757
平均マージ
2日 9時間
マージ済み PR(30日)
16

説明

I have the following test file:
```ts
Feature("github testing")

Scenario("test", async ({ I }) => {
await I.amOnPage('https://github.com');
await I.click('thistextdoesnotexist');
})

Scenario("test2", async ({ I }) => {
await I.amOnPage('https://github.com');
await I.click('thistextdoesnotexisttoo');
})

```

and I enabled the `retryFailedStep` plugin (this is the only plugin, also using playwright helper)

I noticed that the plugin doesn't retry the `click` step in `test2`

I patched two functions in the plugin (codeceptjs v4.0.3):
```js
99 const when = err => {
100 if (!enableRetry) return
101 if (store.debugMode) return false
102 console.log("store.autoRetries", store.autoRetries); // <-- this is new
103 if (!store.autoRetries) return false
104 if (err && err.isTerminal) return false
105 if (err && err.message && (err.message.includes('ERR_ABORTED') || err.message.includes('frame was detached') || err.message.includes('Target page, context or browser has been closed'))) return false
106 return true
107 }
```
and
```js
140 if (scenarioRetries > 0 && config.deferToScenarioRetries !== false) {
141 store.autoRetries = false
142 return
143 }
144
145 const hasManualRetries = recorder.retries.some(retry => retry !== config) // in the second test, recorder.retries.length === 3
146 console.log("hasManualRetries", hasManualRetries); // <-- this is new
147 if (hasManualRetries) {
148 store.autoRetries = false
149 return
150 }
151
```

I ran it and this is the output:
```
github testing --
hasManualRetries false
store.autoRetries true
store.autoRetries true
store.autoRetries true
store.autoRetries true
✖ test in 7886ms
hasManualRetries true
store.autoRetries false
store.autoRetries false
✖ test2 in 5760ms
```

Thanks!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

retryFailedStep プラグインと Playwright ヘルパーとの相互作用から始めます。issue の 2 つのシナリオを再現し、特に store.autoRetries と recorder.retries に関して、テスト間で retry の状態がどのようにリセットされるかを調べます。両方のシナリオで失敗したステップに設定済みの retry が適用されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, playwright
領域
testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
58/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。