小编Tes*_*own的帖子

赛普拉斯等待请求失败

我在自动化测试中写了 wait on 3 个不同的请求,但每次运行测试时,等待函数都会对其中一个请求起作用。

 cy
        .intercept('POST', '**/api/Availability')
        .as('availabilecheck');
    cy
        .wait('@availabilecheck')
        .its('response.statusCode')
        .should('eq', 200)
Run Code Online (Sandbox Code Playgroud)

///////////////////////////////////////////////////////////////////////

        cy
    .intercept('POST','**/api/Availability/GetPrice')
    .as('getpricecheck');
cy
    .wait('@getpricecheck')
    .its('response.statusCode')
    .should('eq', 200);
Run Code Online (Sandbox Code Playgroud)

///////////////////////////////////////////////////////

 cy.intercept('POST','**/api/Member/Find')
        .as('memberresponse')
    cy.wait('@memberresponse')
Run Code Online (Sandbox Code Playgroud)

我为 3 个不同的请求编写了上述代码,但每次运行测试时,其中一个请求实际上正在等待,而另外 2 个请求则失败。

我应该怎么办?

javascript automated-tests cypress

6
推荐指数
1
解决办法
6152
查看次数

标签 统计

automated-tests ×1

cypress ×1

javascript ×1