libreoffice-online/loleaflet/spec/loadtest/LoadTestSpec.js
Ashod Nakashian ac65edc910 loleaflet: fixed sample and loadtest to support https
To run loadtest, point the browser to:
file:///abs/path/to/loleaflet/spec/loadtest.html

To run the sample, point the browser to:
file:///abs/path/to/loleaflet/debug/document/document_simple_example.html?file_path=/abs/doc/path/test.odt&host=wss://localhost:9980

Change-Id: If3e9aa2fc321e734ad912158b06ecb3370e37418
Reviewed-on: https://gerrit.libreoffice.org/23454
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:05:56 +00:00

81 lines
1.8 KiB
JavaScript

describe('LoadTest', function () {
// 25 s timeout
this.timeout(25000);
// set the slow time to 5ms knowing each test takes more than that,
// so the run time is always printed
this.slow(5);
var testsRan = 0,
checkTimeOut = null,
map = null,
docLayer = null,
x = 0,
y = 0;
var docPath = '';
before(function() {
var htmlPath = window.location.pathname;
var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/'));
docPath = 'file://' + dir + '/data/';
});
var docs = ['eval.odt', 'eval.odp', 'eval.ods', 'eval.odg'];
docs.forEach(function (testDoc) {
testsRan += 1;
describe('Document #' + testsRan + ' (' + testDoc + ')', function () {
afterEach(function () {
map.off('statusindicator');
});
after(function () {
map.remove();
});
it('Load the document', function (done) {
map = L.map('map-test', {
server: 'wss://localhost:9980',
doc: docPath + testDoc,
edit: false,
readOnly: false
});
map.on('statusindicator', function (e) {
if (e.statusType === 'alltilesloaded') {
y = map.getDocSize().y;
done();
}
});
});
it('Scroll to the middle', function (done) {
map.on('statusindicator', function (e) {
if (e.statusType === 'alltilesloaded') {
clearTimeout(checkTimeOut);
done();
}
});
map.scrollTop(y / 2);
checkTimeOut = setTimeout(function () {
expect(map._docLayer._emptyTilesCount).to.eql(0);
done();
}, 6000);
});
it('Scroll to the bottom', function (done) {
map.on('statusindicator', function (e) {
if (e.statusType === 'alltilesloaded') {
clearTimeout(checkTimeOut);
done();
}
});
map.scrollTop(y);
checkTimeOut = setTimeout(function () {
expect(map._docLayer._emptyTilesCount).to.eql(0);
done();
}, 6000);
});
});
});
});