嘿,我创建了一个测试,该测试在本地通过而没有问题,但在 CI 测试期间有 50% 的时间失败。
it("Check if scroll is working on list", { retries: 3 }, () => {
cy.server()
cy.intercept('GET','**/api/**', {
statusCode: 200
}).as('loadMoreAbstracts')
cy.get('[data-cy=VirtualScroll]', { timeout: 15000 }).scrollTo("bottom").then(() => {
cy.wait('@loadMoreAbstracts', { timeout: 15000 })
cy.get('[data-cy=VirtualScroll]').invoke('scrollTop').should('be.gt', 0)
})
cy.get('[data-cy=VirtualScroll]', { timeout: 15000 }).scrollTo("bottom")
})
谁能告诉我这个测试有什么问题,为什么它在本地工作但大部分时间在 CI 上失败?其他需要监听请求的测试是 100% 通过 CI,只有这个有问题,但我无法弄清楚。在本地它永远不会失败。
我遇到的错误:
Check if scroll is working on list:
CypressError: Timed out retrying: `cy.wait()` timed out waiting `15000ms` for the 1st request to the route: `loadMoreAbstracts`. No request ever occurred.