You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run the image comparison tests, in your `plotly.js` directory:
44
61
45
62
```bash
46
63
npm run test-image
47
64
```
48
65
49
-
if some tests fail, compare their outputs using `npm run start-image_viewer`.
66
+
which runs all image comparison tests in batch. If some tests fail, compare their outputs
67
+
by booting up the test image viewer using `npm run start-image_viewer`.
50
68
51
-
**IMPORTANT:**`npm run test-image` does **not** bundle the source files before running the image tests. We recommend runnnig `npm run watch` or `npm run start-test_dashboard` in a separate tab to ensure that the most up-to-date code is tested.
69
+
As an alternative to running all image comparison tests at once, you can provide
70
+
a [glob](https://github.com/isaacs/node-glob) as argument to target one or multiple test mocks found in
71
+
[`test/image/mocks`][mocks].
72
+
For example,
52
73
53
-
### Step 2b: Make a new or update an existing baseline image
74
+
```bash
75
+
# Run one test (e.g. the 'contour_nolines' test):
76
+
$ npm run test-image -- contour_nolines
54
77
55
-
Inside your `plotly.js` directory, run
78
+
# Run all gl3d image test in batch:
79
+
$ npm run test-image -- gl3d_*
80
+
```
81
+
82
+
Developers on weak hardware might encounter batch timeout issue. These are most
83
+
common when generated WebGL-based graphs. In this case, running the image
84
+
comparison tests in queue (i.e. with no concurrency) is recommended:
56
85
57
86
```bash
58
-
npm run baseline -- mock.json
87
+
# Run all gl3d image test in queue:
88
+
$ npm run test-image -- gl3d_* --queue
89
+
```
90
+
91
+
##### B: Run image export tests
92
+
93
+
Image export tests check that image export works for formats other than png.
94
+
95
+
To run the image export tests, in your `plotly.js` directory:
96
+
97
+
```bash
98
+
npm run test-export
99
+
100
+
# or
101
+
npm run test-export -- <glob>
102
+
```
103
+
104
+
##### C: Generate or update existing baseline image
105
+
106
+
To generate a new baseline image, add a new mock file in
107
+
[`test/image/mocks`][mocks]. Note that mock file needs to be a valid JSON and
108
+
have both a "data" and a `"layout"` field. Then, in your plotly.js directory,
109
+
run:
110
+
111
+
```bash
112
+
npm run baseline -- <name-of-mock>
113
+
```
114
+
115
+
which generates a baseline png image in [`test/image/baselines`][baselines].
116
+
117
+
To update existing baseline image(s), run
118
+
119
+
```bash
120
+
npm run basline -- <glob-of-mocks-to-update>
59
121
```
60
122
61
-
where `mock.json` is the name of a `{"data": [], "layout": {}}` json file found in [`test/image/mocks/`](https://github.com/plotly/plotly.js/tree/master/test/image/mocks). The `"data"` and `"layout"` field are passed to `Plotly.plot` to produce an image saved in [`test/image/baslines`](https://github.com/plotly/plotly.js/tree/master/test/image/baselines).
62
123
63
124
### Step 3: Stop your testing container
64
125
@@ -74,7 +135,7 @@ Mac and Windows user should also kill their docker-machine (named `default`) onc
74
135
docker-machine kill default
75
136
```
76
137
77
-
### Docker tricks
138
+
### Docker tricks
78
139
79
140
##### Get into docker container
80
141
@@ -119,3 +180,6 @@ docker-machine kill default
119
180
```
120
181
121
182
For more comprehensive information about docker, please refer to the [docker docs](http://docs.docker.com/).
0 commit comments