diff options
| author | Alexandre Kühn <aku@odoo.com> | 2020-01-08 13:05:07 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-01-13 10:13:41 +0000 |
| commit | 2f3e6e9ea8e8f747f7f5f9210ddc6d147863f40f (patch) | |
| tree | cd46fe8ae1b2d1dd59d2b02fd57405b6fabf6600 | |
| parent | 6a9b29ec9aba37c25534f7effd53ebddeeb8aed2 (diff) | |
[FIX] mail:tests: no undeterministic failure of discuss history test
Before this commit, the test 'all messages in "Inbox" in "History"
after marked all as read' had non-deterministic failures.
More precisely, it crashed on either assertion "there should be 30
messages in History" or "there should be 40 messages in History",
both resulting to 0 messages in History instead.
Unfortunately, as of the date of this commit, we still do not
understand why it rarely fails. In the meantime, we have decided to
make these errors less likely to happen, by waiting much longer
before the assertions. We are aware that this is a poor solution,
but this is much better than skipping the test, until we find and fix
this issue at a later moment.
Closes #43072
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
| -rw-r--r-- | addons/mail/static/tests/discuss_tests.js | 32 |
1 files changed, 30 insertions, 2 deletions
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, |
