2024-06-06 13:18:10 +00:00
|
|
|
# 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
|
|
|
|
|
2024-06-10 19:39:46 +00:00
|
|
|
click_on I18n.t("character_sheet_sections.index.edit")
|
|
|
|
|
2024-06-06 13:18:10 +00:00
|
|
|
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"
|
2024-06-10 19:39:46 +00:00
|
|
|
|
|
|
|
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"
|
2024-06-06 13:18:10 +00:00
|
|
|
end
|
|
|
|
end
|