当我想将 requestHooks(例如)添加到我的测试和固定装置时,我基本上不知道在哪里做。
我正在使用这个 repo https://github.com/rquellh/testcafe-cucumber
最佳答案
我找到了解决办法。但是,它并不稳定:有时它会抛出错误:“[object DOMException]:\n 没有可用的堆栈跟踪”。也许有人知道为什么? 代码(在 testCafe 文档中创建模拟和记录器对象之后):
When('I log in as free user', async () => {
await testController.addRequestHooks(mock)
await testController.addRequestHooks(logger)
await testController.wait(2000)
await testController
.click(selector)
.typeText(selector,string, {replace : true})
.typeText(selector,string, {replace: true})
.click(selector);
});
更新:现在它可以与 wait() 函数一起使用,但也许有一些更优雅的答案?
关于automated-tests - 在 cucumber/testCafe 中实现 requestHooks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56040921/