我正在尝试通过赛普拉斯中的夹具从 json 文件中检索一些数据,但这些数据根本无法识别。
before(() => {
cy.fixture('example').then(function (data) {
console.log("this", data.user);
})
})
控制台输出用户,这是有效的。
但在那之后我有一个步骤:
Given("I check data", () => {
console.log("this", this.data.user);
});
这里的数据是未定义的。
我也尝试在里面设置before
:
this.data = data
但没有帮助。我也尝试使用beforeEach
但没有成功。