Skip to content

Commit 6c06273

Browse files
committed
Revise exports & baseline creation and testing using Kaleido
1 parent b5b8372 commit 6c06273

19 files changed

+451
-641
lines changed

.circleci/config.yml

+77-22
Original file line numberDiff line numberDiff line change
@@ -78,41 +78,90 @@ jobs:
7878
name: Run jasmine tests (part C)
7979
command: ./.circleci/test.sh no-gl-flaky-jasmine
8080

81-
stable-image:
82-
docker:
83-
- image: plotly/testbed:latest
81+
make-baselines:
8482
parallelism: 4
85-
working_directory: /var/www/streambed/image_server/plotly.js/
83+
docker:
84+
- image: circleci/python:3.8.9
85+
working_directory: ~/plotly.js
8686
steps:
8787
- attach_workspace:
88-
at: /var/www/streambed/image_server/
88+
at: ~/
89+
- run:
90+
name: which pip3 version
91+
command: which pip3 && pip3 --version
8992
- run:
90-
name: Run and setup container
93+
name: install kaleido v0.2.1
94+
command: python3 -m pip install kaleido==0.2.1
95+
- run:
96+
name: install plotly.io v4.14.3
97+
command: python3 -m pip install plotly==4.14.3
98+
- run:
99+
name: install fonts
91100
command: |
92-
supervisord &
93-
npm run docker -- setup
101+
sudo cp -r .circleci/fonts/ /usr/share/
102+
sudo fc-cache -f
103+
- run:
104+
name: create all png files
105+
command: ./.circleci/test.sh make-baselines
106+
- persist_to_workspace:
107+
root: ~/
108+
paths:
109+
- plotly.js
110+
111+
test-baselines:
112+
docker:
113+
- image: circleci/node:12.22.1
114+
working_directory: ~/plotly.js
115+
steps:
116+
- attach_workspace:
117+
at: ~/
94118
- run:
95-
name: Run image tests (part A)
96-
command: ./.circleci/test.sh stable-image || { tar -cvf build/baselines.tar build/test_images/ ; exit 1; } ; find build -maxdepth 1 -type f -delete
119+
name: compare pixels
120+
command: ./.circleci/test.sh test-image ; find build -maxdepth 1 -type f -delete
97121
- store_artifacts:
98122
path: build
99123
destination: /
100124

101-
flaky-image:
125+
make-exports:
102126
docker:
103-
- image: plotly/testbed:latest
104-
working_directory: /var/www/streambed/image_server/plotly.js/
127+
- image: circleci/python:3.8.9
128+
working_directory: ~/plotly.js
105129
steps:
106130
- attach_workspace:
107-
at: /var/www/streambed/image_server/
131+
at: ~/
108132
- run:
109-
name: Run and setup container
110-
command: |
111-
supervisord &
112-
npm run docker -- setup
133+
name: which pip3 before upgrade
134+
command: which pip3 && pip3 --version
135+
- run:
136+
name: upgrade pip3
137+
command: python3 -m pip install --upgrade pip
138+
- run:
139+
name: which pip3 after upgrade
140+
command: which pip3 && pip3 --version
141+
- run:
142+
name: install kaleido
143+
command: python3 -m pip install kaleido
144+
- run:
145+
name: install plotly.io
146+
command: python3 -m pip install plotly
147+
- run:
148+
name: create svg, jpg, jpeg, webp and pdf files
149+
command: python3 test/image/make_exports.py
150+
- persist_to_workspace:
151+
root: ~/
152+
paths:
153+
- plotly.js
154+
155+
test-exports:
156+
docker:
157+
- image: circleci/node:12.22.1
158+
working_directory: ~/plotly.js
159+
steps:
160+
- attach_workspace:
161+
at: ~/
113162
- run:
114-
name: Run image tests (part B)
115-
command: ./.circleci/test.sh flaky-image ; find build -maxdepth 1 -type f -delete
163+
name: test export sizes
164+
command: node test/image/export_test.js ; find build -maxdepth 1 -type f -delete
116165
- store_artifacts:
117166
path: build
118167
destination: /
@@ -237,12 +286,18 @@ workflows:
237286
- no-gl-flaky-jasmine:
238287
requires:
239288
- install-and-cibuild
240-
- stable-image:
289+
- make-baselines:
241290
requires:
242291
- install-and-cibuild
243-
- flaky-image:
292+
- test-baselines:
293+
requires:
294+
- make-baselines
295+
- make-exports:
244296
requires:
245297
- install-and-cibuild
298+
- test-exports:
299+
requires:
300+
- make-exports
246301
- mock-validation:
247302
requires:
248303
- install-and-cibuild

.circleci/test.sh

+5-7
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,14 @@ case $1 in
7676
exit $EXIT_STATE
7777
;;
7878

