Skip to main content
Cypress应用

Cypress.currentRetry

Cypress.currentRetry 是一个表示当前 测试重试 次数的数字。

caution

请注意 Cypress.currentRetry 只能在测试和 测试钩子 内部使用, 在测试和测试钩子外部使用时其值为 null

语法

Cypress.currentRetry

示例

获取当前测试重试次数

it('example', () => {
expect(Cypress.currentRetry).to.eq(0)
})

历史版本

版本变更
12.3.0新增 Cypress.currentRetry