diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index fab452d..e641868 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -4,7 +4,9 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase include ActionView::Helpers::UrlHelper # NOTE: geckodriver installed with Firefox, ignore incompatibility warning - Selenium::WebDriver.logger.ignore(:selenium_manager) + Selenium::WebDriver.logger + .ignore(:selenium_manager, :clear_session_storage, :clear_local_storage) + Capybara.configure do |config| config.save_path = "#{Rails.root}/tmp/screenshots/" end diff --git a/test/fixtures/units.yml b/test/fixtures/units.yml index d580608..6e6ca5b 100644 --- a/test/fixtures/units.yml +++ b/test/fixtures/units.yml @@ -1,40 +1,40 @@ g: user: admin symbol: g - name: gram + description: gram kg: user: admin symbol: kg - name: kilogram + description: kilogram multiplier: 1000 base: g 1: user: admin symbol: 1 - name: one + description: one s: user: admin symbol: s - name: second + description: second percent: user: admin symbol: '%' - name: percent + description: percent multiplier: 0.01 base: 1 µg: user: admin symbol: µg - name: microgram + description: microgram multiplier: 0.000001 base: g mg: user: admin symbol: mg - name: milligram + description: milligram multiplier: 0.001 base: g g_alice: user: alice symbol: g - name: gram + description: gram diff --git a/test/system/units_test.rb b/test/system/units_test.rb index c96127e..67d415b 100644 --- a/test/system/units_test.rb +++ b/test/system/units_test.rb @@ -20,16 +20,17 @@ class UnitsTest < ApplicationSystemTestCase end end + # TODO: extend with add subunit test "add unit" do click_on t('units.index.add_unit') within 'tbody > tr:has(input[type=text], textarea)' do assert_selector ':focus' - maxlength = all(:fillable_field).to_h { |f| [f[:name], f[:maxlength].to_i || 1000] } + maxlength = all(:fillable_field).to_h { |f| [f[:description], f[:maxlength].to_i || 1000] } fill_in 'unit[symbol]', with: SecureRandom.random_symbol(rand([1..15, 15..maxlength['unit[symbol]']].sample)) - fill_in 'unit[name]', - with: [nil, SecureRandom.alphanumeric(rand(1..maxlength['unit[name]']))].sample + fill_in 'unit[description]', + with: [nil, SecureRandom.alphanumeric(rand(1..maxlength['unit[description]']))].sample assert_difference ->{ Unit.count }, 1 do click_on t('helpers.submit.create') end