79-
stable-image)
80-
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | circleci tests split)
81-
npm run test-image -- $SUITE --filter --skip-flaky || EXIT_STATE=$?
79+
make-baselines)
80+
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split)
81+
python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$?
8282
exit $EXIT_STATE
8383
;;
8484

85-
flaky-image)
86-
MAX_AUTO_RETRY=5
87-
retry npm run test-image -- --just-flaky
88-
npm run test-export || EXIT_STATE=$?
85+
test-image)
86+
node test/image/compare_pixels_test.js || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$?
8987
exit $EXIT_STATE
9088
;;
9189

package-lock.json

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@
3636
"no-bad-char": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-misleading-character-class: error}' $(find dist -type f -iname '*.js' | grep plotly)",
3737
"no-dup-keys": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-dupe-keys: error}' $(find dist -type f -iname '*.js' | grep plotly)",
3838
"no-es6-dist": "node tasks/no_es6_dist.js",
39-
"docker": "node tasks/docker.js",
4039
"pretest": "node tasks/pretest.js",
4140
"test-jasmine": "karma start test/jasmine/karma.conf.js",
4241
"test-mock": "node tasks/test_mock.js",
43-
"test-image": "node tasks/test_image.js",
44-
"test-export": "node tasks/test_export.js",
42+
"test-image": "node test/image/compare_pixels_test.js",
43+
"test-export": "node test/image/export_test.js",
4544
"test-syntax": "node tasks/test_syntax.js && npm run find-strings -- --no-output",
4645
"test-bundle": "node tasks/test_bundle.js",
4746
"test-requirejs": "node tasks/test_requirejs.js",
@@ -50,7 +49,7 @@
5049
"start-test_dashboard": "node devtools/test_dashboard/server.js",
5150
"start-image_viewer": "node devtools/image_viewer/server.js",
5251
"start": "npm run start-test_dashboard",
53-
"baseline": "node tasks/baseline.js",
52+
"baseline": "node test/image/make_baseline.js",
5453
"noci-baseline": "npm run cibuild && ./tasks/noci_test.sh image && git checkout dist && echo 'Please do not commit unless the change was expected!'",
5554
"preversion": "check-node-version --node 12 --npm 6.14 && npm-link-check && npm ls --prod",
5655
"version": "npm run build && npm run no-bad-char && git add -A lib dist build src/version.js",
@@ -172,6 +171,7 @@
172171
"node-sass": "^6.0.0",
173172
"npm-link-check": "^4.0.0",
174173
"open": "^8.0.7",
174+
"pixelmatch": "^5.2.1",
175175
"prepend-file": "^2.0.0",
176176
"prettysize": "^2.0.0",
177177
"read-last-lines": "^1.8.0",

tasks/baseline.js

-17
This file was deleted.

tasks/docker.js

-49
This file was deleted.

tasks/noci_test.sh

+4-17
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,12 @@ test_jasmine () {
2424
npm run test-jasmine -- --tags=noCI,noCIdep --nowatch || EXIT_STATE=$?
2525
}
2626

27-
# mapbox image tests take too much resources on CI
28-
#
29-
# since the update to [email protected], we must use orca
30-
# as mapbox-gl versions >0.22.1 aren't supported on [email protected] used in the
31-
# 'old' image server
32-
#
33-
# due to mathjax upgrade to v2.7.5, we are unable to test mathjax mocks in the
34-
# 'old' image server and we use orca
35-
#
27+
# having problem creating baselines for 2 mapbox mocks using kaleido
28+
# we must use orca
3629
test_image () {
3730
$root/../orca/bin/orca.js graph \
38-
$root/test/image/mocks/mapbox_* \
39-
$root/test/image/mocks/mathjax.json \
40-
$root/test/image/mocks/ternary-mathjax.json \
41-
$root/test/image/mocks/table_plain_birds.json \
42-
$root/test/image/mocks/table_wrapped_birds.json \
43-
$root/test/image/mocks/parcats_grid_subplots.json \
44-
$root/test/image/mocks/legend_mathjax_title_and_items.json \
45-
$root/test/image/mocks/table_latex_multitrace_scatter.json \
31+
$root/test/image/mocks/mapbox_osm-style.json \
32+
$root/test/image/mocks/mapbox_density0-legend.json \
4633
--mathjax $root/node_modules/mathjax/MathJax.js \
4734
--plotly $root/build/plotly.js \
4835
--mapbox-access-token "pk.eyJ1IjoicGxvdGx5LWpzLXRlc3RzIiwiYSI6ImNrNG9meTJmOTAxa3UzZm10dWdteDQ2eWMifQ.2REjOFyIrleMqwS8H8y1-A" \

tasks/test_export.js

-17
This file was deleted.

tasks/test_image.js

-17
This file was deleted.

0 commit comments

Comments
 (0)