【发布时间】:2019-06-25 23:12:26
【问题描述】:
在我的 testcafe 测试中,我需要获取我正在使用的库的构造函数,以便在其上调用静态方法。
但是,我无法使用给定的 ClientFunction 和 Eval 方法执行此操作。如何获取构造函数?
我尝试了以下方法:
// Does not work, because the docs say it only allows using ClientFunction for obtaining "serializable" values
let getSortable = new ClientFunction(() => window.Sortable);
test('test', async t => {
let Sortable = await getSortable();
console.log(Sortable); // Logs undefined
});
test('test', async t => {
let Sortable = await t.eval(() => window.Sortable);
console.log(Sortable); // Logs undefined (not sure why)
});
【问题讨论】:
标签: javascript automated-tests e2e-testing web-testing testcafe