Skip to content

Commit 428629e

Browse files
authored
Merge pull request #5792 from plotly/adjust-image-test-docs
improve CONTRIBUTING guidelines for creating & updating baselines
2 parents a0a9040 + ec020ec commit 428629e

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

.circleci/env_image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
2+
# install required fonts
23
sudo apt-get install fonts-liberation2 fonts-open-sans fonts-noto-cjk fonts-noto-color-emoji && \
34
sudo python3 .circleci/download_google_fonts.py && \
45
sudo cp -r .circleci/fonts/ /usr/share/ && \
56
sudo fc-cache -f && \
7+
# install kaleido & plotly
68
sudo python3 -m pip install kaleido==0.2.1 plotly==5.1.0 --progress-bar off

CONTRIBUTING.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,40 @@ npm run test-jasmine -- --help
207207
npm run test-jasmine -- --info
208208
```
209209

210-
### Draft new baseline
211-
Install fonts and tools
210+
### Draft new baselines
211+
#### With docker:
212+
> If you prefer using docker each time you need to
213+
```sh
214+
docker run -it -v "$(pwd)":/plotly.js circleci/python:3.8.9 bash
215+
# then inside the docker
216+
cd plotly.js
217+
sudo bash .circleci/env_image.sh
218+
```
219+
220+
#### Without docker:
221+
> Otherwise you may need to install `python 3.8`
222+
Then upgrade `pip` if needed
212223
```sh
213-
# install required fonts (if missing) on ubuntu
214-
sudo cp -r .circleci/fonts/ /usr/share/ && sudo fc-cache -f
215-
# upgrade pip (if needed)
216224
python3 -m pip install --upgrade pip
217-
# install kaleido
218-
python3 -m pip install kaleido
219-
# install plotly
220-
python3 -m pip install plotly
225+
```
226+
227+
To install required fonts and tools see this [shell script](https://github.com/plotly/plotly.js/blob/master/.circleci/env_image.sh).
228+
229+
#### Scripts to generate/update new baselines with/without docker:
230+
```sh
231+
python3 test/image/make_baseline.py = mock_1 mock_2
232+
```
233+
234+
> Alternatively using npm & node.js (which are not available in the python docker by default)
235+
236+
```sh
237+
npm run baseline mock_1 mock_2
238+
```
239+
240+
Or
241+
242+
```sh
243+
npm run baseline mock_*
221244
```
222245

223246
**IMPORTANT:** the `baseline`, `test-image` and `test-export` scripts do **not** bundle the source files before

0 commit comments

Comments
 (0)