angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.74k stars 2.31k forks source link

How to test fabricjs with protractor? #4950

Open nitingupta220 opened 6 years ago

nitingupta220 commented 6 years ago

I'm using Fabric.js to deal with canvas on my website.

I want to test all the canvas on my website.

How can I do it with the protractor? Couldn't find a suitable answer for it.

Can you help? @juliemr

Neuroforge commented 5 years ago

Any update on this?

Although Fabricjs is a third party library and should be tested internally. It is still important to make sure that our app is handling Fabricjs correctly and that items have appears.

Let's say i load an image into the fabric canvas on pressing a button in my app. How would it be possible to check that the button in my app has had the desired effect of loading the image into Fabricjs's canvas?

tymfear commented 5 years ago

You need to apply visual regression tools for that purpose, like https://github.com/angular-seattle/blue-harvest https://www.npmjs.com/package/protractor-image-comparison https://applitools.com/features#visual-ai

asturur commented 5 years ago

Image comparision is needed. You have to be carefull that in the application you are going to probably use requestRenderAll that are dependant from screen refresh, while in a test app, headless, you have to ensure enough time is passed in order to take a screenshot of that element area you want to test.

Also depending on what functionality you are testing, in the example of loading an image, you can just inpsect the fabric canvas for having an object of the desired type and the desired url.

If you need to do full end to end testing to be sure the app works as it was working before when you update fabric, then yes you want eventually to use screenshots all over the place