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

Ensures the given actor currently possesses the specified Gameplay Tag on its Ability System Component.

Usage

await expect(enemy).toHaveGameplayTag("Status.Stunned", { timeout: 10000 });

Arguments

  • tagstring
    The Gameplay Tag string (e.g., 'Status.Stunned').
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHaveAnyGameplayTags

Ensures the given actor has at least one of the specified Gameplay Tags, retrying until the timeout. A tag the engine doesn't know, or an actor without an Ability System Component, fails with the engine's error instead of reading as "no tags".

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

Ensures the given actor has all of the specified Gameplay Tags, retrying until the timeout. Engine errors fail the check instead of reading as "no tags".

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

Verifies the exact count of a specific Gameplay Tag.

Usage

await expect(enemy).toHaveGameplayTagCount("Status.Poisoned", 3);

Arguments

  • tagstring
    The Gameplay Tag.
  • expectedCountnumber
    The expected exact count.

Returns

  • Promise<void>

expect(actor).toHaveAttributeValue

Polls the actor's Ability System attributes and passes once the specified attribute exactly matches the expected value.

Usage

await expect(defender).toHaveAttributeValue("MMAttributeSet", "Health", 10);

Arguments

  • setstring
    The Attribute Set class name.
  • attributestring
    The specific attribute name.
  • expectedValuenumber
    The exact numeric value to wait for.

Returns

  • Promise<void>

expect(actor).toHaveAttributeBaseValue

Polls the actor's Ability System attributes and passes once the specified base attribute exactly matches the expected value.

Usage

await expect(defender).toHaveAttributeBaseValue("MMAttributeSet", "MaxHealth", 100);

Arguments

  • setstring
    The Attribute Set class name.
  • attributestring
    The specific base attribute name.
  • expectedValuenumber
    The exact numeric value to wait for.

Returns

  • Promise<void>

expect(actor).toHaveAttributeChange

Polls the actor's Ability System attributes and passes if the specified attribute changes by the expected delta within the timeout.

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

  • setstring
    The Attribute Set class name.
  • attributestring
    The specific attribute name.
  • optionsObject
    Options 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

Verifies the actor has an active Gameplay Effect of the given class.

Usage

await expect(hero).toHaveGameplayEffect("/Game/Effects/GE_Shield");

Arguments

  • effectClassPathstring
    The effect class path.

Returns

  • Promise<void>

expect(actor).toHaveGameplayEffectStackCount

Verifies the actor has an active Gameplay Effect with a specific stack count.

Usage

await expect(hero).toHaveGameplayEffectStackCount("/Game/Effects/GE_Bleed", 5);

Arguments

  • effectClassPathstring
    The effect class path.
  • expectedCountnumber
    The expected stack count.

Returns

  • Promise<void>

expect(actor).toHaveGameplayEffectLevel

Verifies the actor has an active Gameplay Effect with a specific level.

Usage

await expect(hero).toHaveGameplayEffectLevel("/Game/Effects/GE_Buff", 2);

Arguments

  • effectClassPathstring
    The effect class path.
  • expectedLevelnumber
    The expected level.

Returns

  • Promise<void>

expect(actor).toHaveAppliedGameplayEffect

Verifies that a specific Gameplay Effect has been applied to the target actor's Ability System Component. Supports exact application counts and instigator filtering. Only applications on this actor count, and the effect must be the same class: "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

  • effectNameOrClassstring
    The 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

Verifies the actor has been granted a specific Gameplay Ability.

Usage

await expect(hero).toHaveGameplayAbility("/Game/Abilities/GA_Dash");

Arguments

  • abilityClassPathstring
    The ability class path.
  • optionsObject(optional)
    Configuration object. Supports { timeout: number }.

Returns

  • Promise<void>

expect(actor).toHaveActivatedAbility

Verifies that a specific Gameplay Ability was activated on the actor's Ability System Component. Supports exact activation counts (times) to catch duplicate triggers and inline trigger callbacks. Only activations by this actor count (another hero casting the same ability doesn't). A gameplay tag such as "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

  • abilitystring
    The 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

Verifies the actor is currently actively executing a specific Gameplay Ability.

Usage

await expect(hero).toBeExecutingAbility("/Game/Abilities/GA_Ultimate");

Arguments

  • abilityClassPathstring
    The ability class path.

Returns

  • Promise<void>

