Testing FabricJs Canvas

Hello,

I hope that you are all well.

Does anyone have a good strategy for testing a FabricJs canvas with Selenium or Oxygen?

As far as the browser is concerned the FabricJs canvas is just a canvas, but it actually contains a lot of events that need testing for different objects etc.

Here is an example…

http://fabricjs.com/stroke-uniform

Initially, i thought that screenshots or testing the canvas dataurl would be a good way to test. However, this becomes awkward to maintain if minor changes take places and we have to regenerate screenshots for every browser and screen size.

One approach i previously employed was to hide a button in the page that takes the fabricjs canvas and loads it’s object into a global variable that can then be inspected. This horrible, and i wondered if anyone had any better ideas.

I would appreciate any insight that can be offered on this issue.

Kind regards,