Hi All! In my tested app I'm using a WebGL based library I need to test. Since I cannot use visual testing for various reasons, I have exposed the library to the global namespace and I'm trying to spy on calls to this library methods. Some methods are asynchronous, though. I wasn't able so far to create a spy on a library method and verify its returned RESOLVED value was correct.
const fgspy = cy.spy(chart, 'foreground');
cy.get('.myButton').click();
fgspy.getCall(0).returnValue.then( res => {
expect(fgRes.whatever)....
});
I tried using WRAP but I had a couple of issues there: first - test was green though it failed assertions, second - I had a typing issue (working in TS). Any assistance will be much appreciated 🙂 !!!