Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tests/content/entity/material/apply/entities/model/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ nitpick.perform("Apply Material Entities to Model Entities", Script.resolvePath(
}
}

nitpick.addDelay(6);

nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Display materials on multiple models");

nitpick.addStep("Clean up after test", function () {
Expand Down
3 changes: 1 addition & 2 deletions tests/content/entity/material/apply/overlays/model/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ nitpick.perform("Apply Material Entities to Model Overlays", Script.resolvePath(
}
}

nitpick.addDelay(6);

nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Display materials on multiple model overlays");

nitpick.addStep("Clean up after test", function () {
Expand Down
3 changes: 1 addition & 2 deletions tests/content/entity/material/apply/targeting/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ nitpick.perform("Material targeting", Script.resolvePath("."), "secondary", func
}
}

nitpick.addDelay(6);

nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Display materials on multiple models");

nitpick.addStep("Clean up after test", function () {
Expand Down
3 changes: 1 addition & 2 deletions tests/content/entity/material/create/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ nitpick.perform("Material Entities", Script.resolvePath("."), "secondary", funct
}
});

nitpick.addDelay(10);

nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot when not in Debug mode");

nitpick.addStep("Debug Emissive", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ nitpick.perform("Read FBX model with normal texture", Script.resolvePath("."), "
// Show a cube with just a normal texture
addEntityWithOffset(createdEntities, 'models/model_baking/normal_texture/ModelUVScalingCube.baked.fbx', { x: 0.0, y: 0.75, z: -2.0 });

nitpick.addDelay(8);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("FBX normal texture should be visible on an otherwise white model");

nitpick.addStep("Clean up after test", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ nitpick.perform("Read FBX models with UV scale properties", Script.resolvePath("
// A cube with the FBX material (not to be confused with the texture) scaled automatically using Maya|uv_scale so it looks the same as the unscaled cube
addEntityWithOffset(createdEntities, 'models/fbx_models/uv_scale/maya_material/MayaUVScaleCube.fbx', { x: 1.5, y: 0.75, z: -4.0 });

nitpick.addDelay(8);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("FBX cube model texture scale comparison");

nitpick.addStep("Clean up after test", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.addDelay(4);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStepSnapshot("AlphaBlendModeTest.glb Model is visible");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStepSnapshot("BrainStem.glb Model is visible");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStepSnapshot("BrainStem.gltf Model is visible");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStepSnapshot("BrainStem.gltf Model is visible");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ nitpick.perform("Read GLTF model", Script.resolvePath("."), "secondary", functio
});

createdEntities.push(testEntity);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Scale to 1m", function () {
var properties = Entities.getEntityProperties(testEntity);
Expand Down
2 changes: 1 addition & 1 deletion tests/content/entity/model/renderLayer/front/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ nitpick.perform("Model Entity renderLayer front", Script.resolvePath("."), "seco
}));
});

nitpick.addDelay(10);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of all the models");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/content/entity/model/renderLayer/hud/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ nitpick.perform("Model Entity renderLayer hud", Script.resolvePath("."), "second
dimensions: { x: 4, y: 2, z: 0.5},
}));
});
nitpick.addDelay(8);

nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of all the models");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/content/overlay/material/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ nitpick.perform("Model Overlay Material create", Script.resolvePath("."), "secon
addCases(root, orientation);
});

nitpick.addDelay(12);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of all the models");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/effect/highlight/coverage/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ nitpick.perform("Highlight Test", Script.resolvePath("."), "secondary", function
createdEntities.push(hifi);
createdEntities.push(terrain);

nitpick.addDelay(4);
nitpick.waitForEntityLoad(createdEntities);

nitpick.addStep("Position secondary camera", function() {
validationCamera_translate({ x: 0.0, y: 0.0, z: -8.0 });
Expand Down
3 changes: 1 addition & 2 deletions tests/engine/render/geometry/invalidURL/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ nitpick.perform("Attempt to access invalid URL", Script.resolvePath("."), "secon
}
);

nitpick.addDelay(6);

nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Result of invalid URL load");

nitpick.addStep("Load model with valid URL", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/albedo/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nitpick.perform("Effects of albedo on various materials", Script.resolvePath("."
validationCamera_translate(OFFSET);
});

nitpick.addDelay(6);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/base/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nitpick.perform("Show base effects on various materials", Script.resolvePath("."
validationCamera_translate(OFFSET);
});

nitpick.addDelay(6);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/emissive/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nitpick.perform("Show effects of emmisive materials", Script.resolvePath("."), "
validationCamera_translate(OFFSET);
});

nitpick.addDelay(6);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/normal_map/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nitpick.perform("Show effects of normal maps", Script.resolvePath("."), "seconda
validationCamera_translate(OFFSET);
});