expect(actor).toHaveAbilityCooldown

Polls the cooldown of a specific ability until it meets the configured operator condition.

Usage

await expect(hero).toHaveAbilityCooldown("/Game/Abilities/GA_Dash", { operator: "<=", expectedValue: 0 });

Arguments

  • abilityClassPathstring
    The ability class path.
  • optionsObject(optional)
    Configuration object: { operator?: string, expectedValue?: number, timeout?: number }.

Returns

  • Promise<void>

expectAll

Executes multiple assertions concurrently and verifies that all conditions pass atomically without race conditions against a synchronized game state snapshot. In the In-Engine Trace Viewer, failures render as an interactive 2D Results Matrix Grid with actor rows, assertion columns, live cell diffs, and aggregate failure diagnostics.

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

Verifies the actor's movement component is currently in a falling state.

Usage

await expect(enemy).toBeFalling();

Returns

  • Promise<void>

expect(actor).toBeCrouching

Verifies the actor's movement component is currently in a crouching state.

Usage

await expect(player).toBeCrouching();

Returns

  • Promise<void>

expect(actor).toBeFlying

Verifies the actor's movement component is currently in a flying state.

Usage

await expect(drone).toBeFlying();

Returns

  • Promise<void>

expect(actor).toBeSwimming

Verifies the actor's character movement is in the Swimming mode, retrying until the timeout.

Usage

await expect(player).toBeSwimming();

Arguments

  • optionsObject(optional)
    Configuration object: { timeout?: number } (default 5000 ms).

Returns

  • Promise<void>

expect(actor).toBeMovingOnGround

Verifies the actor's character movement is on the ground (Walking or NavWalking). Useful right after a spawn or a jump, to wait for the landing.

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

Verifies the character movement mode by name (case-insensitive), retrying until the timeout.

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

Verifies the actor's current linear velocity / speed satisfies the comparison criteria.

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

  • expectedSpeednumber
    The 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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeWithinDistance

Retries until the actor is within a distance of another actor or a point. Measured on the ground plane by default (height ignored).

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 | string
    An actor locator, a world location { x, y, z? }, or an actor's name.
  • distancenumber
    The maximum distance allowed, in Unreal units (cm).
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds.
    • planarboolean(optional)Defaults to true
      Measure in 2D (ignoring height). False measures in 3D.

Returns

  • Promise<void>

expect(actor).toHaveMovedFurtherThan

Polls the actor's location until it has been at least the given distance from a starting point. Pass an axis to measure only part of the movement: 'z' for a knock-up, 'xy' for a knockback along the ground. The farthest the actor got counts, so a jump that lands again still passes.

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

  • startPosVector3
    The starting 3D coordinate.
  • distancenumber
    The 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 to 5000
      Time to retry the assertion for in milliseconds.

Returns

  • Promise<void>

expect(actor).toHaveLocation

Polls the actor's 3D position until it is within the specified tolerance radius of the expected location.

Usage

await expect(enemy).toHaveLocation({ x: 100, y: 200, z: 0 }, 10.0, { timeout: 8000 });

Arguments

  • expectedLocationVector3
    The expected {x, y, z} world coordinate.
  • tolerancenumber(optional)Defaults to 5.0
    The maximum acceptable distance from the target in cm.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time 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

Verifies the AI controller (or the pawn it possesses) is actively running the specified Behavior Tree. An engine error, such as a locator that isn't an AI, fails the check with that error instead of reading as "not running".

Usage

await expect(aiCon).toBeRunningBehaviorTree("BT_Zombie");
await expect(aiCon).toBeRunningBehaviorTree("/Game/AI/BT_Zombie.BT_Zombie");

Arguments

  • treePathstring
    The behavior tree's asset name or full path.
  • optionsObject(optional)
    Configuration object: { timeout?: number } (default 5000 ms).

Returns

  • Promise<void>

expect(aiController).toHaveBlackboardValue

Verifies the AI's Blackboard has the expected value for the specified key.

Usage

await expect(aiCon).toHaveBlackboardValue("TargetActor", world.actor('Player'));

Arguments

  • keyNamestring
    The blackboard key name.
  • expectedValueany
    The expected value for the key.

Returns

  • Promise<void>

expect(aiController).toHaveLineOfSightTo

Verifies the AI controller has line of sight to the specified actor.

Usage

