LocatorAssertions
Specter provides custom expect matchers specifically designed for Unreal Engine. These assertions will automatically poll the engine (retrying until a timeout) until the condition is met, exactly like web Playwright.
Gameplay Ability System (GAS)
Assertions for polling and verifying Gameplay Tags, Attributes, Abilities, and Effects.
expect(actor).toHaveGameplayTag
Usage
await expect(enemy).toHaveGameplayTag("Status.Stunned", { timeout: 10000 });Arguments
tagstringThe Gameplay Tag string (e.g., 'Status.Stunned').optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHaveAnyGameplayTags
Usage
await expect(enemy).toHaveAnyGameplayTags(["Status.Stunned", "Status.Rooted"]);Arguments
tagsstring[]An array of Gameplay Tags.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveAllGameplayTags
Usage
await expect(enemy).toHaveAllGameplayTags(["Status.Stunned", "Status.Burning"]);
// While a 1.25 s taunt lasts: check well inside its duration
await expect(enemy).toHaveAllGameplayTags(["Status.Taunted", "State.BlockAbilities.Q"], { timeout: 500 });Arguments
tagsstring[]An array of Gameplay Tags.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveGameplayTagCount
Usage
await expect(enemy).toHaveGameplayTagCount("Status.Poisoned", 3);Arguments
tagstringThe Gameplay Tag.expectedCountnumberThe expected exact count.
Returns
- Promise<void>
expect(actor).toHaveAttributeValue
Usage
await expect(defender).toHaveAttributeValue("MMAttributeSet", "Health", 10);Arguments
setstringThe Attribute Set class name.attributestringThe specific attribute name.expectedValuenumberThe exact numeric value to wait for.
Returns
- Promise<void>
expect(actor).toHaveAttributeBaseValue
Usage
await expect(defender).toHaveAttributeBaseValue("MMAttributeSet", "MaxHealth", 100);Arguments
setstringThe Attribute Set class name.attributestringThe specific base attribute name.expectedValuenumberThe exact numeric value to wait for.
Returns
- Promise<void>
expect(actor).toHaveAttributeChange
Usage
await expect(defender).toHaveAttributeChange("MMAttributeSet", "Health", {
delta: -attackerDamage,
instigator: attacker,
ability: "Default__GA_Marshmallow_Punch_C"
}, async () => {
await attacker.triggerAbilityByTag("Ability.Attack.Melee");
});Arguments
setstringThe Attribute Set class name.attributestringThe specific attribute name.optionsObjectOptions including { delta?: number, instigator?: ActorLocator, ability?: string }. The instigator matches the change's instigator or its effect causer, so a projectile's damage counts for the actor that fired it and for the projectile itself.actionFunction(optional)An async callback that triggers the attribute change.
Returns
- Promise<void>
expect(actor).toHaveGameplayEffect
Usage
await expect(hero).toHaveGameplayEffect("/Game/Effects/GE_Shield");Arguments
effectClassPathstringThe effect class path.
Returns
- Promise<void>
expect(actor).toHaveGameplayEffectStackCount
Usage
await expect(hero).toHaveGameplayEffectStackCount("/Game/Effects/GE_Bleed", 5);Arguments
effectClassPathstringThe effect class path.expectedCountnumberThe expected stack count.
Returns
- Promise<void>
expect(actor).toHaveGameplayEffectLevel
Usage
await expect(hero).toHaveGameplayEffectLevel("/Game/Effects/GE_Buff", 2);Arguments
effectClassPathstringThe effect class path.expectedLevelnumberThe expected level.
Returns
- Promise<void>
expect(actor).toHaveAppliedGameplayEffect
"GE_Burn", "GE_Burn_C" and "/Game/FX/GE_Burn.GE_Burn_C" all name the same effect, but "GE_Burn" never matches GE_BurnDoT. An application made while the matcher is starting (the usual expectAll([expect(...), apply()]) pattern) is caught, and a lasting effect that's already active also passes. Applications from the 3 seconds before the check count too, so check right after the action that applies the effect.Usage
// Assert an instant damage effect was applied exactly once by Gunner
await expect(knightActor).toHaveAppliedGameplayEffect(
"GE_Gunner_BasicAttack",
{ count: 1, instigator: gunnerActor }
);
// Assert a buff/debuff effect is applied without strict count
await expect(knightActor).toHaveAppliedGameplayEffect("GE_SlowDebuff");
// Assert an effect was NOT applied
await expect(knightActor).not.toHaveAppliedGameplayEffect("GE_Stun");Arguments
effectNameOrClassstringThe Gameplay Effect class name or asset path.optionsObject(optional)Configuration object: { count?: number, instigator?: string | ActorLocator, timeout?: number }. The instigator matches the effect's instigator or its effect causer. On a timeout, the message lists the applications that came close.
Returns
- Promise<void>
expect(actor).toHaveGameplayAbility
Usage
await expect(hero).toHaveGameplayAbility("/Game/Abilities/GA_Dash");Arguments
abilityClassPathstringThe ability class path.optionsObject(optional)Configuration object. Supports { timeout: number }.
Returns
- Promise<void>
expect(actor).toHaveActivatedAbility
"Ability.Slot.Q" matches abilities carrying that tag or a child of it; a class name or path must be the same class ("GA_Dash", "GA_Dash_C" or its full path, never GA_DashStrike). Activations from the 3 seconds before the check count too.Usage
// Assert Gunner's basic attack activates exactly once
await expect(gunnerActor).toHaveActivatedAbility(
"Ability.Slot.BasicAttack.SingleShot",
{ times: 1 }
);
// Inline trigger action with exact count verification
await expect(gunnerActor).toHaveActivatedAbility(
"Ability.Slot.Q",
{ times: 1 },
async () => {
await gunnerActor.pressKey("Q");
}
);Arguments
abilitystringThe ability's gameplay tag, class name, or class path.optionsOrTriggerObject | Function(optional)Configuration object { timeout?: number, times?: number } or trigger action callback.triggerActionFunction(optional)Action callback to execute while listening for ability activations.
Returns
- Promise<void>
expect(actor).toBeExecutingAbility
Usage
await expect(hero).toBeExecutingAbility("/Game/Abilities/GA_Ultimate");Arguments
abilityClassPathstringThe ability class path.
Returns
- Promise<void>
expect(actor).toHaveAbilityCooldown
Usage
await expect(hero).toHaveAbilityCooldown("/Game/Abilities/GA_Dash", { operator: "<=", expectedValue: 0 });Arguments
abilityClassPathstringThe ability class path.optionsObject(optional)Configuration object: { operator?: string, expectedValue?: number, timeout?: number }.
Returns
- Promise<void>
expectAll
Usage
import { expectAll } from "@specter-automation/test";
// Atomically verify state across multiple actors and systems
await expectAll([
expect(knightActor).toHaveAttributeValue("HealthSet", "Health", 2000),
expect(knightActor).toHaveActiveGameplayEffect("GE_ShieldBuff"),
expect(gunnerActor).toHaveGameplayTag("Cooldown.Ability.Q"),
]);Arguments
assertionsPromise<void>[]An array of Specter expect assertion promises to evaluate concurrently.
Returns
- Promise<void>
Movement & Spatial
Assertions for positioning, physics, and character movement tests.
expect(actor).toBeFalling
Usage
await expect(enemy).toBeFalling();Returns
- Promise<void>
expect(actor).toBeCrouching
Usage
await expect(player).toBeCrouching();Returns
- Promise<void>
expect(actor).toBeFlying
Usage
await expect(drone).toBeFlying();Returns
- Promise<void>
expect(actor).toBeSwimming
Usage
await expect(player).toBeSwimming();Arguments
optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toBeMovingOnGround
Usage
const hero = await world.spawnActor('BP_Hero', { location: { x: 0, y: 0, z: 300 } });
await expect(hero).toBeMovingOnGround();Arguments
optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveMovementMode
Usage
await hero.callFunction('SetMovementMode', { NewMovementMode: 'MOVE_Flying' });
await expect(hero).toHaveMovementMode('Flying');Arguments
expectedModestring'Walking', 'NavWalking', 'Falling', 'Swimming', 'Flying', 'Custom' or 'None'.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveVelocity
Usage
// Pass if speed >= 600 cm/s
await expect(playerActor).toHaveVelocity(600);
// Pass if specific bone is moving with high velocity
await expect(playerActor).toHaveVelocity(1200, { boneName: 'weapon_r', operator: '>=' });Arguments
expectedSpeednumberThe target speed threshold in Unreal Engine units (cm/s).optionsObject(optional)operator'>' | '<' | '>=' | '<=' | '==='(optional)Defaults to'>='Comparison operator to evaluate actual physics speed against expectedSpeed.boneNamestring(optional)Specific bone or body instance name to query velocity for (e.g. 'hand_r'). Defaults to root primitive component.timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeWithinDistance
Usage
await expect(enemy).toBeWithinDistance(world.actor('Player'), 200);
await expect(drone).toBeWithinDistance({ x: 0, y: 0, z: 500 }, 100, { planar: false });Arguments
targetActorLocator | Vector3 | stringAn actor locator, a world location { x, y, z? }, or an actor's name.distancenumberThe maximum distance allowed, in Unreal units (cm).optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds.planarboolean(optional)Defaults totrueMeasure in 2D (ignoring height). False measures in 3D.
Returns
- Promise<void>
expect(actor).toHaveMovedFurtherThan
Usage
const startPos = await enemy.getLocation();
await world.console('cheat knockback');
await expect(enemy).toHaveMovedFurtherThan(startPos, 500, { timeout: 8000 });
// Thrown into the air, measured on height alone
await expect(enemy).toHaveMovedFurtherThan(startPos, 100, 'z');Arguments
startPosVector3The starting 3D coordinate.distancenumberThe minimum distance in Unreal Units (cm) the actor must have moved.axis'x' | 'y' | 'z' | 'xy' | 'xyz'(optional)Defaults to'xyz'Which components of the movement to measure. Can also be passed as options.axis.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds.
Returns
- Promise<void>
expect(actor).toHaveLocation
Usage
await expect(enemy).toHaveLocation({ x: 100, y: 200, z: 0 }, 10.0, { timeout: 8000 });Arguments
expectedLocationVector3The expected {x, y, z} world coordinate.tolerancenumber(optional)Defaults to5.0The maximum acceptable distance from the target in cm.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
Animation & Montages
Assertions for testing attack hitboxes or ability timings.
There are no animation or montage matchers yet. In the meantime, read the state your animation Blueprint or ability exposes with getPropertyValue or callFunction, and retry with Playwright's expect.poll.
AI & Behavior Trees
Assertions for enemy decision-making, blackboard values, line of sight, and pathfinding navigation.
expect(aiController).toBeRunningBehaviorTree
Usage
await expect(aiCon).toBeRunningBehaviorTree("BT_Zombie");
await expect(aiCon).toBeRunningBehaviorTree("/Game/AI/BT_Zombie.BT_Zombie");Arguments
treePathstringThe behavior tree's asset name or full path.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(aiController).toHaveBlackboardValue
Usage
await expect(aiCon).toHaveBlackboardValue("TargetActor", world.actor('Player'));Arguments
keyNamestringThe blackboard key name.expectedValueanyThe expected value for the key.
Returns
- Promise<void>
expect(aiController).toHaveLineOfSightTo
Usage
await expect(aiCon).toHaveLineOfSightTo(world.actor('Player'));Arguments
otherActorLocatorActorLocatorThe locator of the target actor.
Returns
- Promise<void>
Behavior Tree & StateTree states
These read the AI trail, which Specter records for every AI from the start of the test. They work on an AI controller, the pawn it possesses, or an actor running its own StateTree. State names match whole and ignore case. When they fail, the message shows where the logic was and its recent changes.
expect(actor).toBeInState
Usage
// A StateTree minion: Root › Combat › Attack
await expect(minion).toBeInState('Combat');
await expect(minion).toBeInState('Attack', { timeout: 8000 });Arguments
stateNamestringA StateTree state or behavior tree node name, e.g. 'Combat' or 'Attack'.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveVisitedState
Usage
await expect(tower).toHaveVisitedState('Attack');
await expect(minion).not.toHaveVisitedState('Retreat');Arguments
stateNamestringA StateTree state or behavior tree node name.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveBlackboardChange
Usage
// The tower picked the intruder as its target, then dropped it
await expect(tower).toHaveBlackboardChange('Target', { to: intruder });
await expect(tower).toHaveBlackboardChange('Target', { from: intruder, to: 'None' });Arguments
keyNamestringThe blackboard key (case-insensitive).optionsObject(optional)Configuration object: { to?, from?, timeout?: number }. to / from: text (case-insensitive), a RegExp, a number, a boolean, or an actor locator (matched by its name).
Returns
- Promise<void>
expect(actor).toHaveAIState
Usage
await expect(guard).toHaveAIState('Patrolling');
await expect(guard).toHaveAIState('Chase', { keyName: 'Mode' });Arguments
expectedStatestringThe expected state, e.g. 'Attacking'.optionsObject(optional)Configuration object: { keyName?: string (default 'AIState'), timeout?: number }.
Returns
- Promise<void>
Pursuit & movement relative to a target
Each retries until the timeout. A failure reports the speed, the distance and how well the movement lines up with the target.
expect(actor).toBeMovingTowards
Usage
await expect(minion).toBeMovingTowards(enemyTower);Arguments
targetActorLocator | Vector3 | stringAn actor locator, a world location { x, y, z? }, or an actor's name.optionsObject(optional)Configuration object: { minSpeed?: number (default 10 u/s), threshold?: number (how closely the velocity must point at the target, as a dot product; default 0.3), timeout?: number }.
Returns
- Promise<void>
expect(actor).toBeMovingAwayFrom
Usage
await expect(lowHealthEnemy).toBeMovingAwayFrom(player);Arguments
targetActorLocator | Vector3 | stringAn actor locator, a world location { x, y, z? }, or an actor's name.optionsObject(optional)Configuration object: { minSpeed?: number (default 10 u/s), threshold?: number (default 0.3), timeout?: number }.
Returns
- Promise<void>
expect(actor).toBeFollowing
Usage
await expect(companion).toBeFollowing(player, { maxDistance: 800 });Arguments
targetActorLocator | stringThe actor being followed, as a locator or a name.optionsObject(optional)Configuration object: { maxDistance?: number, timeout?: number }.
Returns
- Promise<void>
Camera & FOV
Assertions for camera field of view, camera shakes, and view targets.
expect(actor).toHaveCameraFOV
Usage
await expect(player).toHaveCameraFOV(90, { tolerance: 1.0 });Arguments
expectedFOVnumberThe expected FOV angle in degrees.optionsObject(optional)tolerancenumber(optional)Defaults to0.5Allowed deviation in FOV degrees before failing assertion.timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeCameraShaking
Usage
// Assert camera is shaking after explosion
await expect(player).toBeCameraShaking();
// Assert camera is NOT shaking after it subsides
await expect(player).not.toBeCameraShaking();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHaveCameraViewTarget
Usage
await expect(player).toHaveCameraViewTarget('BP_PlayerCharacter');Arguments
actorNamestringThe expected name of the camera's view target actor.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
Animation
Specter records what every skeletal mesh's animations do from the start of each test: montages starting and ending, the sections they go through, and the anim notifies that fire. So a check can ask about a montage that was over before the test looked. Failures list what plays now and the last montages, sections and notifies. Montages match by name or path; notifies by the name given in the animation or by their class (AnimNotify_PlaySound or PlaySound). Branching-point notifies aren't recorded.
expect(actor).toBePlayingMontage
Usage
await expect(hero).toBePlayingMontage('AM_Stunned');
await expect(hero).toBePlayingMontage('AM_Combo', { section: 'Swing2' });Arguments
montagestringThe montage's name ('AM_Attack') or asset path.optionsObject(optional)Configuration object: { section?: string, timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHaveMontageSection
Usage
await expect(hero).toHaveMontageSection('Recovery', { montage: 'AM_Combo' });Arguments
sectionstringThe section name (any case).optionsObject(optional)Configuration object: { montage?: string, timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(actor).toHavePlayedMontage
Usage
await hero.click();
await expect(hero).toHavePlayedMontage('AM_Cast');
await expect(dummy).toHavePlayedMontage('AM_HitReact', { times: 1 });Arguments
montagestringThe montage's name or asset path.optionsObject(optional)Configuration object: { times?: number (exactly this many; default at least once), since?: number (seconds on the test clock, from animClock()), timeout?: number }.
Returns
- Promise<void>
expect(actor).toHaveFiredAnimNotify
Usage
await expect(hero).toHaveFiredAnimNotify('HitFrame', { from: 'AM_Swing', times: 1 });
// Nothing from here on
const now = await hero.animClock();
await expect(hero).not.toHaveFiredAnimNotify('Footstep', { since: now });Arguments
notifystringThe notify's name in the animation, or its class ('AnimNotify_PlaySound' or 'PlaySound').optionsObject(optional)Configuration object: { from?: string (only notifies from this montage or sequence), times?: number, since?: number, timeout?: number }.
Returns
- Promise<void>
Controller & Possession
Assertions for verifying Pawn possession, player vs AI control, and local client ownership.
expect(actor).toBePossessed
Usage
// Assert minion is possessed
await expect(minion).toBePossessed();
// Assert vehicle is currently unpossessed / empty
await expect(emptyCar).not.toBePossessed();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBePlayerControlled
Usage
// Assert hero is driven by a real player
await expect(playerMarshmallow).toBePlayerControlled();
// Assert minion is driven by AI, not a human player
await expect(aiMinion).not.toBePlayerControlled();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeLocallyControlled
Usage
// Assert pawn belongs to the active client connection
await expect(localPlayer).toBeLocallyControlled();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHaveController
Usage
// Assert attached to specific AI controller class
await expect(boss).toHaveController("BP_BossAIController");
// Assert attached to player controller
await expect(player).toHaveController("BP_MarshmallowPlayerController");
// Verify any controller is attached
await expect(pawn).toHaveController();Arguments
expectedClassstring(optional)The expected Controller class name or substring (e.g. 'BP_BossAIController'). If omitted, checks for any attached controller.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
Team System
Assertions for the Generic Team Agent Interface.
expect(actor).toHaveTeamId
Usage
await expect(player).toHaveTeamId(0);
await expect(spectator).not.toHaveTeamId(1);Arguments
expectedTeamIdnumberThe expected team ID (255 = NoTeam).optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeHostileTowards
Usage
await expect(player).toBeHostileTowards(enemy);
await expect(player).not.toBeHostileTowards(ally);Arguments
otherActorActorLocatorThe other actor to evaluate attitude towards.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
State & Rendering
expect(actor).toHaveCount
Usage
await expect(world.actor('BP_Minion')).toHaveCount(5);Arguments
expectedCountnumberThe expected number of matching elements.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeVisible
Usage
await expect(world.actor('BP_Minion_Range')).toBeVisible({ onScreen: true, timeout: 10000 });Arguments
optionsObject(optional)onScreenboolean(optional)Defaults tofalseWhen true, strictly requires the actor's bounding geometry to be visible inside the viewport camera frustum.timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeInViewport
Usage
await expect(enemy).toBeInViewport();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeDestroyed
Usage
// Assert actor is destroyed after lethal damage
await expect(enemyTower).toBeDestroyed();
// Assert actor has NOT been destroyed
await expect(player).not.toBeDestroyed();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeNiagaraActive
Usage
await expect(explosionEffect).toBeNiagaraActive();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHaveNiagaraAsset
Usage
await expect(fireVFX).toHaveNiagaraAsset("NS_Fire_Loop");Arguments
expectedAssetstringThe expected Niagara system asset path substring.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBeAudioPlaying
Usage
await expect(footstepAudio).toBeAudioPlaying();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHaveSoundAsset
Usage
await expect(bgmAudio).toHaveSoundAsset("SoundWave_BossTheme");Arguments
expectedSoundstringThe expected sound asset path or name substring.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBePhysicsSimulating
Usage
await expect(deadEnemy).toBePhysicsSimulating({ boneName: "pelvis" });Arguments
optionsObject(optional)boneNamestring(optional)Specific bone/body instance name to query physics simulation on (e.g. 'pelvis').timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toBePhysicsAsleep
Usage
await expect(crate).toBePhysicsAsleep();Arguments
optionsObject(optional)boneNamestring(optional)Specific bone/body instance name to check sleep state on.timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
Enhanced Input (UE5)
Assertions for verifying active Input Mapping Contexts and Input Action values.
expect(actor).toHaveInputMappingContext
Usage
await expect(player).toHaveInputMappingContext("IMC_DefaultPlayer");Arguments
contextNameOrPathstringThe IMC asset name or path.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHaveInputActionValue
Usage
await expect(player).toHaveInputActionValue("IA_Sprint", true);Arguments
actionNameOrPathstringThe Input Action name or path.expectedValueanyThe expected action value (boolean, float, or Vector3).optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(actor).toHavePlayerScore
Usage
await expect(player).toHavePlayerScore(100, { operator: ">=" });Arguments
expectedScorenumberThe expected score threshold.optionsObject(optional)operator'>' | '<' | '>=' | '<=' | '==='(optional)Defaults to'>='Comparison operator to evaluate actual score against expectedScore.timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
UI & Widgets
Assertions for validating player HUDs or Menus.
expect(widget).toBeVisible
Not visible because 'WBP_PauseMenu' above it is Collapsed.Usage
const modal = world.widget("ConfirmPurchaseModal");
await expect(modal).toBeVisible();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(widget).toBeEnabled
Usage
const submitBtn = world.widget("SubmitButton");
await expect(submitBtn).toBeEnabled();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(widget).toBeDisabled
Usage
// Not enough gold yet
await expect(world.widget("BuyButton")).toBeDisabled();Arguments
optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(widget).toOverlap
Usage
const placementBar = world.getByWidget("WBP_PlacementBar");
const toolbar = world.getByWidget("WBP_MainToolbar");
// These two must never cover each other
await expect(placementBar).not.toOverlap(toolbar);
// Nothing on screen may be under it, except the backdrop it's designed to sit on
await expect(placementBar).not.toOverlap({ ignore: ["WBP_Backdrop", /Vignette/] });
// A shadow or rounded corner touching is fine: only fail past 5% of the smaller widget
await expect(placementBar).not.toOverlap(toolbar, { threshold: 5 });Arguments
otherWidgetLocator(optional)The widget to compare with. Leave it out to check against everything on screen.optionsOverlapOptions(optional)thresholdnumber(optional)Defaults to0How much of the smaller widget must be covered to count as overlapping, in percent. 0 counts any overlap.ignoreArray<string | RegExp>(optional)With no other widget: names, classes or owning Widget Blueprints that are meant to be underneath, such as a background or a vignette.timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(widget).toHaveText
Usage
const title = world.widget("HeaderTitle");
await expect(title).toHaveText("Main Menu");Arguments
expectedTextstring | RegExpThe exact expected text string or RegExp pattern.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(widget).toContainText
Usage
const subtitle = world.widget("WBP_Modal").getChild("SubtitleText");
await expect(subtitle).toContainText("cannot be undone");Arguments
substringstringThe substring to search for within the widget text.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
expect(widget).toHaveValue
Usage
const usernameInput = world.widget("WBP_Login").getChild("UsernameInput");
await expect(usernameInput).toHaveValue("Player1");Arguments
expectedValuestringThe expected input string value.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
Returns
- Promise<void>
Materials & Visuals
Assertions for verifying Material assignments, Dynamic Material Instances (MIDs), and polling material scalar, vector, and texture parameters. Supported on both Actors and UMG Widgets.
expect(locator).toHaveMaterialScalarParameter
Usage
await expect(healthImage).toHaveMaterialScalarParameter('Percent', 0.5, { operator: '<=' });Arguments
parameterNamestringThe name of the scalar parameter in the material.expectedValuenumberThe expected float value.optionsObject(optional)operator'>' | '<' | '>=' | '<=' | '===' | '!='(optional)Defaults to'==='The logical operator to evaluate.tolerancenumber(optional)Defaults to0.001Epsilon tolerance for floating point comparisons.slotIndexnumber(optional)Defaults to0The material slot index to inspect.componentNamestring(optional)If inspecting an Actor, the specific primitive component name to query. If omitted, uses the root mesh.timeoutnumber(optional)Defaults to5000Time to retry the assertion in milliseconds.
Returns
- Promise<void>
expect(locator).toHaveMaterialVectorParameter
Usage
await expect(shield).toHaveMaterialVectorParameter('GlowColor', '#00FFCC');Arguments
parameterNamestringThe name of the vector parameter in the material.expectedColorstring | number[] | {r,g,b,a?}The expected color (e.g. '#FF0000', [1,0,0,1], {r:1,g:0,b:0}).optionsObject(optional)tolerancenumber(optional)Defaults to0.01Epsilon tolerance for per-channel float comparisons.slotIndexnumber(optional)Defaults to0The material slot index.componentNamestring(optional)timeoutnumber(optional)Defaults to5000
Returns
- Promise<void>
expect(locator).toHaveMaterial
Usage
await expect(terrain).toHaveMaterial('M_Snow');Arguments
expectedMaterialstring | RegExpThe name of the material to expect (e.g. 'M_Frozen_Ice' or /^M_Hero_/).optionsObject(optional)slotIndexnumber(optional)Defaults to0componentNamestring(optional)timeoutnumber(optional)Defaults to5000
Returns
- Promise<void>
expect(locator).toBeDynamicMaterial
Usage
await expect(healthBarImage).toBeDynamicMaterial();Arguments
optionsObject(optional)slotIndexnumber(optional)Defaults to0componentNamestring(optional)timeoutnumber(optional)Defaults to5000
Returns
- Promise<void>
expect(locator).toHaveMaterialTextureParameter
Usage
await expect(emblem).toHaveMaterialTextureParameter('Icon', 'T_Skull');Arguments
parameterNamestringThe name of the texture parameter.expectedTexturestring | RegExpThe expected texture name.optionsObject(optional)slotIndexnumber(optional)Defaults to0componentNamestring(optional)timeoutnumber(optional)Defaults to5000
Returns
- Promise<void>
Visual Assertions
Perceptual pixel comparison assertions integrated directly with Playwright snapshot testing (__snapshots__). Catch broken shaders, missing models, animation pops, and VFX glitches that functional logic tests miss.
expect(world).toMatchScreenshot
Usage
// Wait for impact visual and assert against golden snapshot
await expect(world).toMatchScreenshot("knight_shield_rush_impact.png", {
threshold: 0.15, // 15% color perception threshold
maxDiffPixelRatio: 0.02, // Allow up to 2% differing pixels
showUI: false, // Ignore HUD/UMG overlays
timeout: 2000, // Retries until visual stabilizes
});Arguments
snapshotNamestringThe name of the snapshot file (e.g. 'knight_shield_rush_impact.png').optionsObject(optional)thresholdnumber(optional)Defaults to0.2Perceptual color difference threshold between 0 (strict) and 1 (lenient).maxDiffPixelRationumber(optional)Acceptable ratio of differing pixels between 0 and 1 (e.g. 0.02 for 2%).maxDiffPixelsnumber(optional)Absolute maximum count of differing pixels allowed.showUIboolean(optional)Defaults tofalseWhether to include Slate/UMG viewport overlays in the capture.timeoutnumber(optional)Defaults to5000Time in milliseconds to poll and retry for visual stabilization.
Returns
- Promise<void>
Navigation, Streaming and Memory
Checks on the level as a whole: can every place still be reached, does the world load in time around the player, and does the game stay within its memory budgets.
expect(actor).toBeAbleToReach
Usage
// Level design: every spawn can still reach every objective
for (const spawn of ['PlayerStart_Red', 'PlayerStart_Blue']) {
await expect(world.actor(spawn)).toBeAbleToReach([flagA, flagB, world.actor('Boss_Arena')]);
}
await expect(hero).toBeAbleToReach({ x: 1200, y: -300, z: 0 }, { maxLength: 5000 });
// Same place, different weights: extras go around the caution tape, the stunt double doesn't care
await expect(extra).toBeAbleToReach(craftTable, { avoiding: ['CautionTape'] });
await expect(stuntDouble).not.toBeAbleToReach(craftTable, { avoiding: ['CautionTape'] });Arguments
targetsLocator | Vector3 | ArrayOne target or several: actors or locations.optionsObject(optional)Configuration object: { maxLength?: number (cm), maxCost?: number, avoiding?: string[] (nav areas, e.g. 'Obstacle' or 'NavArea_CautionTape'), filter?: string (a query filter class name or path; default: the agent's AI controller's), agent?: Locator (a pawn whose size picks the navmesh; default: this actor when it's a pawn), timeout?: number (default 5000 ms) }.
Returns
- Promise<void>
expect(world).toFinishStreaming
Usage
await hero.setLocation(farCorner);
await expect(world).toFinishStreaming({ at: farCorner, within: 3000 });Arguments
optionsObject(optional)Configuration object: { within?: number (ms, default 10000), at?: Vector3, radius?: number (cm; default the grid's loading range), state?: 'activated' | 'loaded' }.
Returns
- Promise<void>
expect(world).toUseLessMemoryThan
Usage
await expect(world).toUseLessMemoryThan('6 GB');Arguments
budgetnumber | stringMB, or '512 MB' / '6 GB'.optionsObject(optional)Configuration object: { measure?: 'peak' | 'now' }.
Returns
- Promise<void>
expect(world).toKeepTexturesInBudget
Usage
await expect(world).toKeepTexturesInBudget();Arguments
optionsObject(optional)Configuration object: { toleranceMB?: number } (default 0).
Returns
- Promise<void>
Performance Budget Assertions
Enforce FPS thresholds, frame time spike ceilings, and memory consumption guardrails directly in CI gameplay tests.
expect(world).toMaintainPerformanceBudget
world, samples engine performance for a time window and checks every limit in the budget. On a capture from world.measurePerformance(), checks the budget against every frame it recorded (minimum and average FPS, the slowest frame, peak memory).Usage
// Sample for 5 s while the ultimate's effects play
await expect(world).toMaintainPerformanceBudget({
minFps: 60,
maxFrameTimeMs: 16.6,
maxMemoryMb: 4096,
sampleDurationMs: 5000,
});
// Or check a whole measurement
const perf = await world.measurePerformance(() => hero.triggerAbilityByTag('Ability.Slot.R'));
await expect(perf).toMaintainPerformanceBudget({ avgFps: 60, maxFrameTimeMs: 33 });Arguments
budgetObject{ minFps?: number, avgFps?: number, maxFrameTimeMs?: number, maxMemoryMb?: number, sampleDurationMs?: number (default 1000), sampleIntervalMs?: number (default 100) }. The sample options apply to world only.
Returns
- Promise<void>
expect(world).toHaveFPS
Usage
// Assert viewport maintains at least 60 FPS
await expect(world).toHaveFPS(60, { operator: ">=" });Arguments
expectedFpsnumberTarget frame rate threshold in frames per second.optionsObject(optional)Configuration object: { operator?: '>=' | '<=' | '>' | '<' | '===', timeout?: number }.
Returns
- Promise<void>
expect(world).toHaveFrameTimeBelow
Usage
// Catch hitches and frame spikes exceeding 16.6ms
await expect(world).toHaveFrameTimeBelow(16.6);Arguments
maxFrameTimeMsnumberMaximum allowable frame time in milliseconds (e.g. 16.6ms for 60 FPS, 33.3ms for 30 FPS).optionsObject(optional)Configuration object with timeout.
Returns
- Promise<void>
expect(world).toHaveMinFPS
Usage
await expect(world).toHaveMinFPS(30);Arguments
minFpsnumberThe lowest acceptable frame rate.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
expect(world).toHaveMemoryBelow
Usage
await expect(world).toHaveMemoryBelow(4096);Arguments
maxMemoryMbnumberThe memory ceiling in MB.optionsObject(optional)Configuration object: { timeout?: number } (default 5000 ms).
Returns
- Promise<void>
Checks on a performance capture
These check what world.measurePerformance() recorded: every frame of the measured action, not a single reading. They check once (no retrying), and a failure lists the slowest hitches with what happened in the game around each.
expect(capture).toHaveFrameTimeP95Below
Usage
await expect(perf).toHaveFrameTimeP95Below(20);Arguments
maxMsnumberFrame time ceiling in ms.
Returns
- Promise<void>
expect(capture).toHaveFrameTimeP99Below
Usage
await expect(perf).toHaveFrameTimeP99Below(33);Arguments
maxMsnumberFrame time ceiling in ms.
Returns
- Promise<void>
expect(capture).toHaveAverageFrameTimeBelow
Usage
await expect(perf).toHaveAverageFrameTimeBelow(16.7);Arguments
maxMsnumberAverage frame time ceiling in ms.
Returns
- Promise<void>
expect(capture).toHaveAverageFPSAbove
Usage
await expect(perf).toHaveAverageFPSAbove(60);Arguments
minFpsnumberLowest acceptable average FPS.
Returns
- Promise<void>
expect(capture).toHaveOnePercentLowFPSAbove
Usage
await expect(perf).toHaveOnePercentLowFPSAbove(45);Arguments
minFpsnumberLowest acceptable 1% low FPS.
Returns
- Promise<void>
expect(capture).toHaveNoHitchesOver
Usage
await expect(perf).toHaveNoHitchesOver(50);
await expect(perf).toHaveNoHitchesOver(33, { allowed: 2 });Arguments
maxMsnumberThe longest acceptable frame in ms.optionsObject(optional){ allowed?: number } frames over the limit that are tolerated (default 0).
Returns
- Promise<void>
expect(capture).toHavePeakMemoryBelow
Usage
await expect(perf).toHavePeakMemoryBelow(4096);Arguments
maxMbnumberMemory ceiling in MB.
Returns
- Promise<void>
expect(capture).toHaveMemoryGrowthBelow
Usage
await expect(perf).toHaveMemoryGrowthBelow(50);Arguments
maxMbnumberAllowed growth in MB.
Returns
- Promise<void>
expect(capture).toHaveDrawCallsBelow
Usage
await expect(perf).toHaveDrawCallsBelow(2000);
await expect(perf).toHaveDrawCallsBelow(3500, { stat: 'max' });Arguments
maxDrawCallsnumberDraw call ceiling.optionsObject(optional){ stat?: 'avg' | 'max' } (default 'avg').
Returns
- Promise<void>