[FIX] mail:tests: no crash on intercepted crosstab heartbeat

The test may fail non-deterministically from intercepting an
heartbeat in the local storage. Only a document thread window fold
state change from the local storage should be intercepted.

Closes #43072
This commit is contained in:
Alexandre Kühn
2020-01-13 10:13:40 +00:00
parent b58c649d72
commit 6a9b29ec9a
@@ -227,7 +227,7 @@ QUnit.test('post messages in a document thread window', async function (assert)
});
QUnit.test('open, fold, unfold and close a document thread window', async function (assert) {
assert.expect(24);
assert.expect(20);
var messagingMenu = new MessagingMenu();
testUtils.mock.addMockEnvironment(messagingMenu, {
services: this.services,
@@ -238,12 +238,13 @@ QUnit.test('open, fold, unfold and close a document thread window', async functi
testUtils.mock.intercept(messagingMenu, 'call_service', function (ev) {
if (ev.data.service === 'local_storage' && ev.data.method === 'setItem') {
const key = ev.data.args[0];
const state = ev.data.args[1].state;
assert.strictEqual(key, 'mail.document_threads_state/some.res.model_1');
assert.ok(state);
assert.ok(state.name);
assert.ok(state.windowState);
assert.step(`${key}: { name: "${state.name}", windowState: '${state.windowState}' }`);
if (key === 'mail.document_threads_state/some.res.model_1') {
const state = ev.data.args[1].state;
assert.ok(state);
assert.ok(state.name);
assert.ok(state.windowState);
assert.step(`${key}: { name: "${state.name}", windowState: '${state.windowState}' }`);
}
}
}, true);
await messagingMenu.appendTo($('#qunit-fixture'));