Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the timeout for clearing indexeddbs #4650

Merged
merged 1 commit into from Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/app-tests/loading.js
Expand Up @@ -82,9 +82,14 @@ describe('loading:', function () {
// unmounting should have cleared the MatrixClientPeg
expect(MatrixClientPeg.get()).toBe(null);

// chrome seems to take *ages* to delete the indexeddbs.
this.timeout(10000);

// clear the indexeddbs so we can start from a clean slate next time.
await test_utils.deleteIndexedDB('matrix-js-sdk:crypto');
await test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync');
await Promise.all([
test_utils.deleteIndexedDB('matrix-js-sdk:crypto'),
test_utils.deleteIndexedDB('matrix-js-sdk:riot-web-sync'),
]);
console.log(`${Date.now()}: loading: afterEach complete`);
});

Expand Down
6 changes: 4 additions & 2 deletions test/test-utils.js
Expand Up @@ -34,7 +34,8 @@ export function deleteIndexedDB(dbName) {
return;
}

console.log(`${Date.now()}: Removing indexeddb instance: ${dbName}`);
const startTime = Date.now();
console.log(`${startTime}: Removing indexeddb instance: ${dbName}`);
const req = window.indexedDB.deleteDatabase(dbName);

req.onblocked = () => {
Expand All @@ -48,7 +49,8 @@ export function deleteIndexedDB(dbName) {
};

req.onsuccess = () => {
console.log(`${Date.now()}: Removed indexeddb instance: ${dbName}`);
const now = Date.now();
console.log(`${now}: Removed indexeddb instance: ${dbName} in ${now-startTime} ms`);
resolve();
};
}).catch((e) => {
Expand Down