赛普拉斯截距与通配符参数和查询参数不匹配



我的Cypry拦截方法有问题。我想拦截使用此url发出的任何请求'https://p13a79.fra1.a.restack.io/'作为前缀。我也试过使用regex'^https://p13a79.fra1.a.restack.io/.*$'也不起作用

describe('Consent banner test: allow', () => {
before(() => {
cy.intercept(
'https://p13a79.fra1.a.restack.io/*'
).as('consentRequest') 
});
it('I can accept the consent banner', () => {

cy.visit('https://www.deepskydata.com/');


cy.wait('@consentRequest')
cy.get("[data-testid='uc-banner-content']").should('be.visible').log("Consent banner visible");
cy.get("[data-testid='uc-deny-all-button']").should('be.visible').log("Deny all button visible");
cy.get("[data-testid='uc-accept-all-button']").should('be.visible').log("Allow all button visible");
cy.get("[data-testid='uc-accept-all-button']").click();
cy.wait('@consentRequest')
});
});

以前有人遇到过这个问题吗?

您需要一个glob表达式

cy.intercept(
'https://p13a79.fra1.a.restack.io/**'
).as('consentRequest') 

最新更新