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.
Returns
- Promise<void>
expect(actor).toHaveAllGameplayTags
Usage
await expect(enemy).toHaveAllGameplayTags(["Status.Stunned", "Status.Burning"]);Arguments
tagsstring[]An array of Gameplay Tags.
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 }.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
Usage
// Assert an instant damage effect was applied exactly once by Howitzer
await expect(steelActor).toHaveAppliedGameplayEffect(
"GE_Howitzer_BasicAttack",
{ count: 1, instigator: howitzerActor }
);
// Assert a buff/debuff effect is applied without strict count
await expect(steelActor).toHaveAppliedGameplayEffect("GE_SlowDebuff");
// Assert an effect was NOT applied
await expect(steelActor).not.toHaveAppliedGameplayEffect("GE_Stun");Arguments
effectNameOrClassstringThe Gameplay Effect class name, asset path, or tag.optionsObject(optional)Configuration object: { count?: number, instigator?: string | ActorLocator, timeout?: number }.
Returns
- Promise<void>
expect(actor).toHaveActiveGameplayEffect
Usage
// Assert an active shield buff with exact 3 stacks
await expect(steelActor).toHaveActiveGameplayEffect("GE_ShieldBuff", {
stacks: 3,
level: 1,
});Arguments
effectClassPathstringThe Gameplay Effect class name or asset path.optionsObject(optional)Configuration object: { stacks?: number, level?: number, timeout?: number }.
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
Usage
// Assert Howitzer's basic attack activates exactly once
await expect(howitzerActor).toHaveActivatedAbility(
"Ability.Slot.BasicAttack.SingleShot",
{ times: 1 }
);
// Inline trigger action with exact count verification
await expect(howitzerActor).toHaveActivatedAbility(
"Ability.Slot.Q",
{ times: 1 },
async () => {
await howitzerActor.pressKey("Q");
}
);Arguments
abilitystringThe ability class path, tag, or name.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(steelActor).toHaveAttributeValue("HealthSet", "Health", 2000),
expect(steelActor).toHaveActiveGameplayEffect("GE_ShieldBuff"),
expect(howitzerActor).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).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).toBeWithinDistanceOf
Usage
await expect(enemy).toBeWithinDistanceOf(world.actor('Player'), 200);Arguments
otherActorLocatorActorLocatorThe locator of the target actor.maxDistancenumberThe maximum distance allowed (in cm).
Returns
- Promise<void>
expect(actor).toBeFacing
Usage
await expect(turret).toBeFacing(world.actor('Player'));Arguments
otherActorLocatorActorLocatorThe locator of the target actor.
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 });Arguments
startPosVector3The starting 3D coordinate.distancenumberThe minimum distance in Unreal Units (cm) the actor must have moved.optionsObject(optional)timeoutnumber(optional)Defaults to5000Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.
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.
expect(skeleton).toBePlayingMontage
Usage
await expect(heroSkeleton).toBePlayingMontage("/Game/Animations/AM_Attack");Arguments
montageClassPathstringThe montage class path.
Returns
- Promise<void>
expect(skeleton).toHaveMontageSection
Usage
await expect(heroSkeleton).toHaveMontageSection("Recovery");Arguments
expectedSectionstringThe section name.
Returns
- Promise<void>
AI & Behavior Trees
Assertions for enemy decision-making, blackboard values, line of sight, and pathfinding navigation.
expect(aiController).toBeRunningBehaviorTree
Usage
await expect(aiCon).toBeRunningBehaviorTree("/Game/AI/BT_Zombie");Arguments
treeClassPathstringThe behavior tree class path.
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>
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>
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(enemyKeep).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
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).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("steel_shield_slam_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. 'steel_shield_slam_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>
Performance Budget Assertions
Enforce FPS thresholds, frame time spike ceilings, and memory consumption guardrails directly in CI gameplay tests.
expect(world).toMaintainPerformanceBudget
Usage
// Enforce a strict 60 FPS performance budget during ultimate VFX
await expect(world).toMaintainPerformanceBudget({
minFps: 60,
maxFrameTimeMs: 16.6,
maxMemoryMb: 4096,
sampleDurationSec: 5.0,
});Arguments
budgetObjectPerformance budget parameters: { minFps?: number, maxFrameTimeMs?: number, maxMemoryMb?: number, sampleDurationSec?: number }.
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>