mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-11-24 09:31:05 +00:00
the error:
```
Randomized with seed 43756
.F
Failures:
1) Create channel shows error in chanel modal
Failure/Error: super
Capybara::ElementNotFound:
Unable to find css ".error-message"
[Screenshot Image]: /var/www/discourse/tmp/capybara/failures_r_spec_example_groups_create_channel_shows_error_in_chanel_modal_523.png
~~~~~~~ JS LOGS ~~~~~~~
(no logs)
```
To try solving this, I've changed the ordering, before visiting the page I already set up the channel error.
56 lines
1.8 KiB
Ruby
56 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
require_relative "../dummy_provider"
|
|
|
|
RSpec.describe "Create channel", type: :system do
|
|
fab!(:admin)
|
|
|
|
include_context "with dummy provider"
|
|
let(:manager) { ::DiscourseChatIntegration::Manager }
|
|
let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: "dummy") }
|
|
let(:category) { Fabricate(:category) }
|
|
let(:topic) { Fabricate(:topic, category_id: category.id) }
|
|
let(:first_post) { Fabricate(:post, topic: topic) }
|
|
|
|
before do
|
|
SiteSetting.chat_integration_enabled = true
|
|
SiteSetting.chat_integration_discord_enabled = true
|
|
sign_in(admin)
|
|
end
|
|
|
|
it "creates and displays a new channel" do
|
|
visit("/admin/plugins/chat-integration/discord")
|
|
|
|
expect(page).to have_no_css(".channel-details")
|
|
|
|
click_button(I18n.t("js.chat_integration.create_channel"))
|
|
|
|
find("input[name='param-name']").fill_in(with: "bloop")
|
|
find("input[name='param-webhook_url']").fill_in(with: "https://discord.com/api/webhooks/bloop")
|
|
click_button(I18n.t("js.chat_integration.edit_channel_modal.save"))
|
|
|
|
expect(page).to have_css(".channel-details")
|
|
expect(find(".channel-info")).to have_content("bloop")
|
|
end
|
|
|
|
it "shows the error in the channel modal" do
|
|
DiscourseChatIntegration::Rule.create!(
|
|
channel: chan1,
|
|
filter: "watch",
|
|
category_id: category.id,
|
|
)
|
|
|
|
provider.set_raise_exception(
|
|
DiscourseChatIntegration::ProviderError.new info: { error_key: "hello" }
|
|
)
|
|
manager.trigger_notifications(first_post.id)
|
|
|
|
visit("/admin/plugins/chat-integration/dummy")
|
|
|
|
expect(find(".error-message")).to have_content(
|
|
I18n.t("js.chat_integration.channels_with_errors"),
|
|
)
|
|
find(".channel-title").find("button").click
|
|
expect(page).to have_content "{\n \"error_key\": \"hello\"\n}"
|
|
end
|
|
end
|