Javascript 使用Cypress中的Moment.js检查多个当前时间
我将检查打印图形的请求和响应之间的时间间隔。我需要毫秒间隔。我使用了Cypress中包含的矩.js,但它不起作用Javascript 使用Cypress中的Moment.js检查多个当前时间,javascript,testing,momentjs,e2e-testing,cypress,Javascript,Testing,Momentjs,E2e Testing,Cypress,我将检查打印图形的请求和响应之间的时间间隔。我需要毫秒间隔。我使用了Cypress中包含的矩.js,但它不起作用 it("time interval check", () => { cy.get("div.v-text-field__slot > input") .eq(0) .type("Vue.js, React.js, Angular.js {enter}", { delay: 0 }); const num1 = Cypress.mom
it("time interval check", () => {
cy.get("div.v-text-field__slot > input")
.eq(0)
.type("Vue.js, React.js, Angular.js {enter}", { delay: 0 });
const num1 = Cypress.moment().valueOf();
cy.log(num1);
cy.get("canvas#trendChart").should("be.visible");
const num2 = Cypress.moment().valueOf();
cy.log(num2);
cy.wrap(Cypress.moment().subtract(num1).valueOf())
.should('to.be.lessThan', 1000);
});
我知道这个解决方案真的很愚蠢,但我希望你明白这是因为我第一次使用这个工具
它显示的时间间隔太短。(XHR持续时间为403ms)
如何解决这个问题?这是否回答了您的问题?是的,谢谢你的帮助。我已经熟悉了这个问题。我正在考虑使用Chrome开发工具来解决这个问题。