nitpick.addDelay(6);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects: Material Normal Map");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/opacity/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ nitpick.perform("Show effects of opacity", Script.resolvePath("."), "secondary",
validationCamera_translate(OFFSET);
});

nitpick.addDelay(6);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/roughness/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ nitpick.perform("Show effects of roughness", Script.resolvePath("."), "secondary
validationCamera_translate(OFFSET);
});

nitpick.addDelay(10);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/material/roughness_map/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nitpick.perform("Show effects of roughness maps", Script.resolvePath("."), "seco
validationCamera_translate(OFFSET);
});

nitpick.addDelay(6);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Take snapshot of the effects");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/shadows/front/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nitpick.perform("Shadow - light in front", Script.resolvePath("."), "secondary",
createdEntities = setup(20.0, 180.0, nitpick.getOriginFrame());
});

nitpick.addDelay(3);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Light source altitude: 20.0, azimuth: 180.0");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/shadows/grazing/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nitpick.perform("Shadow - light at grazing angle from left", Script.resolvePath(
createdEntities = setup(5.0, 90.0, nitpick.getOriginFrame());
});

nitpick.addDelay(3);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Light source altitude: 5.0, azimuth: 90.0");

nitpick.addStep("Clean up after test", function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/engine/render/shadows/normal/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nitpick.perform("Shadow - light on top", Script.resolvePath("."), "secondary", f
createdEntities = setup(80.0, -60.0, nitpick.getOriginFrame());
});

nitpick.addDelay(3);
nitpick.waitForEntityLoad(createdEntities);
nitpick.addStepSnapshot("Light source altitude: 80.0, azimuth: -60.0");

nitpick.addStep("Clean up after test", function () {
Expand Down
39 changes: 39 additions & 0 deletions tests/utils/nitpick.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@ function onStillSnapshotTaken(path, notify) {
waitingForSnapshot = false;
}

var arrayOfLoadingEntities = [];
function areEntitiesLoading() {
// Return immediately if no entities in array
if (!arrayOfLoadingEntities.length) {
return false;
}

// Check if all textures are loaded
if (!Test.isTextureLoadingComplete()) {
console.warn("Waiting for texture load");
return true;
}

// Check if we are waiting on any entities to load
for (var i in arrayOfLoadingEntities) {
if (!Entities.isLoaded(arrayOfLoadingEntities[i])) {
console.warn("Waiting for entity " + i);
entitiesStillLoading = true;
return true;
} else {
console.warn("Entity " + i + " loaded + , " + arrayOfLoadingEntities.length + " waiting to load");
arrayOfLoadingEntities = arrayOfLoadingEntities.splice(i, 1);
}
}

// All good
arrayOfLoadingEntities = [];
return false;
}

//returns n as a string, padded to length characters with the character ch
function pad(n, length, ch) {
ch = ch || '0'; // default is '0'
Expand Down Expand Up @@ -135,6 +165,8 @@ var onRunAutoNext = function() {

if (waitingForSnapshot) {
console.warn("Waiting for Snapshot");
} else if (areEntitiesLoading()) {
console.warn("Waiting for entities to load");
} else if (!downloadInProgress && !loadingContentIsStillDisplayed) {
// Only run next step if current step is complete
if (!runNextStep()) {
Expand Down Expand Up @@ -680,4 +712,11 @@ module.exports.verifyClientProfile = function() {
// Nothing was OK
console.warn("We are not running on any of the requested client profiles");
return false;
}


module.exports.waitForEntityLoad = function(arrayOfLoadingEntitiesParameter) {
if (typeof Test !== 'undefined') {
arrayOfLoadingEntities = arrayOfLoadingEntitiesParameter.slice();
}
}
4 changes: 3 additions & 1 deletion tests/utils/test_stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ setupStage = function (initData) {
stageRoot = Vec3.sum(stageRoot, Vec3.multiply(ROOT_Y_OFFSET, Quat.getUp(orientation)));
stageTileRoot = Vec3.sum(stageRoot, GRID_TILE_OFFSET);

return addTestBackdrop("Light_stage_backdrop", initData.flags, initData.lifetime);
entities = addTestBackdrop("Light_stage_backdrop", initData.flags, initData.lifetime);
nitpick.waitForEntityLoad(entities);
return entities;
}

getStagePosOriAt = function (a, b, c) {
Expand Down