mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
UX: simplify and shorten new script flow for automations (#29178)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "DiscourseAutomation | error", type: :system do
|
||||
describe "DiscourseAutomation | error", type: :system, js: true do
|
||||
fab!(:admin)
|
||||
|
||||
before do
|
||||
@ -10,14 +10,13 @@ describe "DiscourseAutomation | error", type: :system do
|
||||
|
||||
context "when saving the form with an error" do
|
||||
it "shows the error correctly" do
|
||||
visit("/admin/plugins/discourse-automation")
|
||||
visit("/admin/plugins/discourse-automation/new")
|
||||
find(".admin-section-landing__header-filter").set("create a post")
|
||||
find(".admin-section-landing-item", match: :first).click
|
||||
|
||||
find(".new-automation").click
|
||||
fill_in("automation-name", with: "aaaaa")
|
||||
select_kit = PageObjects::Components::SelectKit.new(".scriptables")
|
||||
select_kit.expand
|
||||
select_kit.select_row_by_value("post")
|
||||
find(".create-automation").click
|
||||
expect(page).to have_selector("input[name='automation-name']")
|
||||
|
||||
find('input[name="automation-name"]').set("aaaaa")
|
||||
select_kit = PageObjects::Components::SelectKit.new(".triggerables")
|
||||
select_kit.expand
|
||||
select_kit.select_row_by_value("recurring")
|
||||
@ -29,6 +28,8 @@ describe "DiscourseAutomation | error", type: :system do
|
||||
{ name: "topic", target: "script", target_name: "post" },
|
||||
),
|
||||
)
|
||||
|
||||
expect(find('input[name="automation-name"]').value).to eq("aaaaa")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,11 +10,13 @@ describe "DiscourseAutomation | New automation", type: :system, js: true do
|
||||
|
||||
let(:new_automation_page) { PageObjects::Pages::NewAutomation.new }
|
||||
|
||||
context "when the script is not selected" do
|
||||
it "shows an error" do
|
||||
new_automation_page.visit.fill_name("aaaaa").create
|
||||
context "when a script is clicked" do
|
||||
it "navigates to automation edit route" do
|
||||
new_automation_page.visit
|
||||
|
||||
expect(new_automation_page).to have_error(I18n.t("errors.messages.blank"))
|
||||
find(".admin-section-landing-item__content", match: :first).click
|
||||
|
||||
expect(page).to have_css(".scriptables")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -22,13 +22,9 @@ describe "DiscourseAutomation | smoke test", type: :system, js: true do
|
||||
|
||||
it "populate correctly" do
|
||||
visit("/admin/plugins/discourse-automation")
|
||||
find(".new-automation").click
|
||||
find(".admin-section-landing__header-filter").set("test")
|
||||
find(".admin-section-landing-item__content", match: :first).click
|
||||
fill_in("automation-name", with: "aaaaa")
|
||||
select_kit = PageObjects::Components::SelectKit.new(".scriptables")
|
||||
select_kit.expand
|
||||
select_kit.select_row_by_value("test")
|
||||
find(".create-automation").click
|
||||
|
||||
select_kit = PageObjects::Components::SelectKit.new(".triggerables")
|
||||
select_kit.expand
|
||||
select_kit.select_row_by_value("post_created_edited")
|
||||
@ -40,12 +36,9 @@ describe "DiscourseAutomation | smoke test", type: :system, js: true do
|
||||
it "works" do
|
||||
visit("/admin/plugins/discourse-automation")
|
||||
|
||||
find(".new-automation").click
|
||||
find(".admin-section-landing__header-filter").set("user group membership through badge")
|
||||
find(".admin-section-landing-item__content", match: :first).click
|
||||
fill_in("automation-name", with: "aaaaa")
|
||||
select_kit = PageObjects::Components::SelectKit.new(".scriptables")
|
||||
select_kit.expand
|
||||
select_kit.select_row_by_value("user_group_membership_through_badge")
|
||||
find(".create-automation").click
|
||||
select_kit = PageObjects::Components::SelectKit.new(".triggerables")
|
||||
select_kit.expand
|
||||
select_kit.select_row_by_value("user_first_logged_in")
|
||||
@ -58,6 +51,6 @@ describe "DiscourseAutomation | smoke test", type: :system, js: true do
|
||||
find(".automation-enabled input").click
|
||||
find(".update-automation").click
|
||||
|
||||
expect(page).to have_field("automation-name", with: "aaaaa")
|
||||
expect(page).to have_css('[role="button"]', text: "aaaaa")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user