discourse/spec/system/page_objects/pages/admin_user_fields.rb
Ted Johansson d63f1826fe
FEATURE: User fields required for existing users - Part 2 (#27172)
We want to allow admins to make new required fields apply to existing users. In order for this to work we need to have a way to make those users fill up the fields on their next page load. This is very similar to how adding a 2FA requirement post-fact works. Users will be redirected to a page where they can fill up the remaining required fields, and until they do that they won't be able to do anything else.
2024-06-25 19:32:18 +08:00

33 lines
827 B
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminUserFields < PageObjects::Pages::Base
def visit
page.visit "admin/customize/user_fields"
self
end
def choose_requirement(requirement)
form = page.find(".user-field")
form.choose(I18n.t("admin_js.admin.user_fields.requirement.#{requirement}.title"))
end
def add_field(name: nil, description: nil, requirement: nil, preferences: [])
page.find(".user-fields .btn-primary").click
form = page.find(".user-field")
form.find(".user-field-name").fill_in(with: name)
form.find(".user-field-desc").fill_in(with: description)
form.find(".save").click
end
def has_user_field?(name)
page.has_text?(name)
end
end
end
end