await expect(aiCon).toHaveLineOfSightTo(world.actor('Player'));

Arguments

  • otherActorLocatorActorLocator
    The locator of the target actor.

Returns

  • Promise<void>

expect(actor).toBeAINavigating

Verifies the actor's AI Controller is currently navigating along a path (PathFollowingStatus is Moving). Automatically resolves from Pawn to AI Controller. Supports .not negation.

Usage

// Assert AI is navigating towards the player
await expect(aiPawn).toBeAINavigating();

// Assert AI has stopped navigating
await expect(aiPawn).not.toBeAINavigating({ timeout: 10000 });

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

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

Retries until the AI's logic is in this state: a StateTree state that's active (at any level, so a parent state counts), or a behavior tree node on the path to the running node.

Usage

// A StateTree minion: Root › Combat › Attack
await expect(minion).toBeInState('Combat');
await expect(minion).toBeInState('Attack', { timeout: 8000 });

Arguments

  • stateNamestring
    A 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

Passes when the AI's logic was in this state at any point of the test, even if it has left it since. Use it for states that are over quickly, like a single attack.

Usage

await expect(tower).toHaveVisitedState('Attack');
await expect(minion).not.toHaveVisitedState('Retreat');

Arguments

  • stateNamestring
    A StateTree state or behavior tree node name.
  • optionsObject(optional)
    Configuration object: { timeout?: number } (default 5000 ms).

Returns

  • Promise<void>

expect(actor).toHaveBlackboardChange

Passes when a blackboard key changed during the test, optionally from or to a given value. A change that's already over still counts.

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

  • keyNamestring
    The 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

Reads a blackboard key that holds the AI's state as a name (an enum or a string key, 'AIState' by default) and retries until it contains the expected text (case-insensitive).

Usage

await expect(guard).toHaveAIState('Patrolling');
await expect(guard).toHaveAIState('Chase', { keyName: 'Mode' });

Arguments

  • expectedStatestring
    The 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

Verifies the actor is moving towards a target: fast enough, with its velocity pointing at it.

Usage

await expect(minion).toBeMovingTowards(enemyTower);

Arguments

  • targetActorLocator | Vector3 | string
    An 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

Verifies the actor is moving away from a target (fleeing, retreating, knocked back).

Usage

await expect(lowHealthEnemy).toBeMovingAwayFrom(player);

Arguments

  • targetActorLocator | Vector3 | string
    An 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

Verifies the actor is following another actor: moving towards it, by pathfinding or at speed, and optionally staying within a distance.

Usage

await expect(companion).toBeFollowing(player, { maxDistance: 800 });

Arguments

  • targetActorLocator | string
    The 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

Polls the actor's camera FOV until it matches the expected value within tolerance.

Usage

await expect(player).toHaveCameraFOV(90, { tolerance: 1.0 });

Arguments

  • expectedFOVnumber
    The expected FOV angle in degrees.
  • optionsObject(optional)
    • tolerancenumber(optional)Defaults to 0.5
      Allowed deviation in FOV degrees before failing assertion.
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeCameraShaking

Verifies the actor's PlayerCameraManager currently has active camera shakes. Supports .not negation.

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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHaveCameraViewTarget

Polls until the actor's camera view target matches the expected actor name.

Usage

await expect(player).toHaveCameraViewTarget('BP_PlayerCharacter');

Arguments

  • actorNamestring
    The expected name of the camera's view target actor.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time 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

Waits until the montage plays on the actor's skeletal mesh. A montage blending out doesn't count. Optionally only in one section.

Usage

await expect(hero).toBePlayingMontage('AM_Stunned');
await expect(hero).toBePlayingMontage('AM_Combo', { section: 'Swing2' });

Arguments

  • montagestring
    The 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

Waits until the montage playing, or the one named, is in this section.

Usage

await expect(hero).toHaveMontageSection('Recovery', { montage: 'AM_Combo' });

Arguments

  • sectionstring
    The section name (any case).
  • optionsObject(optional)
    Configuration object: { montage?: string, timeout?: number } (default 5000 ms).

Returns

  • Promise<void>

expect(actor).toHavePlayedMontage

Passes when the montage started at some point of the test, even if it has ended since: a quick hit reaction is usually over by the time a test looks. Waits for it when it hasn't happened yet. Under .not it checks what happened so far and doesn't wait.

Usage

