【发布时间】:2022-01-19 22:25:29
【问题描述】:
我在所有测试中都使用了以下实用功能:
async function waitForContentLoaded() {
await waitFor(() => {
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
});
}
现在 37 个测试中有 2 个失败并显示错误消息 expected document not to contain element, found <span {...} role="progressbar" {...} />,并且堆栈跟踪指向上述预期。
waitFor() 不应该捕获这些错误,然后重试直到它不抛出?
【问题讨论】:
-
请提供mvce
标签: reactjs testing jestjs react-testing-library