Skip to content

Commit 781a47d

Browse files
committed
fix(example): fix example Gpx 3d and functional test
1 parent e56bf65 commit 781a47d

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

examples/source_file_gpx_3d.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@
7272
out: {
7373
crs: view.referenceCrs,
7474
structure: '3d',
75-
style: {
76-
stroke : {
75+
style: new itowns.Style({
76+
stroke: {
7777
color: 'red',
7878
width: 2,
7979
},
80-
point : {
80+
point: {
8181
color: 'white',
8282
}
83-
}
83+
}),
8484
}
8585
}))
86-
.then(itowns.Feature2Mesh.convert({style}))
86+
.then(itowns.Feature2Mesh.convert())
8787
.then(function (mesh) {
8888
if (mesh) {
8989
mesh.updateMatrixWorld();

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test": "npm run lint -- --max-warnings=0 && npm run build && npm run test-with-coverage && npm run test-functional",
1515
"test-dev": "npm run lint -- --max-warnings=0 && npm run build-dev && npm run test-with-coverage && npm run test-functional",
1616
"test-unit": "npm run base-test-unit test/unit",
17-
"test-functional": "mocha -t 60000 --require test/hooks_functional.js --recursive test/functional",
17+
"test-functional": "mocha -t 100000 --require test/hooks_functional.js --recursive test/functional",
1818
"test-with-coverage": "nyc -n src -r html cross-env npm run test-unit",
1919
"test-with-coverage_lcov": "nyc -n src --reporter=lcov cross-env npm run test-unit",
2020
"base-test-unit": "cross-env BABEL_DISABLE_CACHE=1 mocha --require @babel/register --file test/unit/bootstrap.js",

test/functional/source_file_gpx_3d.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ describe('source_file_gpx_3d', function _() {
66
result = await loadExample('examples/source_file_gpx_3d.html', this.fullTitle());
77
});
88

9-
it('should run', async () => {
9+
it('view initialized', async () => {
1010
assert.ok(result);
1111
});
12+
13+
it('should wait for the mesh to be added to the scene', async function _it() {
14+
await page.waitForFunction(() => view.scene.children.length === 5, { timeout: 10000 });
15+
});
1216
});

test/hooks_functional.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/* global page, itowns, view, TimeoutError, initialPosition */
1+
/* global page, itowns, view, initialPosition */
22
// eslint-disable-next-line import/no-extraneous-dependencies
33
const puppeteer = require('puppeteer');
4-
// const { TimeoutError } = require('puppeteer/Errors');
54
const net = require('net');
65
const fs = require('fs');
76
const http = require('http');
@@ -125,7 +124,7 @@ const loadExample = async (url, screenshotName) => {
125124
try {
126125
await layersAreInitialized();
127126
} catch (e) {
128-
if (e instanceof TimeoutError) {
127+
if (e instanceof Error && e.name === 'TimeoutError') {
129128
await page.evaluate(() => {
130129
itowns.CameraUtils.stop(view, view.camera.camera3D);
131130
});

0 commit comments

Comments
 (0)