diff --git a/examples/source_file_gpx_3d.html b/examples/source_file_gpx_3d.html index 15ae07888b..86016cac62 100644 --- a/examples/source_file_gpx_3d.html +++ b/examples/source_file_gpx_3d.html @@ -72,18 +72,18 @@ out: { crs: view.referenceCrs, structure: '3d', - style: { - stroke : { + style: new itowns.Style({ + stroke: { color: 'red', width: 2, }, - point : { + point: { color: 'white', } - } + }), } })) - .then(itowns.Feature2Mesh.convert({style})) + .then(itowns.Feature2Mesh.convert()) .then(function (mesh) { if (mesh) { mesh.updateMatrixWorld(); diff --git a/package.json b/package.json index 65515994db..88401b3b51 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test": "npm run lint -- --max-warnings=0 && npm run build && npm run test-with-coverage && npm run test-functional", "test-dev": "npm run lint -- --max-warnings=0 && npm run build-dev && npm run test-with-coverage && npm run test-functional", "test-unit": "npm run base-test-unit test/unit", - "test-functional": "mocha -t 60000 --require test/hooks_functional.js --recursive test/functional", + "test-functional": "mocha -t 100000 --require test/hooks_functional.js --recursive test/functional", "test-with-coverage": "nyc -n src -r html cross-env npm run test-unit", "test-with-coverage_lcov": "nyc -n src --reporter=lcov cross-env npm run test-unit", "base-test-unit": "cross-env BABEL_DISABLE_CACHE=1 mocha --require @babel/register --file test/unit/bootstrap.js", diff --git a/test/functional/source_file_gpx_3d.js b/test/functional/source_file_gpx_3d.js index 1787ad8caa..7e38c5227d 100644 --- a/test/functional/source_file_gpx_3d.js +++ b/test/functional/source_file_gpx_3d.js @@ -6,7 +6,11 @@ describe('source_file_gpx_3d', function _() { result = await loadExample('examples/source_file_gpx_3d.html', this.fullTitle()); }); - it('should run', async () => { + it('view initialized', async () => { assert.ok(result); }); + + it('should wait for the mesh to be added to the scene', async function _it() { + await page.waitForFunction(() => view.scene.children.length === 5, { timeout: 10000 }); + }); }); diff --git a/test/hooks_functional.js b/test/hooks_functional.js index 84936c0928..a04fadff7e 100644 --- a/test/hooks_functional.js +++ b/test/hooks_functional.js @@ -1,7 +1,6 @@ -/* global page, itowns, view, TimeoutError, initialPosition */ +/* global page, itowns, view, initialPosition */ // eslint-disable-next-line import/no-extraneous-dependencies const puppeteer = require('puppeteer'); -// const { TimeoutError } = require('puppeteer/Errors'); const net = require('net'); const fs = require('fs'); const http = require('http'); @@ -125,7 +124,7 @@ const loadExample = async (url, screenshotName) => { try { await layersAreInitialized(); } catch (e) { - if (e instanceof TimeoutError) { + if (e instanceof Error && e.name === 'TimeoutError') { await page.evaluate(() => { itowns.CameraUtils.stop(view, view.camera.camera3D); });