Three.js end-to-end testing

Three.js end-to-end testing

Motivation

Simplify code reviews with quick pixel testing inside CI. The same screenshots are used for thumbnails.

Local usage

If you get an error in e2e test after PR and you sure that all is correct, just make a new screenshot to example. As a last resort increase timeouts or add it to exception list.

# generate new screenshots for exact examples
npm run make-screenshot <example1_name> ... <exampleN_name>

# check exact examples
npm run test-e2e <example1_name> ... <exampleN_name>

# check all examples
npm run test-e2e

Merge only those commits that pass the tests, otherwise all next commits will also fail.

How it works

  • ci configs with parallelism
  • deterministic random/timer/rAF/video for screenshots
  • increased robustness with hided text, datgui, different flags and timeouts.
  • pipeline: turn off rAF -> ‘networkidle0’ -> networkTax -> turn on rAF -> render promise
  • added 3 progressive attempts for robustness

Development progress

TravisAttempts
61 from 362 failed, time=21:14networkidle0 timeout
26 from 362 failed, time=16:22with rAF hook
13=1+1+7+4 failed, time=4:26with render promise and parallelism
4=0+0+2+2 failed, time=5:13with network tax and other settings
4=0+0+2+2 failed, time=3:26with progressive attempts

Status

97% examples are covered with tests. Check exception list for more information.