await hero.click();
await expect(hero).toHavePlayedMontage('AM_Cast');
await expect(dummy).toHavePlayedMontage('AM_HitReact', { times: 1 });

Arguments

  • montagestring
    The 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

Passes when an anim notify fired, or a notify state began, on the actor's animations during the test. Waits for it when it hasn't happened yet. Under .not it checks what happened so far and doesn't wait.

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

  • notifystring
    The 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

Asserts that the Pawn is possessed by any active Controller (AI or Human). Supports .not negation.

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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBePlayerControlled

Asserts that the Pawn is possessed specifically by a Human/Network PlayerController (excludes AI bot controllers). Supports .not negation.

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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeLocallyControlled

Asserts that the Pawn is controlled by the local viewport client. Essential for client-server and multi-client multiplayer tests.

Usage

// Assert pawn belongs to the active client connection
await expect(localPlayer).toBeLocallyControlled();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHaveController

Asserts that the Pawn has an attached Controller, and optionally verifies that the Controller class or name matches.

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 to 5000
      Time 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

Polls until the actor's Generic Team ID matches the expected value.

Usage

await expect(player).toHaveTeamId(0);
await expect(spectator).not.toHaveTeamId(1);

Arguments

  • expectedTeamIdnumber
    The expected team ID (255 = NoTeam).
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeHostileTowards

Verifies the actor's team attitude towards another actor is Hostile. Supports .not negation.

Usage

await expect(player).toBeHostileTowards(enemy);
await expect(player).not.toBeHostileTowards(ally);

Arguments

  • otherActorActorLocator
    The other actor to evaluate attitude towards.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

State & Rendering

expect(actor).toHaveCount

Verifies that the locator resolves to exactly the expected number of elements in the engine.

Usage

await expect(world.actor('BP_Minion')).toHaveCount(5);

Arguments

  • expectedCountnumber
    The expected number of matching elements.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeVisible

Verifies that the actor's 3D mesh was actively rendered on screen (inside the camera frustum and not completely occluded) on the last frame.

Usage

await expect(world.actor('BP_Minion_Range')).toBeVisible({ onScreen: true, timeout: 10000 });

Arguments

  • optionsObject(optional)
    • onScreenboolean(optional)Defaults to false
      When true, strictly requires the actor's bounding geometry to be visible inside the viewport camera frustum.
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeHidden

The opposite of toBeVisible: passes when the player can't see the actor, because it's hidden, not rendered, or doesn't exist. Reads better than .not.toBeVisible() for things that should disappear.

Usage

await pickup.callFunction("Collect");
await expect(pickup).toBeHidden();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeInViewport

Verifies that the actor's 3D mesh or UMG widget element is actively rendered inside the active camera viewport frustum.

Usage

await expect(enemy).toBeInViewport();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeDestroyed

Polls until the targeted actor is destroyed (marked PendingKill, destroyed, or garbage-collected from the UWorld). Supports .not negation to verify the actor remains alive/valid.

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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeNiagaraActive

Verifies that a Niagara particle system component on the actor is currently active and emitting particles.

Usage

await expect(explosionEffect).toBeNiagaraActive();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHaveNiagaraAsset

Verifies that the actor's Niagara component is set to a specific Niagara system asset path.

Usage

await expect(fireVFX).toHaveNiagaraAsset("NS_Fire_Loop");

Arguments

  • expectedAssetstring
    The expected Niagara system asset path substring.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBeAudioPlaying

Verifies that an Audio Component attached to the actor is actively playing sound.

Usage

await expect(footstepAudio).toBeAudioPlaying();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHaveSoundAsset

Verifies that the actor's Audio Component is playing a sound asset matching the specified name.

Usage

await expect(bgmAudio).toHaveSoundAsset("SoundWave_BossTheme");

Arguments

  • expectedSoundstring
    The expected sound asset path or name substring.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBePhysicsSimulating

Verifies that the actor's primitive or skeletal mesh is simulating physics (ragdoll).

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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toBePhysicsAsleep

Verifies that a rigid body physics object has come to rest and entered a sleeping state.

Usage

await expect(crate).toBePhysicsAsleep();

Arguments

  • optionsObject(optional)
    • boneNamestring(optional)
      Specific bone/body instance name to check sleep state on.
    • timeoutnumber(optional)Defaults to 5000
      Time 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

