discourse/spec/system/admin_user_fields_spec.rb
Ted Johansson 7b437c9401
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.
2024-05-23 19:18:25 +08:00

29 lines
791 B
Ruby

# 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