Skip to content

Commit f5ce6f9

Browse files
committed
test-image: add documentation in CONTRIBUTING
1 parent 3a37405 commit f5ce6f9

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,33 @@ To check test coverage:
7878
npm run coverage
7979
```
8080

81+
### Running image tests
82+
83+
#### Build Docker image
84+
To produce images reproducibly,
85+
we need to make sure Orca is running in exactly the same environment.
86+
To achieve this, we package Orca in a Docker image which can be built with:
87+
```
88+
export DOCKER_ORCA_IMAGE=orca_dev
89+
docker build -t "$DOCKER_ORCA_IMAGE" -f deployment/Dockerfile .
90+
```
91+
92+
#### Build images and compare
93+
94+
To run the image tests, run the following:
95+
```
96+
./test/image/render_mocks_cli build/test_images "$DOCKER_ORCA_IMAGE" && \
97+
./test/image/compare_images test/image/baselines build/test_images build/
98+
```
99+
100+
#### Generate new baselines
101+
Simply build images as above but save then at `test/image/baselines` instead:
102+
```
103+
./test/image/render_mocks_cli test/image/baselines "$DOCKER_ORCA_IMAGE"
104+
```
105+
** Note that one can change the version of plotly.js used to build images
106+
by editing `test/image/render_mocks_cli`. **
107+
81108
## Packaging
82109

83110
We use [`electron-builder`](https://github.com/electron-userland/electron-builder) to pack up

test/image/render_mocks_cli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env bash
22
set -e
3-
43
programname=$0
54

5+
PLOTLYJS_URL="https://cdn.plot.ly/plotly-1.47.2.min.js"
6+
67
function usage {
78
echo "usage: $programname output_folder [docker:image]"
89
echo " it renders all the JSON files found in ./test/image/mocks into the output_folder."
@@ -26,7 +27,7 @@ do
2627
ORCA_OPTS=(--topojson /plotly-geo-assets.js --mathjax /mathjax/MathJax.js)
2728

2829
# pin Plotly.js' version
29-
ORCA_OPTS+=(--plotlyJS "https://cdn.plot.ly/plotly-1.47.2.min.js")
30+
ORCA_OPTS+=(--plotlyJS "$PLOTLYJS_URL")
3031

3132
# Set Orca options
3233
ORCA_OPTS+=(--verbose --format "$format" --output-dir "$1")

0 commit comments

Comments
 (0)