Verifies that an Enhanced Input Local Player Subsystem has a specific Input Mapping Context (IMC) applied.

Usage

await expect(player).toHaveInputMappingContext("IMC_DefaultPlayer");

Arguments

  • contextNameOrPathstring
    The IMC asset name or path.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHaveInputActionValue

Verifies the current value of an Enhanced Input Action (IA).

Usage

await expect(player).toHaveInputActionValue("IA_Sprint", true);

Arguments

  • actionNameOrPathstring
    The Input Action name or path.
  • expectedValueany
    The expected action value (boolean, float, or Vector3).
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(actor).toHavePlayerScore

Verifies the player's current score on their PlayerState.

Usage

await expect(player).toHavePlayerScore(100, { operator: ">=" });

Arguments

  • expectedScorenumber
    The expected score threshold.
  • optionsObject(optional)
    • operator'>' | '<' | '>=' | '<=' | '==='(optional)Defaults to '>='
      Comparison operator to evaluate actual score against expectedScore.
    • timeoutnumber(optional)Defaults to 5000
      Time 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

Verifies that a player can actually see the widget. Its own visibility isn't enough: every widget above it must be visible too (across nested Widget Blueprints), it must be on the active page of any Widget Switcher it sits in, and it must reach a window. When it fails, the message says why, for example 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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toBeHidden

The opposite of toBeVisible: passes when a player can't see the widget. It's hidden or collapsed, something above it is, it's on a Widget Switcher page that isn't showing, or it doesn't exist.

Usage

await world.widget("CloseButton").click();
await expect(world.widget("ConfirmPurchaseModal")).toBeHidden();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toBeEnabled

Verifies if the Slate widget is interactable (not disabled).

Usage

const submitBtn = world.widget("SubmitButton");
await expect(submitBtn).toBeEnabled();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toBeDisabled

Verifies that the widget is disabled: greyed out and not taking input. The opposite of toBeEnabled.

Usage

// Not enough gold yet
await expect(world.widget("BuyButton")).toBeDisabled();

Arguments

  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toOverlap

Checks whether the widget is drawn over another, in screen pixels. Mostly used negated, to catch one panel covering another. With another widget, it compares the two. With none, it compares the widget against everything visible on screen that draws (text, images, buttons, borders), apart from its own contents and the panels it sits in, and the failure lists each widget it overlaps, by how many pixels and what share. A widget that isn't visible overlaps nothing, and edges that only touch don't count.

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 to 0
      How 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 to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toHaveText

Polls the UTextBlock or URichTextBlock widget until its visible text matches the expected string.

Usage

const title = world.widget("HeaderTitle");
await expect(title).toHaveText("Main Menu");

Arguments

  • expectedTextstring | RegExp
    The exact expected text string or RegExp pattern.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toContainText

Polls the UTextBlock or URichTextBlock widget until its text contains the specified substring.

Usage

const subtitle = world.widget("WBP_Modal").getChild("SubtitleText");
await expect(subtitle).toContainText("cannot be undone");

Arguments

  • substringstring
    The substring to search for within the widget text.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time to retry the assertion for in milliseconds. Defaults to timeout in TestConfig.expect.

Returns

  • Promise<void>

expect(widget).toHaveValue

Polls the UEditableText or UEditableTextBox widget until its input value matches the expected string.

Usage

const usernameInput = world.widget("WBP_Login").getChild("UsernameInput");
await expect(usernameInput).toHaveValue("Player1");

Arguments

  • expectedValuestring
    The expected input string value.
  • optionsObject(optional)
    • timeoutnumber(optional)Defaults to 5000
      Time 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

Asserts on float/scalar material parameters (e.g., Dissolve, Opacity, HitFlash, Health Percent). Automatically traverses nested UMG containers to locate the assigned Image/Border.

Usage

await expect(healthImage).toHaveMaterialScalarParameter('Percent', 0.5, { operator: '<=' });

Arguments

  • parameterNamestring
    The name of the scalar parameter in the material.
  • expectedValuenumber
    The expected float value.
  • optionsObject(optional)
    • operator'>' | '<' | '>=' | '<=' | '===' | '!='(optional)Defaults to '==='
      The logical operator to evaluate.
    • tolerancenumber(optional)Defaults to 0.001
      Epsilon tolerance for floating point comparisons.
    • slotIndexnumber(optional)Defaults to 0
      The 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 to 5000
      Time to retry the assertion in milliseconds.

