【问题标题】:Is there a way match onRequest/onResponse calls in a RequestHook有没有办法匹配 RequestHook 中的 onRequest/onResponse 调用
【发布时间】:2019-05-06 12:57:36
【问题描述】:

我有一个自定义 RequestHook 并且想要匹配 onRequest 和 onResponse 方法之间的调用。我注意到“事件”对象中有一个“requestId”,但希望它在 API 中公开,以便我可以使用它来匹配请求和响应。

在我正在访问的 onRequest 中:event._requestInfo.requestId 并在 onResponse: event.requestId

显然,这并不理想,因为它们不是公共 API 的一部分。

【问题讨论】:

    标签: automated-tests hook e2e-testing web-testing testcafe


    【解决方案1】:

    使用onRequest:event._requestInfo.requestIdonRequest:event.requestId 属性是组合请求和响应部分的唯一方法。这种方法也用于内置的RequestLogger 类(参见实现细节herehere)。

    我在 TestCafe 存储库中为您的用例创建了一个建议 - https://github.com/DevExpress/testcafe/issues/3778

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-05
      • 2021-12-11
      • 1970-01-01
      • 1970-01-01
      • 2023-02-14
      • 1970-01-01
      • 2021-05-15
      • 2012-03-19
      相关资源
      最近更新 更多