UNPKG

@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 1.37 kB
import { ensure, isDefined } from 'tiny-types'; import { CorrelationId, ExecutionSuccessful, Outcome } from '../model/index.js'; import { Timestamp } from '../screenplay/index.js'; import { DomainEvent } from './DomainEvent.js'; /** * Emitted by a Serenity/JS test runner adapter, right before a test and all its associated test hooks finish. * Triggers any clean-up operations that might be required, such as discarding of * the [discardable](https://serenity-js.org/api/core/class/Discardable/) abilities. * * The `outcome` property contains the test outcome determined so far, before any cleanup operations. * This allows stage crew members like the WebdriverIO notifier to invoke hooks with the test result * before `waitForNextCue()` is called. * * @group Events */ export class SceneFinishes extends DomainEvent { sceneId; outcome; static fromJSON(o) { return new SceneFinishes(CorrelationId.fromJSON(o.sceneId), o.outcome ? Outcome.fromJSON(o.outcome) : new ExecutionSuccessful(), Timestamp.fromJSON(o.timestamp)); } constructor(sceneId, outcome, timestamp) { super(timestamp); this.sceneId = sceneId; this.outcome = outcome; ensure('sceneId', sceneId, isDefined()); ensure('outcome', outcome, isDefined()); } } //# sourceMappingURL=SceneFinishes.js.map