Revert "DEV: Update checks in chat channel and thread page objects (#21875)" (#21883)

This reverts commit ddf4ecba04f3c6396615506ec595650f14986758.

Causing a flaky test to appear:

```
main $ LOAD_PLUGINS=1 rspec plugins/chat/spec/system/chat/composer/shortcuts/channel_spec.rb

Randomized with seed 17765
.....F..

Failures:

  1) Chat | composer | shortcuts | channel when using ArrowUp when last message is staged does not edit a message
     Failure/Error: channel_page.send_message
       expected `#<PageObjects::Components::Chat::Messages:0x00007fe823ac1710 @context=".chat-channel">.has_message?({:persisted=>true, :text=>"2"})` to be truthy, got false

     [Screenshot Image]: /home/tgxworld/work/discourse/tmp/capybara/failures_r_spec_example_groups_chat_composer_shortcuts_channel_when_using_arrow_up_when_last_message_is_staged_does_not_edit_a_message_148.png
```
This commit is contained in:
Alan Guo Xiang Tan
2023-06-01 17:59:03 +09:00
committed by GitHub
parent 0494157452
commit 30e4ebd19b
6 changed files with 10 additions and 18 deletions

View File

@ -120,19 +120,19 @@ module PageObjects
find("[data-value='edit']").click
end
def edit_message(message, text = nil, check_message_presence: true)
def edit_message(message, text = nil)
open_edit_message(message)
send_message(text, check_message_presence:) if text
send_message(text) if text
end
def send_message(text = nil, check_message_presence: true)
def send_message(text = nil)
text ||= Faker::Lorem.characters(number: SiteSetting.chat_minimum_message_length)
text = text.chomp if text.present? # having \n on the end of the string counts as an Enter keypress
composer.fill_in(with: text)
click_send_message
expect(messages).to have_message(text: text, persisted: true) if check_message_presence
messages.has_message?(text: text, persisted: true)
click_composer
expect(self).to have_no_loading_skeleton
has_no_loading_skeleton?
text
end

View File

@ -62,7 +62,7 @@ module PageObjects
text = text.chomp if text.present? # having \n on the end of the string counts as an Enter keypress
composer.fill_in(with: text)
click_send_message
expect(messages).to have_message(text: text, persisted: true)
messages.has_message?(text: text, persisted: true)
click_composer
text
end