discourse/plugins/automation/spec/system/page_objects/discourse_automation/automation.rb
Gary Pendergast f439bf14cc
DEV: Refactor the Automation Plugin UI to match admin UI guidelines (#31060)
This change updates the Automation plugin to make use of the `use_new_show_route` plugin flag, as well as generally updating the UI to match current admin UI guidelines. Notable changes include:

- Moving template/router/controller files to make use of the `admin.adminPlugins.show` route.
- Changing the URIs from `/admin/plugins/discourse-automation` to `/admin/plugins/automation`, to match the `PLUGIN_NAME`.
- Adding UI wrappers around the New/Edit forms, and polishing the list of defined automations.
2025-02-05 14:34:15 +11:00

41 lines
919 B
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class Automation < PageObjects::Pages::Base
def visit(automation)
super("/admin/plugins/automation/automation/#{automation.id}")
self
end
def set_name(name)
form.find('input[name="automation-name"]').set("aaaaa")
self
end
def has_error?(message)
form.has_content?(message)
end
def has_name?(name)
form.find_field("automation-name", with: name)
end
def set_triggerables(triggerable)
select_kit = PageObjects::Components::SelectKit.new(".triggerables")
select_kit.expand
select_kit.select_row_by_value(triggerable)
self
end
def update
form.find(".update-automation").click
self
end
def form
@form ||= find(".discourse-automation-edit")
end
end
end
end