UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

36 lines 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SceneFinishes = void 0; const tiny_types_1 = require("tiny-types"); const index_js_1 = require("../model/index.js"); const index_js_2 = require("../screenplay/index.js"); const DomainEvent_js_1 = require("./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 */ class SceneFinishes extends DomainEvent_js_1.DomainEvent { sceneId; outcome; static fromJSON(o) { return new SceneFinishes(index_js_1.CorrelationId.fromJSON(o.sceneId), o.outcome ? index_js_1.Outcome.fromJSON(o.outcome) : new index_js_1.ExecutionSuccessful(), index_js_2.Timestamp.fromJSON(o.timestamp)); } constructor(sceneId, outcome, timestamp) { super(timestamp); this.sceneId = sceneId; this.outcome = outcome; (0, tiny_types_1.ensure)('sceneId', sceneId, (0, tiny_types_1.isDefined)()); (0, tiny_types_1.ensure)('outcome', outcome, (0, tiny_types_1.isDefined)()); } } exports.SceneFinishes = SceneFinishes; //# sourceMappingURL=SceneFinishes.js.map