Returns

  • Promise<void>

expect(locator).toHaveMaterialVectorParameter

Asserts on vector/color material parameters (e.g., TeamColor, GlowColor). Supports Hex strings, arrays, or objects.

Usage

await expect(shield).toHaveMaterialVectorParameter('GlowColor', '#00FFCC');

Arguments

  • parameterNamestring
    The 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 to 0.01
      Epsilon tolerance for per-channel float comparisons.
    • slotIndexnumber(optional)Defaults to 0
      The material slot index.
    • componentNamestring(optional)
    • timeoutnumber(optional)Defaults to 5000

Returns

  • Promise<void>

expect(locator).toHaveMaterial

Verifies which material asset is assigned to a slot.

Usage

await expect(terrain).toHaveMaterial('M_Snow');

Arguments

  • expectedMaterialstring | RegExp
    The name of the material to expect (e.g. 'M_Frozen_Ice' or /^M_Hero_/).
  • optionsObject(optional)
    • slotIndexnumber(optional)Defaults to 0
    • componentNamestring(optional)
    • timeoutnumber(optional)Defaults to 5000

Returns

  • Promise<void>

expect(locator).toBeDynamicMaterial

Asserts that the material at the specified slot is a UMaterialInstanceDynamic (MID). Useful for catching bugs where CreateDynamicMaterialInstance() was forgotten.

Usage

await expect(healthBarImage).toBeDynamicMaterial();

Arguments

  • optionsObject(optional)
    • slotIndexnumber(optional)Defaults to 0
    • componentNamestring(optional)
    • timeoutnumber(optional)Defaults to 5000

Returns

  • Promise<void>

expect(locator).toHaveMaterialTextureParameter

Asserts that a specific UTexture asset is bound to a texture parameter (e.g. Player portraits, custom emblems, render targets).

Usage

await expect(emblem).toHaveMaterialTextureParameter('Icon', 'T_Skull');

Arguments

  • parameterNamestring
    The name of the texture parameter.
  • expectedTexturestring | RegExp
    The expected texture name.
  • optionsObject(optional)
    • slotIndexnumber(optional)Defaults to 0
    • componentNamestring(optional)
    • timeoutnumber(optional)Defaults to 5000

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

Captures the current viewport frame and asserts it matches the golden reference snapshot within configurable perceptual tolerances.

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

  • snapshotNamestring
    The name of the snapshot file (e.g. 'knight_shield_rush_impact.png').
  • optionsObject(optional)
    • thresholdnumber(optional)Defaults to 0.2
      Perceptual 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 to false
      Whether to include Slate/UMG viewport overlays in the capture.
    • timeoutnumber(optional)Defaults to 5000
      Time 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

Passes when a path on the navmesh leads from this actor to each target. A path that stops short doesn't count. Keeps asking while the navmesh builds. An AI agent paths with its controller's navigation query filter, which can make areas cost more or rule them out, so two agents can take different routes: that filter is used unless you name another, and avoiding checks which areas the route crosses. A failure says why for each target: off the navmesh, the path stops N cm short, it's too long or too costly, or it crosses an area to avoid. .not passes when none of the targets can be reached.

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 | Array
    One 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

Passes when streaming finishes within a time limit: every streaming level and World Partition cell, or with at the world around one place. A failure lists the levels and cells still pending.

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

Passes when the game's memory stayed under a budget: its peak since the test started (the default), or now. Unlike toHaveMemoryBelow, it catches a spike that's already over. In the editor the numbers include the editor, and the failure says so.

Usage

await expect(world).toUseLessMemoryThan('6 GB');

Arguments

  • budgetnumber | string
    MB, or '512 MB' / '6 GB'.
  • optionsObject(optional)
    Configuration object: { measure?: 'peak' | 'now' }.

Returns

  • Promise<void>

expect(world).toKeepTexturesInBudget

Passes when the textures never wanted more than the texture streaming pool holds since the test started. Over budget, textures go blurry while the game swaps them in and out.

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

On 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

Polls engine performance metrics until the instantaneous or smoothed frame rate meets the target threshold.

Usage

// Assert viewport maintains at least 60 FPS
await expect(world).toHaveFPS(60, { operator: ">=" });

