@serenity-js/core
Version:
The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure
32 lines (28 loc) • 998 B
text/typescript
import type { JSONObject } from 'tiny-types';
import { ensure, isDefined } from 'tiny-types';
import { CorrelationId, ScenarioDetails } from '../model';
import { Timestamp } from '../screenplay';
import { DomainEvent } from './DomainEvent';
/**
* Emitted by a Serenity/JS test runner adapter when a test scenario and its associated test hooks are about to start.
*
* @group Events
*/
export class SceneStarts extends DomainEvent {
static fromJSON(o: JSONObject): SceneStarts {
return new SceneStarts(
CorrelationId.fromJSON(o.sceneId as string),
ScenarioDetails.fromJSON(o.details as JSONObject),
Timestamp.fromJSON(o.timestamp as string),
);
}
constructor(
public readonly sceneId: CorrelationId,
public readonly details: ScenarioDetails,
timestamp?: Timestamp,
) {
super(timestamp);
ensure('sceneId', sceneId, isDefined());
ensure('details', details, isDefined());
}
}