automated-tests - 在 cucumber/testCafe 中实现 requestHooks

标签 automated-tests e2e-testing cucumberjs web-testing testcafe

当我想将 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/

相关文章:

javascript - 在外部辅助函数中使用 Chosen Selectors 时出现的问题

javascript - 如何使用 Testcafe + JS 通过 getCompulatedStyle 获取 DOM 属性

javascript - 执行 TestCafe 断言的正确方法是什么

automated-tests - TFS 2012 支持测试 Controller 2010

testing - 如何在 Haskell 中使用 SmallCheck?

javascript - Cypress.io - 等待页面完成加载的时间太长

testing - Testcafe 页面重新加载

node.js - 如何从 cucumber js中获取场景名称?

node.js - 将多个格式化程序传递给 cucumberjs 的正确方法

protractor - 使用带循环的 Protractor 填写从 Cucumber.js 表中获取数据的表单