discourse/plugins/automation/spec/system/page_objects/discourse_automation/automation.rb
Alan Guo Xiang Tan f09c8f61c8
DEV: Fix flaky automation system test (#31867)
This commit updates `PageObjects::Pages::Automation#update` to check
that the button is not disabled before clicking the button.

### Reviewer notes

Instances of flakiness:
1.
https://github.com/discourse/discourse/actions/runs/13864294630/job/38801362996
2.
https://github.com/discourse/discourse/actions/runs/13392214535/job/37402368070
2025-03-18 15:13:59 +08:00

41 lines
932 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(name)
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:not([disabled])").click
self
end
def form
@form ||= find(".discourse-automation-edit")
end
end
end
end