2024-06-26 20:09:26 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-10-24 20:15:32 +08:00
|
|
|
describe "DiscourseAutomation | error", type: :system do
|
2024-06-26 20:09:26 +08:00
|
|
|
fab!(:admin)
|
|
|
|
|
2024-11-13 10:49:38 +08:00
|
|
|
let(:new_automation_page) { PageObjects::Pages::NewAutomation.new }
|
|
|
|
let(:automation_page) { PageObjects::Pages::Automation.new }
|
|
|
|
|
2024-06-26 20:09:26 +08:00
|
|
|
before do
|
|
|
|
SiteSetting.discourse_automation_enabled = true
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when saving the form with an error" do
|
|
|
|
it "shows the error correctly" do
|
2024-11-13 10:49:38 +08:00
|
|
|
new_automation_page.visit
|
2024-10-24 02:04:17 +08:00
|
|
|
find(".admin-section-landing__header-filter").set("create a post")
|
|
|
|
find(".admin-section-landing-item", match: :first).click
|
2024-06-26 20:09:26 +08:00
|
|
|
|
2024-11-13 10:49:38 +08:00
|
|
|
automation_page.set_name("aaaaa").set_triggerables("recurring").update
|
2024-06-26 20:09:26 +08:00
|
|
|
|
2024-11-13 10:49:38 +08:00
|
|
|
expect(automation_page).to have_error(
|
2024-06-26 20:09:26 +08:00
|
|
|
I18n.t(
|
|
|
|
"discourse_automation.models.fields.required_field",
|
|
|
|
{ name: "topic", target: "script", target_name: "post" },
|
|
|
|
),
|
|
|
|
)
|
2024-11-13 10:49:38 +08:00
|
|
|
expect(automation_page).to have_name("aaaaa")
|
2024-06-26 20:09:26 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|