从命令行Get =&gt运行柏树测试; CypressError:在运行此命令时停止了柏树测试
柏树版本10.3.0
我有以下test.cy.js,即Async IT阻止。
///
import loadFileObjects from '../../../support/load_file_objects'
var fixtureUrl = '/test/mydata/'
describe("TC1_getResidentialInfo", () => {
var load_test_case;
it('Validate and load all automation feeds', async () => {
load_test_case = await loadFileObjects.getJsonObj(fixtureUrl + '/CUP-575-TC1-TC.json');
})
})
支持/load_file_objects.js
class load_file_objects{
//it should accept fixture folder structure and test case name
//returns json object directly using promise
getJsonObj(testCasePath){
// return new Cypress.Promise((resolve, reject) => {
return new Cypress.Promise((resolve, reject) => {
cy.fixture(testCasePath).then((data) => {
cy.log("Test Data for "+testCasePath+ ": " +JSON.stringify(data))
resolve(data)
})
// do something custom here
})
// var data = data;
// return data
// })
}
}
export default load_file_objects
使用柏树开放(测试跑者UI)进行相同的测试时,其工作正常 请让我在这里想念的东西。
Cypress version 10.3.0
I have a following test.cy.js, which is async IT block.
///
import loadFileObjects from '../../../support/load_file_objects'
var fixtureUrl = '/test/mydata/'
describe("TC1_getResidentialInfo", () => {
var load_test_case;
it('Validate and load all automation feeds', async () => {
load_test_case = await loadFileObjects.getJsonObj(fixtureUrl + '/CUP-575-TC1-TC.json');
})
})
support/load_file_objects.js
class load_file_objects{
//it should accept fixture folder structure and test case name
//returns json object directly using promise
getJsonObj(testCasePath){
// return new Cypress.Promise((resolve, reject) => {
return new Cypress.Promise((resolve, reject) => {
cy.fixture(testCasePath).then((data) => {
cy.log("Test Data for "+testCasePath+ ": " +JSON.stringify(data))
resolve(data)
})
// do something custom here
})
// var data = data;
// return data
// })
}
}
export default load_file_objects
Its working fine when I run the same test using cypress open(Test runner UI)
Please let me what I am missing here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要在某个地方创建类实例。
惯例是班级名称已大写。这是执行此操作的干净方法
,或者
需要固定装置,
如果固定固定文件的路径是固定且一致的,那么您可以在该固定文件的顶部使用
requiend()
脚本为您提供异步/等待您的繁重举重。The class instance needs to be created somewhere.
Convention is class names are capitalized. This is the clean way to do it
or
Requiring the fixture
If the path to your fixture file is fixed and consistent, then you can use
require()
at the top of the script to do the async/await heavy lifting for you.