Pixi’VN
indexInterfaces

Interface: GameTestingAPI<TGame, T>

Defined in: src/core/testing.ts:46

The object attached to window (and returned) by enable. Every action method merges the most recent props passed to setProps with any extraProps given here, then delegates to the matching narration/history call — so calling these behaves exactly like a real player action (the same navigate/t/toast/etc. the real UI uses).

narration, storage, stepHistory and Game are also exposed directly for anything not covered by the action methods (e.g. storage.set(...), Game.exportGameState()).

Type Parameters

TGame

TGame

T

T extends object = { }

Properties

errors

> readonly errors: GameTestingErrorEntry[]

Defined in: src/core/testing.ts:101

Errors caught via Game.addOnError since enable() was called (or since the last clearErrors).


Game

> readonly Game: TGame

Defined in: src/core/testing.ts:47


narration

> readonly narration: NarrationManagerInterface

Defined in: src/core/testing.ts:48


props

> readonly props: StepLabelPropsType<T>

Defined in: src/core/testing.ts:57

The most recent props passed to setProps — whatever your app's StepLabelProps augmentation defines (e.g. navigate, toast). Useful to drive the app's UI directly during a test session — e.g. pixiVN.props.navigate("/settings") — not just narration, for full control over what's on screen.


stepHistory

> readonly stepHistory: HistoryManagerInterface

Defined in: src/core/testing.ts:50


storage

> readonly storage: StorageManagerInterface

Defined in: src/core/testing.ts:49

Methods

call()

> call(label, extraProps?): Promise<StepLabelResultType>

Defined in: src/core/testing.ts:69

narrationUtils.NarrationManagerInterface.call using the live props plus any extraProps.

Parameters

label

string | LabelAbstract<any, T, number>

extraProps?

Partial<T>

Returns

Promise<StepLabelResultType>


clearErrors()

> clearErrors(): void

Defined in: src/core/testing.ts:102

Returns

void


closeAllLabels()

> closeAllLabels(): void

Defined in: src/core/testing.ts:97

narrationUtils.NarrationLabelsInterface.closeAll. Can end the game.

Returns

void


closeCurrentLabel()

> closeCurrentLabel(): void

Defined in: src/core/testing.ts:95

narrationUtils.NarrationLabelsInterface.closeCurrent

Returns

void


continue()

> continue(extraProps?, options?): Promise<StepLabelResultType>

Defined in: src/core/testing.ts:64

narrationUtils.NarrationManagerInterface.continue using the live props plus any extraProps.

Parameters

extraProps?

Partial<T>

options?
runNow?

boolean

steps?

number

Returns

Promise<StepLabelResultType>


getState()

> getState(): GameTestingState

Defined in: src/core/testing.ts:99

A snapshot of dialogue/choices/input/canContinue/canGoBack/labels — see GameTestingState.

Returns

GameTestingState


goBack()

> goBack(extraProps?, options?): Promise<StepLabelResultType>

Defined in: src/core/testing.ts:90

historyUtils.HistoryManagerInterface.back using the live props plus any extraProps.

Parameters

extraProps?

Partial<T>

options?
steps?

number

Returns

Promise<StepLabelResultType>


jump()

> jump(label, extraProps?): Promise<StepLabelResultType>

Defined in: src/core/testing.ts:74

narrationUtils.NarrationManagerInterface.jump using the live props plus any extraProps.

Parameters

label

string | LabelAbstract<any, T, number>

extraProps?

Partial<T>

Returns

Promise<StepLabelResultType>


selectChoice()

> selectChoice(choiceIndex, extraProps?): Promise<StepLabelResultType>

Defined in: src/core/testing.ts:83

Selects the currently open choice with this choiceIndex (as seen in getState().choices), using the live props plus any extraProps.

Parameters

choiceIndex

number

extraProps?

Partial<T>

Returns

Promise<StepLabelResultType>

Throws

when no open choice has that index.


setInput()

> setInput(value): void

Defined in: src/core/testing.ts:88

Resolves a pending narration.input.request(...) with value, exactly like the player typing an answer and confirming.

Parameters

value

StorageElementType

Returns

void


start()

> start(label, extraProps?): Promise<StepLabelResultType>

Defined in: src/core/testing.ts:59

Game.start using the live props plus any extraProps.

Parameters

label

string | LabelAbstract<any, T, number>

extraProps?

Partial<T>

Returns

Promise<StepLabelResultType>

On this page