Relax hard-coded attr names in system specs (#35903)

This commit is contained in:
Matt Jankowski 2025-08-26 04:23:45 -04:00 committed by GitHub
parent 4738a18e52
commit 4f41b7c089
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View File

@ -53,8 +53,8 @@ RSpec.describe 'Filters' do
click_on filter_title
fill_in filter_title_field, with: new_title
fill_in 'custom_filter_keywords_attributes_0_keyword', with: 'New value'
fill_in 'custom_filter_keywords_attributes_1_keyword', with: 'Wilderness'
custom_filter_keywords_fields.first.fill_in with: 'New value'
custom_filter_keywords_fields.last.fill_in with: 'Wilderness'
expect { click_on submit_button }
.to change { keyword_one.reload.keyword }.to(/New value/)
@ -107,6 +107,10 @@ RSpec.describe 'Filters' do
click_on I18n.t('filters.new.save')
end
def custom_filter_keywords_fields
page.all('.keywords-table .custom_filter_keywords_keyword')
end
def filter_title_field
form_label('defaults.title')
end

View File

@ -23,11 +23,11 @@ RSpec.describe 'Profile' do
fill_in 'Display name', with: 'Bob'
fill_in 'Bio', with: 'Bob is silent'
fill_in 'account_fields_attributes_0_name', with: 'Personal Website'
fill_in 'account_fields_attributes_0_value', with: 'https://host.example/personal'
account_fields_labels.first.fill_in with: 'Personal Website'
account_fields_values.first.fill_in with: 'https://host.example/personal'
fill_in 'account_fields_attributes_1_name', with: 'Professional Biography'
fill_in 'account_fields_attributes_1_value', with: 'https://host.example/pro'
account_fields_labels.last.fill_in with: 'Professional Biography'
account_fields_values.last.fill_in with: 'https://host.example/pro'
expect { submit_form }
.to change { bob.account.reload.display_name }.to('Bob')
@ -40,6 +40,14 @@ RSpec.describe 'Profile' do
first('button[type=submit]').click
end
def account_fields_labels
page.all('.account_fields_name input')
end
def account_fields_values
page.all('.account_fields_value input')
end
def change_account_fields
change { bob.account.reload.fields }
.from([])