xmpp.chapril.org-conversejs/tests/runner.js
JC Brand 1fa203c990 Support for IndexedDB. updates #1105
Depend on latest backbone.browserStorage which has support for IndexedDB
via localforage.

Storage operations are now asynchronous and transactional.

Bugs fixed (mostly by waiting for operations to complete):

* Rooms are now fetched asynchronously, so wait before triggering `show`
  or when closing.
* Make sure chat create/update transactions complete before firing events
* Make sure chats and messages have been fetched before creating new ones.
* When doing a `fetch` with `wait: false` on a collection and then
  creating a model in that collection, then once the read
  operation finishes (after creating the model), the collection is emptied again.
* Patch and wait when saving.
  Otherwise we have previously set attributes overriding later ones.
* Make sure api.roomviews.close returns a promise

Test fixes:

* Chats are now asynchronously returned, so we need to use `await`
* Wait for the storage transaction to complete when creating and updating messages
* Wait for all chatboxes to close
    Otherwise we get sessionStorage inconsistencies due to the async nature of localforage.
* Wait for room views to close in spec/chatroom.js

In the process, remove the `closeAllChatBoxes` override in
converse-controlbox by letting the `close` method decide whether it
should be closed or not.
2019-10-30 13:02:23 +01:00

83 lines
2.2 KiB
JavaScript

var config = {
baseUrl: '../',
paths: {
'console-reporter': 'tests/console-reporter',
'es6-promise': 'node_modules/es6-promise/dist/es6-promise.auto',
'jasmine-console': 'node_modules/jasmine-core/lib/console/console',
'jasmine-core': 'node_modules/jasmine-core/lib/jasmine-core/jasmine',
'jasmine-html': 'node_modules/jasmine-core/lib/jasmine-core/jasmine-html',
'jasmine':'node_modules/jasmine-core/lib/jasmine-core/boot',
'mock': 'tests/mock',
'sinon': 'node_modules/sinon/pkg/sinon',
'test-utils': 'tests/utils',
'transcripts': 'converse-logs/converse-logs'
},
shim: {
'jasmine-html': {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
},
'jasmine-console': {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
},
'jasmine': {
deps: ['jasmine-core', 'jasmine-html', 'jasmine-console'],
exports: 'window.jasmine'
},
}
};
require.config(config);
var specs = [
"jasmine",
// "spec/transcripts",
// "spec/profiling",
"spec/spoilers",
"spec/roomslist",
"spec/utils",
"spec/converse",
"spec/bookmarks",
"spec/headline",
"spec/disco",
"spec/protocol",
"spec/presence",
"spec/eventemitter",
"spec/smacks",
"spec/ping",
"spec/push",
"spec/xmppstatus",
"spec/mam",
"spec/omemo",
"spec/controlbox",
"spec/roster",
"spec/chatbox",
"spec/user-details-modal",
"spec/messages",
"spec/muc_messages",
"spec/muc",
"spec/modtools",
"spec/room_registration",
"spec/autocomplete",
"spec/minchats",
"spec/notification",
"spec/login",
"spec/register",
"spec/http-file-upload",
"spec/emojis"
];
require(['console-reporter', 'mock', 'sinon'], (ConsoleReporter, mock, sinon) => {
if (window.view_mode) {
mock.view_mode = window.view_mode;
}
window.sinon = sinon;
// Load the specs
require(specs, jasmine => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 7000;
const jasmineEnv = jasmine.getEnv();
jasmineEnv.addReporter(new ConsoleReporter());
window.onload();
});
});