Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
listener.handleStepResultEvent = function(result: Cucumber.events.StepResultPayload, callback: () => void) {
const step = result.getStep();
// "before" and "after" steps emit an event even if the keywords themselves are not present in the scenario...
if (!step.isHidden()) {
serenity.notify(new ActivityFinished(outcome(activityFrom(step), result.getStatus(), errorIfPresentIn(result))));
}
callback();
};
function handleStepResultEvent(result: cucumber.events.StepResultPayload, callback: () => void) {
const step = result.getStep();
// "before" and "after" steps emit an event even if they keywords themselves are not present in the test...
if (!step.isHidden()) {
serenity.notify(new ActivityFinished(outcome(activityFrom(step), result.getStatus(), result.getFailureException())));
}
callback();
}
mochaRunner.on('test end', (scenario: ExecutedScenario) => {
if (isPending(scenario)) {
serenity.notify(startOf(scenario));
}
serenity.notify(endOf(scenario));
});
});
mochaRunner.on('test end', (scenario: ExecutedScenario) => {
if (isPending(scenario)) {
serenity.notify(startOf(scenario));
}
serenity.notify(endOf(scenario));
});
});
function handleBeforeStepEvent(step: cucumber.events.StepPayload, callback: () => void) {
if (! step.isHidden()) {
serenity.notify(new ActivityStarts(activityFrom(step)));
}
callback();
}
function handleBeforeScenarioEvent(scenario: cucumber.events.ScenarioPayload, callback: () => void) {
serenity.notify(new SceneStarts(sceneFrom(scenario)));
callback();
}
function handleScenarioResultEvent(result: cucumber.events.ScenarioResultPayload, callback: () => void) {
const scenario = result.getScenario();
serenity.notify(new SceneFinished(outcome(sceneFrom(scenario), result.getStatus(), result.getFailureException())));
callback();
}
listener.handleBeforeScenarioEvent = function(scenario: Cucumber.events.ScenarioPayload, callback: Callback) {
serenity.notify(new SceneStarts(sceneFrom(scenario)));
callback();
};
listener.handleScenarioResultEvent = function(result: Cucumber.events.ScenarioResultPayload, callback: () => void) {
const scenario = result.getScenario();
serenity.notify(new SceneFinished(outcome(sceneFrom(scenario), result.getStatus(), errorIfPresentIn(result))));
callback();
};
handleBeforeStep = (step: Step) =>
this.isOfInterest(step) && serenity.notify(new ActivityStarts(CucumberTask.from(step)));