From f2902d38303fe054bb2a3b8a794bbe64714f3203 Mon Sep 17 00:00:00 2001 From: Natalie Tay Date: Tue, 18 Jan 2022 19:22:49 +0800 Subject: [PATCH] FIX: Attempt to fix flaky test by using a shorter topic (#15627) As part of /t/10298, try to remove the first flaky test in the list. One finding is that the /t/280 topic has a very long post stream, so that may have caused some delay when rendering the topic. One way is to wait for the first expected element to load, but that doesn't scale well given how many waits we will need to add. So I chose to render a shorter topic instead. --- .../tests/acceptance/composer-actions-test.js | 8 +- .../discourse/tests/fixtures/topic.js | 243 ++++++++++++++++++ 2 files changed, 247 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js index e38a32e59d6..2eda804e7de 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js @@ -214,15 +214,15 @@ acceptance("Composer Actions", function (needs) { const composerActions = selectKit(".composer-actions"); const quote = "Life is like riding a bicycle."; - await visit("/t/internationalization-localization/280"); - await click("article#post_3 button.reply"); + await visit("/t/short-topic-with-two-posts/54077"); + await click("article#post_2 button.reply"); await fillIn(".d-editor-input", quote); await composerActions.expand(); await composerActions.selectRowByValue("reply_to_topic"); assert.strictEqual( queryAll(".action-title").text().trim(), - "Internationalization / localization" + "Short topic with two posts" ); assert.strictEqual(queryAll(".d-editor-input").val(), quote); @@ -250,7 +250,7 @@ acceptance("Composer Actions", function (needs) { assert.ok(exists(".action-title img.avatar")); assert.strictEqual( queryAll(".action-title .user-link").text().trim(), - "codinghorror" + "tms" ); assert.strictEqual(queryAll(".d-editor-input").val(), quote); assert.strictEqual( diff --git a/app/assets/javascripts/discourse/tests/fixtures/topic.js b/app/assets/javascripts/discourse/tests/fixtures/topic.js index 6861fe34d66..8fbd7aad064 100644 --- a/app/assets/javascripts/discourse/tests/fixtures/topic.js +++ b/app/assets/javascripts/discourse/tests/fixtures/topic.js @@ -6197,4 +6197,247 @@ export default { }, }, }, + "/t/54077.json": { + pending_posts: [], + post_stream: { + posts: [ + { + id: 398, + name: "Uwe Keim", + username: "uwe_keim", + avatar_template: "/images/avatar.png", + uploaded_avatar_id: 5697, + created_at: "2013-02-05T21:29:00.280Z", + cooked: "

This is a short topic.

", + post_number: 1, + post_type: 1, + updated_at: "2013-02-05T21:29:00.280Z", + like_count: 0, + reply_count: 1, + reply_to_post_number: null, + quote_count: 0, + incoming_link_count: 314, + reads: 475, + score: 1702.25, + yours: false, + topic_id: 54077, + topic_slug: "short-topic-with-two-posts", + display_username: "Uwe Keim", + primary_group_name: null, + version: 1, + can_edit: true, + can_delete: false, + can_recover: true, + link_counts: [], + read: true, + user_title: null, + actions_summary: [ + { + id: 2, + count: 0, + hidden: false, + can_act: true, + }, + ], + moderator: false, + admin: false, + staff: false, + user_id: 255, + hidden: false, + hidden_reason_id: null, + trust_level: 2, + deleted_at: null, + user_deleted: false, + edit_reason: null, + can_view_edit_history: true, + wiki: false, + }, + { + id: 419, + name: "Tim Stone", + username: "tms", + avatar_template: "/images/avatar.png", + uploaded_avatar_id: 40181, + created_at: "2013-02-05T21:32:47.649Z", + cooked: "

Yeah it is a short one

", + post_number: 2, + post_type: 1, + updated_at: "2013-02-06T10:15:27.965Z", + like_count: 4, + reply_count: 0, + reply_to_post_number: null, + quote_count: 0, + incoming_link_count: 16, + reads: 460, + score: 308.35, + yours: false, + topic_id: 54077, + topic_slug: "short-topic-with-two-posts", + display_username: "Tim Stone", + primary_group_name: null, + version: 2, + can_edit: true, + can_delete: true, + can_recover: true, + link_counts: [], + read: true, + user_title: "Great contributor", + actions_summary: [ + { + id: 2, + count: 4, + hidden: false, + can_act: true, + }, + ], + moderator: false, + admin: false, + staff: false, + user_id: 9, + hidden: false, + hidden_reason_id: null, + trust_level: 2, + deleted_at: null, + user_deleted: false, + edit_reason: null, + can_view_edit_history: true, + wiki: false, + }, + ], + stream: [398, 419], + gaps: { before: {}, after: { 398: [419] } }, + }, + id: 54077, + title: "Short topic with two posts", + fancy_title: "Short topic with two posts", + posts_count: 2, + created_at: "2013-02-05T21:29:00.174Z", + views: 5211, + reply_count: 1, + participant_count: 2, + like_count: 135, + last_posted_at: "2015-03-04T15:07:10.487Z", + visible: true, + closed: false, + archived: false, + has_summary: true, + archetype: "regular", + slug: "short-topic-with-two-posts", + category_id: 2, + word_count: 300, + deleted_at: null, + draft: null, + draft_key: "topic_54077", + draft_sequence: 3, + posted: true, + unpinned: null, + pinned_globally: false, + pinned: false, + pinned_at: null, + details: { + can_publish_page: true, + can_invite_via_email: true, + can_toggle_topic_visibility: true, + can_pin_unpin_topic: true, + auto_close_at: null, + auto_close_hours: null, + auto_close_based_on_last_post: false, + created_by: { + id: 255, + username: "uwe_keim", + uploaded_avatar_id: 5697, + avatar_template: "/images/avatar.png", + }, + last_poster: { + id: 9, + username: "Tim Stone", + uploaded_avatar_id: 40181, + avatar_template: "/images/avatar.png", + }, + participants: [ + { + id: 9, + username: "tms", + uploaded_avatar_id: 40181, + avatar_template: "/images/avatar.png", + post_count: 2, + }, + { + id: 255, + username: "uwe_keim", + uploaded_avatar_id: 5697, + avatar_template: "/images/avatar.png", + post_count: 1, + }, + ], + links: [], + notification_level: 2, + notifications_reason_id: 4, + can_move_posts: true, + can_edit: true, + can_delete: true, + can_recover: true, + can_remove_allowed_users: true, + can_invite_to: true, + can_create_post: true, + can_reply_as_new_topic: true, + can_flag_topic: true, + }, + highest_post_number: 2, + last_read_post_number: 2, + deleted_by: null, + has_deleted: true, + actions_summary: [ + { id: 4, count: 0, hidden: false, can_act: true }, + { id: 7, count: 0, hidden: false, can_act: true }, + { id: 8, count: 0, hidden: false, can_act: true }, + ], + chunk_size: 20, + bookmarked: false, + bookmarks: [], + suggested_topics: [ + { + id: 27331, + title: "Polls are still very buggy", + fancy_title: "Polls are still very buggy", + slug: "polls-are-still-very-buggy", + posts_count: 4, + reply_count: 1, + highest_post_number: 4, + image_url: "/uploads/default/_optimized/cd1/b8c/c162528887_690x401.png", + created_at: "2015-04-08T09:51:00.357Z", + last_posted_at: "2015-04-08T15:59:16.258Z", + bumped: true, + bumped_at: "2015-04-08T16:05:09.842Z", + unseen: false, + last_read_post_number: 3, + unread_posts: 1, + pinned: false, + unpinned: null, + visible: true, + closed: false, + archived: false, + notification_level: 2, + bookmarked: false, + bookmarks: [], + liked: false, + archetype: "regular", + like_count: 11, + views: 55, + category_id: 1, + posters: [ + { + extras: "latest single", + description: "Original Poster, Most Recent Poster", + user: { + id: 1, + username: "test", + avatar_template: "/images/avatar.png", + }, + }, + ], + }, + ], + tags: null, + }, };