使用这个夹具,我想checkoutId
根据夹具钩子中 API 调用的结果进行设置,before
以便我可以使用它来设置我的测试页面
let checkoutId;
fixture`Check out as guest user`
.page`localhost:3001/checkout/start/${checkoutId}`
.before(async () => {
await checkout.getCheckoutId(sampleData.cart)
.then(id => (checkoutId = id));
});
// and here the rest of my tests based on the page
我尝试了固定钩子,共享变量,但我无法让它工作,请求页面时 checkoutId 未定义。
这种情况甚至可能吗?