FEATURE: Implement new required options in admin user fields UI (#27079)

We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
This commit is contained in:
Ted Johansson
2024-05-23 19:18:25 +08:00
committed by GitHub
parent f5e41f0627
commit 7b437c9401
16 changed files with 234 additions and 37 deletions

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
describe "Admin User Fields", type: :system, js: true do
fab!(:current_user) { Fabricate(:admin) }
before { sign_in(current_user) }
let(:user_fields_page) { PageObjects::Pages::AdminUserFields.new }
it "correctly saves user fields" do
user_fields_page.visit
user_fields_page.add_field(name: "Occupation", description: "What you do for work")
expect(user_fields_page).to have_user_field("Occupation")
user_fields_page.refresh
expect(user_fields_page).to have_user_field("Occupation")
end
it "displays an error when missing required fields" do
user_fields_page.visit
user_fields_page.add_field(name: "Occupation", description: "")
expect(user_fields_page).to have_text(/Description can't be blank/)
end
end