【发布时间】:2021-05-15 01:38:02
【问题描述】:
我正在使用 cypress-cucumber-preprocessor
我正在使用 Sauce Labs 演示应用进行自动化测试,https://www.saucedemo.com/
我有一个步骤应该访问具有以下 url 的主页: https://www.saucedemo.com/inventory.html
我在 cypress.json 中定义了baseUrl,如下所示:
cypress.json
{
"baseUrl": "https://www.saucedemo.com/",
"testFiles": ["**/*.{feature,features}"],
"chromeWebSecurity": false,
"env": {
"fixturesBaseDir": "test_data_files/"
}
}
而我的步骤定义如下图:
When("go back to home page", () => {
cy.visit("/inventory.html");
});
当我手动进入首页时:https://www.saucedemo.com/inventory.html 但是当我执行我的步骤时,我收到以下错误:
cy.visit() failed trying to load:
https://www.saucedemo.com/inventory.html/
The response we received from your web server was:
> 404: Not Found
This was considered a failure because the status code was not 2xx.
If you do not want status codes to cause failures pass the option: failOnStatusCode: false
截图
【问题讨论】:
标签: javascript automated-tests cypress