In my testcafe tests, I need to get the constructor function for a library I am using in order to call a static method on it.
However, I am unable to do this using the given ClientFunction and Eval methods. How can I go about getting the constructor function?
I have tried the following:
// 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)
});