fluentd-ui/test/integration/dashboard_test.rb
Kenji Okimoto 51e900d98b Add more assertions
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
2018-07-31 09:16:30 +09:00

58 lines
1.3 KiB
Ruby

require "test_helper"
class DashboardTest < ActionDispatch::IntegrationTest
setup do
login_with(FactoryBot.build(:user))
end
test "no configuration" do
visit("/")
within("h1") do
assert_equal("fluentd", text)
end
assert do
find_link(I18n.t('terms.setup', target: 'fluentd'))
end
assert do
find_link(I18n.t('terms.setup', target: 'td-agent'))
end
assert do
!page.has_css?(".fluentd-status")
end
end
test "fluentd is stop" do
stub_daemon(running: false)
visit("/")
assert do
page.has_css?('h1', text: I18n.t('fluentd.show.page_title'))
end
assert do
page.has_css?('h4', text: I18n.t('fluentd.common.stopped'))
end
assert do
page.has_css?('h4', text: I18n.t('fluentd.common.fluentd_info'))
end
assert do
page.has_css?(".fluentd-status .stopped")
end
end
test "fluentd is running" do
stub_daemon(running: true)
visit("/")
assert do
page.has_css?('h1', text: I18n.t('fluentd.show.page_title'))
end
assert do
page.has_css?('h4', text: I18n.t('fluentd.common.running'))
end
assert do
page.has_css?('h4', text: I18n.t('fluentd.common.fluentd_info'))
end
assert do
page.has_css?(".fluentd-status .running")
end
end
end