diff --git a/ui/src/api_tests/comment.spec.ts b/ui/src/api_tests/comment.spec.ts index f56f45243..86d66916b 100644 --- a/ui/src/api_tests/comment.spec.ts +++ b/ui/src/api_tests/comment.spec.ts @@ -31,6 +31,7 @@ beforeAll(async () => { await followBeta(alpha); await followBeta(gamma); let search = await searchForBetaCommunity(alpha); + await delay(10000); postRes = await createPost( alpha, search.communities.filter(c => c.local == false)[0].id @@ -48,7 +49,7 @@ test('Create a comment', async () => { expect(commentRes.comment.community_local).toBe(false); expect(commentRes.comment.creator_local).toBe(true); expect(commentRes.comment.score).toBe(1); - await delay(5000); + await delay(); // Make sure that comment is liked on beta let searchBeta = await searchComment(beta, commentRes.comment); @@ -92,16 +93,10 @@ test('Delete a comment', async () => { expect(deleteCommentRes.comment.deleted).toBe(true); await delay(); - // Make sure that comment is deleted on beta - // The search doesnt work below, because it returns a tombstone / http::gone - // let searchBeta = await searchComment(beta, commentRes.comment); - // console.log(searchBeta); - // let betaComment = searchBeta.comments[0]; - // Create a fake post, just to get the previous new post id - let createdBetaPostJustToGetId = await createPost(beta, 2); - let betaPost = await getPost(beta, createdBetaPostJustToGetId.post.id - 1); - let betaComment = betaPost.comments[0]; - expect(betaComment.deleted).toBe(true); + // Make sure that comment is undefined on beta + let searchBeta = await searchComment(beta, commentRes.comment); + let betaComment = searchBeta.comments[0]; + expect(betaComment).toBeUndefined(); await delay(); let undeleteCommentRes = await deleteComment( diff --git a/ui/src/api_tests/post.spec.ts b/ui/src/api_tests/post.spec.ts index 525439936..eb063ead2 100644 --- a/ui/src/api_tests/post.spec.ts +++ b/ui/src/api_tests/post.spec.ts @@ -28,6 +28,7 @@ beforeAll(async () => { await followBeta(gamma); await followBeta(delta); await followBeta(epsilon); + await delay(10000); }); afterAll(async () => { @@ -45,7 +46,7 @@ test('Create a post', async () => { expect(postRes.post.community_local).toBe(false); expect(postRes.post.creator_local).toBe(true); expect(postRes.post.score).toBe(1); - await delay(5000); + await delay(); // Make sure that post is liked on beta let searchBeta = await searchPost(beta, postRes.post); @@ -204,11 +205,12 @@ test('Delete a post', async () => { let deletedPost = await deletePost(alpha, true, postRes.post); expect(deletedPost.post.deleted).toBe(true); - await delay(5000); + await delay(); // Make sure lemmy beta sees post is deleted - let createFakeBetaPostToGetId = (await createPost(beta, 2)).post.id - 1; + let newPost = await createPost(beta, 2); await delay(); + let createFakeBetaPostToGetId = newPost.post.id - 1; let betaPost = await getPost(beta, createFakeBetaPostToGetId); expect(betaPost.post.deleted).toBe(true); await delay(); @@ -266,7 +268,7 @@ test('Remove a post from admin and community on same instance', async () => { // The beta admin removes it (the community lives on beta) let removePostRes = await removePost(beta, true, betaPost.post); expect(removePostRes.post.removed).toBe(true); - await delay(5000); + await delay(); // Make sure lemmy alpha sees post is removed let alphaPost = await getPost(alpha, postRes.post.id); diff --git a/ui/src/api_tests/private_message.spec.ts b/ui/src/api_tests/private_message.spec.ts index ac5a87859..78d467da9 100644 --- a/ui/src/api_tests/private_message.spec.ts +++ b/ui/src/api_tests/private_message.spec.ts @@ -15,7 +15,9 @@ let recipient_id: number; beforeAll(async () => { await setupLogins(); - recipient_id = (await followBeta(alpha)).community.creator_id; + let follow = await followBeta(alpha); + await delay(10000); + recipient_id = follow.community.creator_id; }); afterAll(async () => {