skutter
Version:
Skutter: Opinionated BDD Browser based test framework
49 lines (48 loc) • 1.24 kB
JavaScript
"use strict";
const Lazy = require("lazy.js");
const step_1 = require("./step");
const stop_watch_1 = require("./services/stop-watch");
const new_guid_1 = require("./services/new-guid");
class Scenario {
constructor(title, annotations, id) {
this.dequeued = false;
this._title = "";
this._id = id;
this._title = title;
this.annotations = Lazy(annotations).keys().map((key) => { return key; }).toArray();
this._steps = [];
this.stopWatch = new stop_watch_1.StopWatch();
this.dequeued = false;
}
get steps() {
return this._steps;
}
get id() {
return this._id;
}
get title() {
return this._title;
}
get durationMiliseconds() {
return this.stopWatch.elapsedMilliseconds;
}
get queued() {
if (this.dequeued) {
return false;
}
return !Lazy(this.annotations).contains("pending");
}
appendStep(text) {
this.steps.push(new step_1.Step(text, new_guid_1.newGuid()));
}
start() {
this.stopWatch.start();
}
stop() {
this.stopWatch.stop();
}
dequeue() {
this.dequeued = true;
}
}
exports.Scenario = Scenario;