feat(config): introduce shouldRerty config option#878
Conversation
| * `shouldRetry` — function which defines whether retry needed or not. Should returns `Boolean` value. First argument is `data` which is result of test run. `data` will contains fields: | ||
| * `attempt {Number}` number of retries performed for the test | ||
| * `retriesLeft {Number}` how many attempts left for retries | ||
| * `[equal] {Boolean}` notice that if the test fails with critical error equal can be absent |
There was a problem hiding this comment.
Кажется, что в будущем здесь можно предоставить больше оснований для решения ретраить или нет. Я вынес только то, что есть в настоящее время.
|
|
||
| _submitForRetry(data) { | ||
| Object.assign(data, { | ||
| attempt: this._retriesPerformed, |
There was a problem hiding this comment.
Честно, я не понял где это используется… Возможно, это поле можно убрать?
c3f72ec to
cd98ec6
Compare
doc/config.md
Outdated
|
|
||
| Note that the same test never be performed in the same browser session. | ||
|
|
||
| * `shouldRetry` — function which defines whether retry needed or not. Should returns `Boolean` value. First argument is `data` which is result of test run. `data` will contains fields: |
There was a problem hiding this comment.
...whether to make a retry. Should return...
which is the result of the test run, it's an Object with following fields:
doc/config.md
Outdated
|
|
||
| * `shouldRetry` — function which defines whether retry needed or not. Should returns `Boolean` value. First argument is `data` which is result of test run. `data` will contains fields: | ||
| * `attempt {Number}` number of retries performed for the test | ||
| * `retriesLeft {Number}` how many attempts left for retries |
| * `shouldRetry` — function which defines whether retry needed or not. Should returns `Boolean` value. First argument is `data` which is result of test run. `data` will contains fields: | ||
| * `attempt {Number}` number of retries performed for the test | ||
| * `retriesLeft {Number}` how many attempts left for retries | ||
| * `[equal] {Boolean}` notice that if the test fails with critical error equal can be absent |
There was a problem hiding this comment.
Непонятное описание.
См. мои комментарии в PR в retry-limiter.
| if (retriesLeft <= 0) { | ||
| _shouldRetry(data) { | ||
| if (typeof this._config.shouldRetry === 'function') { | ||
| return Boolean(this._config.shouldRetry(data)); |
There was a problem hiding this comment.
Необязательно заворачивать тип, ты явно заявил, что кастомная функция должна возвращать Boolean.
Если уж заморачиваться, то надо проверять тип возвращенного значения и ругаться, а не кастить.
|
|
||
| _submitForRetry(data) { | ||
| Object.assign(data, { | ||
| attempt: this._retriesPerformed, |
There was a problem hiding this comment.
retriesMade/retriesLeft будет симметричнее.
There was a problem hiding this comment.
это обратно несовместимое изменение, не надо этого делать
Config should provide to users option to set custom rule whether test retry needed or not. See: FEI-8660
cd98ec6 to
d208f00
Compare
Config should provide to users option to set custom rule whether test retry
needed or not.
Related to: