Skip to content

Commit

Permalink
fix(example): fix example Gpx 3d and functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Sep 15, 2023
1 parent e56bf65 commit 781a47d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions examples/source_file_gpx_3d.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion test/functional/source_file_gpx_3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
});
5 changes: 2 additions & 3 deletions test/hooks_functional.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 781a47d

Please sign in to comment.