mirror of
https://github.com/overte-org/overte.git
synced 2025-04-13 16:24:47 +02:00
* address FIXME regarding jasmine.done()
* support disabling tests / reporting as pending
This commit is contained in:
parent
1564c76ab4
commit
24dd06b65e
4 changed files with 46 additions and 6 deletions
|
@ -6,7 +6,7 @@
|
||||||
var lastSpecStartTime;
|
var lastSpecStartTime;
|
||||||
function ConsoleReporter(options) {
|
function ConsoleReporter(options) {
|
||||||
var startTime = new Date().getTime();
|
var startTime = new Date().getTime();
|
||||||
var errorCount = 0;
|
var errorCount = 0, pending = [];
|
||||||
this.jasmineStarted = function (obj) {
|
this.jasmineStarted = function (obj) {
|
||||||
print('Jasmine started with ' + obj.totalSpecsDefined + ' tests.');
|
print('Jasmine started with ' + obj.totalSpecsDefined + ' tests.');
|
||||||
};
|
};
|
||||||
|
@ -15,11 +15,15 @@
|
||||||
var endTime = new Date().getTime();
|
var endTime = new Date().getTime();
|
||||||
print('<hr />');
|
print('<hr />');
|
||||||
if (errorCount === 0) {
|
if (errorCount === 0) {
|
||||||
print ('<span style="color:green">All tests passed!</span>');
|
print ('<span style="color:green">All enabled tests passed!</span>');
|
||||||
} else {
|
} else {
|
||||||
print('<span style="color:red">Tests completed with ' +
|
print('<span style="color:red">Tests completed with ' +
|
||||||
errorCount + ' ' + ERROR + '.<span>');
|
errorCount + ' ' + ERROR + '.<span>');
|
||||||
}
|
}
|
||||||
|
if (pending.length) {
|
||||||
|
print ('<span style="color:darkorange">disabled: <br /> '+
|
||||||
|
pending.join('<br /> ')+'</span>');
|
||||||
|
}
|
||||||
print('Tests completed in ' + (endTime - startTime) + 'ms.');
|
print('Tests completed in ' + (endTime - startTime) + 'ms.');
|
||||||
};
|
};
|
||||||
this.suiteStarted = function(obj) {
|
this.suiteStarted = function(obj) {
|
||||||
|
@ -32,6 +36,10 @@
|
||||||
lastSpecStartTime = new Date().getTime();
|
lastSpecStartTime = new Date().getTime();
|
||||||
};
|
};
|
||||||
this.specDone = function(obj) {
|
this.specDone = function(obj) {
|
||||||
|
if (obj.status === 'pending') {
|
||||||
|
pending.push(obj.fullName);
|
||||||
|
return print('...(pending ' + obj.fullName +')');
|
||||||
|
}
|
||||||
var specEndTime = new Date().getTime();
|
var specEndTime = new Date().getTime();
|
||||||
var symbol = obj.status === PASSED ?
|
var symbol = obj.status === PASSED ?
|
||||||
'<span style="color:green">' + CHECKMARK + '</span>' :
|
'<span style="color:green">' + CHECKMARK + '</span>' :
|
||||||
|
|
|
@ -8,6 +8,15 @@ var ROT_IDENT = {x: 0, y: 0, z: 0, w: 1};
|
||||||
|
|
||||||
describe("MyAvatar", function () {
|
describe("MyAvatar", function () {
|
||||||
|
|
||||||
|
// backup/restore current skeletonModelURL
|
||||||
|
beforeAll(function() {
|
||||||
|
this.oldURL = MyAvatar.skeletonModelURL;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(function() {
|
||||||
|
MyAvatar.skeletonModelURL = this.oldURL;
|
||||||
|
});
|
||||||
|
|
||||||
// reload the avatar from scratch before each test.
|
// reload the avatar from scratch before each test.
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
MyAvatar.skeletonModelURL = DEFAULT_AVATAR_URL;
|
MyAvatar.skeletonModelURL = DEFAULT_AVATAR_URL;
|
||||||
|
@ -25,7 +34,7 @@ describe("MyAvatar", function () {
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
}, 10000 /*timeout -- allow time to download avatar*/);
|
||||||
|
|
||||||
// makes the assumption that there is solid ground somewhat underneath the avatar.
|
// makes the assumption that there is solid ground somewhat underneath the avatar.
|
||||||
it("position and orientation getters", function () {
|
it("position and orientation getters", function () {
|
||||||
|
|
|
@ -19,6 +19,14 @@ describe('Entity', function() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
it('serversExist', function() {
|
||||||
|
expect(Entities.serversExist()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('canRezTmp', function() {
|
||||||
|
expect(Entities.canRezTmp()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
boxEntity = Entities.addEntity(boxProps);
|
boxEntity = Entities.addEntity(boxProps);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,11 +3,26 @@ Script.include('../../libraries/jasmine/jasmine.js');
|
||||||
Script.include('../../libraries/jasmine/hifi-boot.js')
|
Script.include('../../libraries/jasmine/hifi-boot.js')
|
||||||
|
|
||||||
// Include unit tests
|
// Include unit tests
|
||||||
// FIXME: Figure out why jasmine done() is not working.
|
Script.include('avatarUnitTests.js');
|
||||||
// Script.include('avatarUnitTests.js');
|
|
||||||
Script.include('bindUnitTest.js');
|
Script.include('bindUnitTest.js');
|
||||||
Script.include('entityUnitTests.js');
|
Script.include('entityUnitTests.js');
|
||||||
|
|
||||||
|
describe("jasmine internal tests", function() {
|
||||||
|
it('should support async .done()', function(done) {
|
||||||
|
var start = new Date;
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
expect((new Date - start)/1000).toBeCloseTo(0.5, 1);
|
||||||
|
done();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
// jasmine pending test
|
||||||
|
xit('disabled test', function() {
|
||||||
|
expect(false).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// invoke Script.stop (after any async tests complete)
|
||||||
|
jasmine.getEnv().addReporter({ jasmineDone: Script.stop });
|
||||||
|
|
||||||
// Run the tests
|
// Run the tests
|
||||||
jasmine.getEnv().execute();
|
jasmine.getEnv().execute();
|
||||||
Script.stop();
|
|
||||||
|
|
Loading…
Reference in a new issue