Class CharacterScreenUiTests
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
Spec (positive behaviour) tests for the Character screen: these describe what the UI is supposed to do for a player, independent of any past bug. Prefer this style - a test that states the intended behaviour keeps its value after every rewrite, whereas a regression test that guards one past mistake can be deleted once the cause is gone.
Setup uses backdoors (handing out a stat point, opening the panel through the game's own entry point); the behaviour under test - spending a stat point - is done the way a player does it: by clicking the "+" that sits next to the "Strength" label. LevelAndStatsTests covers where the points come from in the first place.
public class CharacterScreenUiTests : DevTest
- Inheritance
-
objectCharacterScreenUiTests
- Inherited Members
Properties
- NeedsFreshUi
True for a test that reads the OneJS UI, which makes the runner reload the whole UI before it. That reload is the only reset that reaches the state a panel keeps while it stays mounted but hidden - the Character screen's selected tab, for instance, which made two CharacterScreenUiTests fail with "Timeout waiting for 'Strength' visible" after the tab had been picked by hand before the run.
Opt-in because it is not free: measured 2026-09-16, reloading before every test left 888 s of a 1194 s suite outside the test bodies (against 119 s in the 358 s run without it), roughly 8,5 s per test. Only the tests that actually read the UI pay that.
Methods
- CharacterScreen_AllocateStrength_SpendsOnePointAndRaisesStat()
A player levels up, opens the Character screen and spends one point on Strength. The stat goes up by exactly one and the point pool goes down by exactly one.
- CharacterScreen_AllocateWithNoPoints_ChangesNothing()
The "+" must be inert with an empty point pool - a player with no points left must not be able to spend anything by clicking it.