【发布时间】:2020-04-07 10:33:18
【问题描述】:
我在我的应用代码中这样做:
const xhr = new XMLHttpRequest();
xhr.open("GET", "https://api.gizconnection.com/labels", true);
xhr.setRequestHeader("Authorization", "Bearer " + authService.getToken());
xhr.send(null);
在我的测试中我有:
it.only("test", () => {
cy.server();
cy.route("GET", "https://api.gizconnection.com/labels", [
{ text: "foo" }
]);
});
但不匹配,我快疯了。
在 CY 的日志中,我看到了请求,但说它不匹配:
在 Chrome 的开发工具中,我看到了它,但我得到的响应是来自服务器的真实响应:
有什么想法吗?
【问题讨论】:
标签: testing cypress e2e-testing