Testing 柏树与短桩路线不匹配

Testing 柏树与短桩路线不匹配,testing,cypress,e2e-testing,Testing,Cypress,E2e Testing,我正在我的应用程序代码中执行此操作: const xhr=new-XMLHttpRequest(); xhr.open(“GET”https://api.gizconnection.com/labels“,对); setRequestHeader(“授权”、“承载者”+authService.getToken()); xhr.send(空); 在我的测试中,我有: it.only(“测试”,()=>{ cy.server(); cy.route(“GET”https://api.gizconn

我正在我的应用程序代码中执行此操作:

const xhr=new-XMLHttpRequest();
xhr.open(“GET”https://api.gizconnection.com/labels“,对);
setRequestHeader(“授权”、“承载者”+authService.getToken());
xhr.send(空);
在我的测试中,我有:

it.only(“测试”,()=>{
cy.server();
cy.route(“GET”https://api.gizconnection.com/labels", [
{文本:“foo”}
]);
});
但不匹配,我快疯了

在CY的日志中,我看到了请求,但表示不匹配:

在Chrome的开发工具中,我看到了这一点,但我得到的响应是来自服务器的真实响应:

有什么想法吗?

如文档中所述,使用字符串时url必须精确匹配,这可能很棘手。我建议使用glob模式选项:

it.only("test", () => {
  cy.server();
  cy.route("GET", "**/labels", [
    { text: "foo" }
  ]);
});

我的URL完全相同