Skip to main content
Version: 1.x

Class: FETestLibraryInstance

Defined in: src/fe/fe-test-library.ts:212

Stateful FE Test Library instance for OPA5 test execution.

Remarks

Created exclusively by initializeFETestLibrary. Manages the lifecycle of OPA5 page objects and provides the execute() method for running Given/When/Then chains against the browser.

P1 exception: This is a stateful class (manages initialized state, WorkZone detection, and method call history).

Example

const fe = await initializeFETestLibrary(page, config);
const logs = await fe.execute(({ Given, When, Then }) => {
When.onTheMainPage.onFilterBar().iChangeSearchField('test');
Then.onTheMainPage.onFilterBar().iCheckSearchField('test');
});

Accessors

config

Get Signature

get config(): Readonly<TestLibraryConfig>

Defined in: src/fe/fe-test-library.ts:236

The frozen test library configuration.

Example
const cfg = fe.config;
Returns

Readonly<TestLibraryConfig>


isInitialized

Get Signature

get isInitialized(): boolean

Defined in: src/fe/fe-test-library.ts:248

Whether the FE test library has been initialized.

Example
if (fe.isInitialized) { ... }
Returns

boolean

Methods

execute()

execute(fn): Promise<readonly string[]>

Defined in: src/fe/fe-test-library.ts:265

Executes a Given/When/Then chain against the browser OPA5 queue.

Parameters

fn

(scope) => void

Function receiving Given/When/Then proxy objects

Returns

Promise<readonly string[]>

Array of OPA5 assertion log messages

Example

const logs = await fe.execute(({ Given, When, Then }) => {
When.onTheMainPage.onFilterBar().iChangeSearchField('test');
});

getMethodCallHistory()

getMethodCallHistory(): readonly ProxyMethodCall[]

Defined in: src/fe/fe-test-library.ts:343

Returns the method calls captured during the last execute() invocation.

Returns

readonly ProxyMethodCall[]

Captured proxy method calls, or empty array if never executed

Example

await fe.execute(({ When }) => { When.onTheMainPage.onTable().iSelectRow(0); });
const history = fe.getMethodCallHistory();

getPageKeys()

getPageKeys(): readonly string[]

Defined in: src/fe/fe-test-library.ts:328

Returns the configured page object keys.

Returns

readonly string[]

Array of page keys (e.g., ['onTheMainPage', 'onTheDetailPage'])

Example

const keys = fe.getPageKeys(); // ['onTheMainPage']

getShellInstance()

getShellInstance(): WorkZoneDetection | undefined

Defined in: src/fe/fe-test-library.ts:358

Returns the shell instance if WorkZone was detected, otherwise undefined.

Returns

WorkZoneDetection | undefined

Shell detection info or undefined

Example

const shell = fe.getShellInstance();
if (shell) { ... }

toApp()

toApp(): void

Defined in: src/fe/fe-test-library.ts:383

Switches context to the application frame (WorkZone only).

Returns

void

Example

fe.toApp();

toShell()

toShell(): void

Defined in: src/fe/fe-test-library.ts:371

Switches context to the shell frame (WorkZone only).

Returns

void

Example

fe.toShell();