forked from fixin.me/fixin.me
Update tests to new schema
This commit is contained in:
parent
a18f257378
commit
40808639cc
@ -4,7 +4,9 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
|||||||
include ActionView::Helpers::UrlHelper
|
include ActionView::Helpers::UrlHelper
|
||||||
|
|
||||||
# NOTE: geckodriver installed with Firefox, ignore incompatibility warning
|
# 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|
|
Capybara.configure do |config|
|
||||||
config.save_path = "#{Rails.root}/tmp/screenshots/"
|
config.save_path = "#{Rails.root}/tmp/screenshots/"
|
||||||
end
|
end
|
||||||
|
16
test/fixtures/units.yml
vendored
16
test/fixtures/units.yml
vendored
@ -1,40 +1,40 @@
|
|||||||
g:
|
g:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: g
|
symbol: g
|
||||||
name: gram
|
description: gram
|
||||||
kg:
|
kg:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: kg
|
symbol: kg
|
||||||
name: kilogram
|
description: kilogram
|
||||||
multiplier: 1000
|
multiplier: 1000
|
||||||
base: g
|
base: g
|
||||||
1:
|
1:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: 1
|
symbol: 1
|
||||||
name: one
|
description: one
|
||||||
s:
|
s:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: s
|
symbol: s
|
||||||
name: second
|
description: second
|
||||||
percent:
|
percent:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: '%'
|
symbol: '%'
|
||||||
name: percent
|
description: percent
|
||||||
multiplier: 0.01
|
multiplier: 0.01
|
||||||
base: 1
|
base: 1
|
||||||
µg:
|
µg:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: µg
|
symbol: µg
|
||||||
name: microgram
|
description: microgram
|
||||||
multiplier: 0.000001
|
multiplier: 0.000001
|
||||||
base: g
|
base: g
|
||||||
mg:
|
mg:
|
||||||
user: admin
|
user: admin
|
||||||
symbol: mg
|
symbol: mg
|
||||||
name: milligram
|
description: milligram
|
||||||
multiplier: 0.001
|
multiplier: 0.001
|
||||||
base: g
|
base: g
|
||||||
g_alice:
|
g_alice:
|
||||||
user: alice
|
user: alice
|
||||||
symbol: g
|
symbol: g
|
||||||
name: gram
|
description: gram
|
||||||
|
@ -20,16 +20,17 @@ class UnitsTest < ApplicationSystemTestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: extend with add subunit
|
||||||
test "add unit" do
|
test "add unit" do
|
||||||
click_on t('units.index.add_unit')
|
click_on t('units.index.add_unit')
|
||||||
|
|
||||||
within 'tbody > tr:has(input[type=text], textarea)' do
|
within 'tbody > tr:has(input[type=text], textarea)' do
|
||||||
assert_selector ':focus'
|
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]',
|
fill_in 'unit[symbol]',
|
||||||
with: SecureRandom.random_symbol(rand([1..15, 15..maxlength['unit[symbol]']].sample))
|
with: SecureRandom.random_symbol(rand([1..15, 15..maxlength['unit[symbol]']].sample))
|
||||||
fill_in 'unit[name]',
|
fill_in 'unit[description]',
|
||||||
with: [nil, SecureRandom.alphanumeric(rand(1..maxlength['unit[name]']))].sample
|
with: [nil, SecureRandom.alphanumeric(rand(1..maxlength['unit[description]']))].sample
|
||||||
assert_difference ->{ Unit.count }, 1 do
|
assert_difference ->{ Unit.count }, 1 do
|
||||||
click_on t('helpers.submit.create')
|
click_on t('helpers.submit.create')
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user