tabletop-companion/test/system/character_sheet_test.rb

31 lines
1001 B
Ruby

# frozen_string_literal: true
require "application_system_test_case"
class CharacterSheetTest < ApplicationSystemTestCase
test "can add and remove sections on a character sheet" do
system_sign_in users(:trevor)
character = characters(:nardren)
visit character_path(characters)
click_on I18n.t("characters.show.sheet")
assert_text character.name
click_on I18n.t("character_sheet_sections.index.edit")
click_link(I18n.t("character_sheet_sections.index.add_section"))
fill_in attr_name(CharacterSheetSection, :name), with: "Test Section"
click_button(I18n.t("character_sheet_sections.new.create_section"))
assert_text "Test Section"
click_link(I18n.t("character_sheet_sections.edit_links.delete_section", name: "Test Section"))
accept_confirm
assert_no_text "Test Section"
first(".add-stat").click
fill_in attr_name(Stat, :name), with: "Test Stat"
click_button I18n.t("stats.new.create_stat")
assert_text "Test Stat"
end
end