Arguments

  • expectedFpsnumber
    Target frame rate threshold in frames per second.
  • optionsObject(optional)
    Configuration object: { operator?: '>=' | '<=' | '>' | '<' | '===', timeout?: number }.

Returns

  • Promise<void>

expect(world).toHaveFrameTimeBelow

Asserts that the engine's frame time (delta seconds in milliseconds) remains below the specified spike ceiling.

Usage

// Catch hitches and frame spikes exceeding 16.6ms
await expect(world).toHaveFrameTimeBelow(16.6);

Arguments

  • maxFrameTimeMsnumber
    Maximum 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

Retries until the engine's current frame rate is at least this.

Usage

await expect(world).toHaveMinFPS(30);

Arguments

  • minFpsnumber
    The lowest acceptable frame rate.
  • optionsObject(optional)
    Configuration object: { timeout?: number } (default 5000 ms).

Returns

  • Promise<void>

expect(world).toHaveMemoryBelow

Retries until the game's used physical memory is at most this many megabytes.

Usage

await expect(world).toHaveMemoryBelow(4096);

Arguments

  • maxMemoryMbnumber
    The 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

95% of the capture's frames took at most this many milliseconds.

Usage

await expect(perf).toHaveFrameTimeP95Below(20);

Arguments

  • maxMsnumber
    Frame time ceiling in ms.

Returns

  • Promise<void>

expect(capture).toHaveFrameTimeP99Below

99% of the capture's frames took at most this many milliseconds.

Usage

await expect(perf).toHaveFrameTimeP99Below(33);

Arguments

  • maxMsnumber
    Frame time ceiling in ms.

Returns

  • Promise<void>

expect(capture).toHaveAverageFrameTimeBelow

The capture's average frame time is at most this many milliseconds.

Usage

await expect(perf).toHaveAverageFrameTimeBelow(16.7);

Arguments

  • maxMsnumber
    Average frame time ceiling in ms.

Returns

  • Promise<void>

expect(capture).toHaveAverageFPSAbove

The capture averaged at least this frame rate.

Usage

await expect(perf).toHaveAverageFPSAbove(60);

Arguments

  • minFpsnumber
    Lowest acceptable average FPS.

Returns

  • Promise<void>

expect(capture).toHaveOnePercentLowFPSAbove

The slowest 1% of the capture's frames still ran at least this frame rate (1000 / the 99th percentile frame time).

Usage

await expect(perf).toHaveOnePercentLowFPSAbove(45);

Arguments

  • minFpsnumber
    Lowest acceptable 1% low FPS.

Returns

  • Promise<void>

expect(capture).toHaveNoHitchesOver

No frame of the capture took longer than this (or at most `allowed` did). A threshold below the capture's hitchMs needs every frame: short captures (600 frames or fewer) keep them all; for longer ones, measure with { hitchMs } at least this low.

Usage

await expect(perf).toHaveNoHitchesOver(50);
await expect(perf).toHaveNoHitchesOver(33, { allowed: 2 });

Arguments

  • maxMsnumber
    The longest acceptable frame in ms.
  • optionsObject(optional)
    { allowed?: number } frames over the limit that are tolerated (default 0).

Returns

  • Promise<void>

expect(capture).toHavePeakMemoryBelow

Used memory never went above this many megabytes during the capture.

Usage

await expect(perf).toHavePeakMemoryBelow(4096);

Arguments

  • maxMbnumber
    Memory ceiling in MB.

Returns

  • Promise<void>

expect(capture).toHaveMemoryGrowthBelow

Used memory grew by at most this many megabytes from the start of the capture to its end. Catches leaks in something that should clean up after itself.

Usage

await expect(perf).toHaveMemoryGrowthBelow(50);

Arguments

  • maxMbnumber
    Allowed growth in MB.

Returns

  • Promise<void>

expect(capture).toHaveDrawCallsBelow

Draw calls per frame stayed at or under this count, on average (default) or at most. Throws when the engine didn't report draw calls during the capture (some editor setups leave them at 0), rather than passing on a 0.

Usage

await expect(perf).toHaveDrawCallsBelow(2000);
await expect(perf).toHaveDrawCallsBelow(3500, { stat: 'max' });

Arguments

  • maxDrawCallsnumber
    Draw call ceiling.
  • optionsObject(optional)
    { stat?: 'avg' | 'max' } (default 'avg').

Returns

  • Promise<void>