OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/support/form_fields/form_field.rb

34 lines
692 B

module FormFields
class FormField
include Capybara::DSL
include RSpec::Matchers
attr_reader :property, :selector
def initialize(property, selector: nil)
@property = property
@selector = selector || "[data-qa-field-name='#{property_name}']"
end
def expect_visible
raise NotImplementedError
end
def expect_required
expect(field_container)
.to have_selector '.op-form-field--label-indicator', text: '*'
end
def field_container
page.find(selector)
end
def property_name
if property.is_a? CustomField
"customField#{property.id}"
else
property.to_s
end
end
end
end