discourse/spec/system/page_objects/pages/form_template.rb
2023-02-08 11:21:39 -08:00

43 lines
1.1 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class FormTemplate < PageObjects::Pages::Base
# Form Template Index
def has_form_template_table?
page.has_selector?("table.form-templates--table")
end
def click_view_form_template
find(".form-templates--table tr:first-child .btn-view-template").click
end
def has_form_template?(name)
find(".form-templates--table tbody tr td", text: name).present?
end
def has_template_structure?(structure)
find("code", text: structure).present?
end
# Form Template new/edit form related
def type_in_template_name(input)
find(".form-templates--form-name-input").send_keys(input)
self
end
def click_save_button
find(".form-templates--form .footer-buttons .btn-primary").click
end
def click_quick_insert(field_type)
find(".form-templates--form .quick-insert-#{field_type}").click
end
def has_name_value?(name)
find(".form-templates--form-name-input").value == name
end
end
end
end