iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.09k stars 296 forks source link

Tests: use screenshots to improve examples tests #1956

Open jailln opened 1 year ago

jailln commented 1 year ago

There is a method to save screenshots in the functional tests helper functions. We should try to use it to improve our examples testing. Note that there is a puppeteer lib that allows to compare screenshots.

mgermerie commented 1 year ago

You mean that we would compare a screenshot of each page loaded in functional tests with a screenshot we previously took of the same page ? If so, it would indeed increase tests reliability. We would also need to evaluate the time it takes for each screenshot comparison : sometimes relaunching functional tests several times in a row just because of a connection error can be painful because of how long functional tests take to complete. However, this could probably be fixed by allowing each functional test to be launched independently in GitHub actions.

jailln commented 1 year ago

You mean that we would compare a screenshot of each page loaded in functional tests with a screenshot we previously took of the same page ? If so, it would indeed increase tests reliability.

Yep that's right.

We would also need to evaluate the time it takes for each screenshot comparison : sometimes relaunching functional tests several times in a row just because of a connection error can be painful because of how long functional tests take to complete. However, this could probably be fixed by allowing each functional test to be launched independently in GitHub actions.

Yes you're right we should verify that. I think it is quite fast to compare two images but we need to double check.