diff --git a/addons/mail/static/tests/discuss_tests.js b/addons/mail/static/tests/discuss_tests.js index 8e8b663e83f..1e269ca7074 100644 --- a/addons/mail/static/tests/discuss_tests.js +++ b/addons/mail/static/tests/discuss_tests.js @@ -1818,8 +1818,16 @@ QUnit.test('messages marked as read move to "History" mailbox', async function ( discuss.destroy(); }); - QUnit.test('all messages in "Inbox" in "History" after marked all as read', async function (assert) { - assert.expect(10) +QUnit.test('all messages in "Inbox" in "History" after marked all as read', async function (assert) { + /** + * FIXME: for some reasons, this test may crash non-deterministically on + * runbot around once every hundreds of builds. As of the writing of this + * comment, no explanation has been found, so extra `nextTick()` have been + * added in the meantime. This work-around sucks, but this is better than + * skipping this test, until we find the issue and fix it properly in the + * future. + */ + assert.expect(10); const messagesData = []; for (let i = 0; i < 40; i++) { @@ -1898,6 +1906,16 @@ QUnit.test('messages marked as read move to "History" mailbox', async function ( const $history = discuss.$('.o_mail_discuss_item[data-thread-id="mailbox_history"]'); await testUtils.dom.click($history); + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) assert.verifySteps(['message_fetch'], "should fetch messages once for history"); assert.containsN(discuss, '.o_thread_message', 30, @@ -1907,6 +1925,16 @@ QUnit.test('messages marked as read move to "History" mailbox', async function ( discuss.$('.o_mail_thread').scrollTop(0); await loadMoreDef; await testUtils.nextTick(); + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) + await testUtils.nextTick(); // extra (non-deterministic) assert.verifySteps(['message_fetch'], "should fetch more messages in history for loadMore"); assert.containsN(discuss, '.o_thread_message', 40,