From ff38bccb8030011ea88060dcd84547d0822aad96 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 6 Jul 2023 10:34:57 +0800 Subject: [PATCH] DEV: Fix number of chars for chat message content in fabricator (#22454) Why this change? `Faker::Lorem.paragraph` generates a differrent length of string every time. When a string happens to be long, it can change the UI across system test runs making it harder to reason about our system tests across multiple runs since the state is never really consistent. We will just generate a paragraph with a fixed length going forward so that the UI remains consistent. This should make certain tests which relies on the UI being in a certain state to become less flaky. --- plugins/chat/spec/fabricators/chat_fabricator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/chat/spec/fabricators/chat_fabricator.rb b/plugins/chat/spec/fabricators/chat_fabricator.rb index e9d57af37c2..2b6a691296d 100644 --- a/plugins/chat/spec/fabricators/chat_fabricator.rb +++ b/plugins/chat/spec/fabricators/chat_fabricator.rb @@ -66,7 +66,7 @@ Fabricator(:chat_message, class_name: "Chat::MessageCreator") do resolved_class.create( chat_channel: channel, user: user, - content: transients[:message] || Faker::Lorem.paragraph, + content: transients[:message] || Faker::Lorem.paragraph_by_chars(number: 500), thread_id: transients[:thread]&.id, in_reply_to_id: transients[:in_reply_to]&.id, upload_ids: transients[:upload_ids],