From b79e346664923b5d88e51035dbc810fe0c378b54 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 30 Apr 2022 14:01:49 -0700 Subject: [PATCH] test: fix flaky test --- tests/spec/132-threads-and-updates.js | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/spec/132-threads-and-updates.js b/tests/spec/132-threads-and-updates.js index 43101dde..3fc56ed1 100644 --- a/tests/spec/132-threads-and-updates.js +++ b/tests/spec/132-threads-and-updates.js @@ -202,24 +202,40 @@ test('complex thread is in correct order - with ancestors', async t => { test('complex thread is in correct order - with mixed self-replies', async t => { const { id: a } = await postAs('foobar', 'a') + await sleep(1000) const { id: b } = await postReplyAs('baz', 'b', a) + await sleep(1000) const { id: c } = await postReplyAs('baz', 'c', b) + await sleep(1000) const { id: a1 } = await postReplyAs('baz', 'a1', a) + await sleep(1000) const { id: d } = await postReplyAs('baz', 'd', c) + await sleep(1000) const { id: a2 } = await postReplyAs('baz', 'a2', a1) + await sleep(1000) const { id: b1 } = await postReplyAs('baz', 'b1', b) + await sleep(1000) const { id: a3 } = await postReplyAs('baz', 'a3', a2) + await sleep(1000) await postReplyAs('baz', 'e', d) + await sleep(1000) await postReplyAs('baz', 'b2', b1) + await sleep(1000) await postReplyAs('baz', 'a4', a3) + await sleep(1000) await postReplyAs('baz', 'a1a', a1) + await sleep(1000) // reply chain: foobar -> foobar -> baz -> foobar -> foobar // when foobar replies to itself after replying to baz, is it promoted? // see https://github.com/tootsuite/mastodon/pull/9320#issuecomment-440705662 const { id: mixed1 } = await postReplyAs('foobar', 'foobar-mixed1', a) + await sleep(1000) const { id: mixed2 } = await postReplyAs('baz', 'baz-mixed2', mixed1) + await sleep(1000) const { id: mixed3 } = await postReplyAs('foobar', 'foobar-mixed3', mixed2) + await sleep(1000) await postReplyAs('foobar', 'foobar-mixed4', mixed3) + await sleep(2000) await loginAsFoobar(t) await t.click(getNthStatus(4)) const order = 'a foobar-mixed1 b c d e b1 b2 a1 a2 a3 a4 a1a baz-mixed2 foobar-mixed3 foobar-mixed4'.split(' ') @@ -229,27 +245,46 @@ test('complex thread is in correct order - with mixed self-replies', async t => test('complex thread is in correct order - with mixed self-replies 2', async t => { const { id: a } = await postAs('foobar', 'a') + await sleep(1000) const { id: b } = await postReplyAs('baz', 'b', a) + await sleep(1000) const { id: c } = await postReplyAs('baz', 'c', b) + await sleep(1000) const { id: a1 } = await postReplyAs('baz', 'a1', a) + await sleep(1000) const { id: d } = await postReplyAs('baz', 'd', c) + await sleep(1000) const { id: a2 } = await postReplyAs('baz', 'a2', a1) + await sleep(1000) const { id: b1 } = await postReplyAs('baz', 'b1', b) + await sleep(1000) const { id: a3 } = await postReplyAs('baz', 'a3', a2) + await sleep(1000) await postReplyAs('baz', 'e', d) + await sleep(1000) await postReplyAs('baz', 'b2', b1) + await sleep(1000) await postReplyAs('baz', 'a4', a3) + await sleep(1000) await postReplyAs('baz', 'a1a', a1) + await sleep(1000) // reply chain: foobar -> foobar -> baz -> foobar -> foobar // when foobar replies to itself after replying to baz, is it promoted? // see https://github.com/tootsuite/mastodon/pull/9320#issuecomment-440705662 const { id: mixed1 } = await postReplyAs('foobar', 'foobar-mixed1', a) + await sleep(1000) const { id: mixed2 } = await postReplyAs('baz', 'baz-mixed2', mixed1) + await sleep(1000) const { id: mixed3 } = await postReplyAs('foobar', 'foobar-mixed3', mixed2) + await sleep(1000) await postReplyAs('foobar', 'foobar-mixed4', mixed3) + await sleep(1000) await postReplyAs('foobar', 'foobar-mixed1a', a) + await sleep(1000) await postReplyAs('foobar', 'foobar-mixed1b', a) + await sleep(1000) await postReplyAs('foobar', 'foobar-mixed2a', mixed1) + await sleep(2000) await loginAsFoobar(t) await scrollToStatus(t, 7) await t.click(getNthStatus(7))