Skip to content

Commit

Permalink
refactor(test-functional): rewrite test
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Aug 31, 2023
1 parent 9d81bcd commit 2328132
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 188 deletions.
52 changes: 26 additions & 26 deletions test/functional/misc/misc_instancing.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
const assert = require('assert');

describe('misc_instancing', function _() {
let result;
before(async () => {
result = await loadExample(
'examples/misc_instancing.html',
this.fullTitle(),
);
});
let pageLoaded;
const title = this.fullTitle();

it('should run', async () => {
assert.ok(result);
it("should load 'misc_instancing' page", async function _it() {
pageLoaded = await loadExample('examples/misc_instancing.html', title);
assert.ok(pageLoaded);
});

it('should load the trees and lights objects', async () => {
const objects = await page.evaluate(
() => {
const res = [];
if (view.scene) {
const objects3d = view.scene;
objects3d.traverse((obj) => {
if (obj.isInstancedMesh) {
if (obj.parent && obj.parent.layer) {
res.push(obj.parent.layer.name);
it('should load the trees and lights objects', async function _it() {
if (pageLoaded) {
const objects = await page.evaluate(
() => {
const res = [];
if (view.scene) {
const objects3d = view.scene;
objects3d.traverse((obj) => {
if (obj.isInstancedMesh) {
if (obj.parent && obj.parent.layer) {
res.push(obj.parent.layer.name);
}
}
}
});
}
return res;
});
assert.ok(objects.indexOf('lights') >= 0);
assert.ok(objects.indexOf('trees') >= 0);
});
}
return res;
});
assert.ok(objects.indexOf('lights') >= 0);
assert.ok(objects.indexOf('trees') >= 0);
} else {
this.skip();
}
});
});
Loading

0 comments on commit 2328132

Please sign in to comment.