mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
This reverts commit ddf4ecba04.
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
```
26 lines
826 B
Ruby
26 lines
826 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Message errors", type: :system, js: true do
|
|
fab!(:current_user) { Fabricate(:admin) }
|
|
let(:chat_page) { PageObjects::Pages::Chat.new }
|
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
|
let(:max_length) { SiteSetting.chat_maximum_message_length }
|
|
|
|
before { chat_system_bootstrap }
|
|
|
|
context "when message is too long" do
|
|
fab!(:channel) { Fabricate(:chat_channel) }
|
|
|
|
it "only shows the error, not the message" do
|
|
channel.add(current_user)
|
|
sign_in(current_user)
|
|
chat_page.visit_channel(channel)
|
|
|
|
channel_page.send_message("atoolongmessage" + "a" * max_length)
|
|
|
|
expect(page).to have_no_content("atoolongmessage")
|
|
expect(page).to have_content(I18n.t("chat.errors.message_too_long", count: max_length))
|
|
end
|
|
end
|
|
end
|