Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
// see examples/cucumber/features/reporting_results/reports_scenario_outlines.feature for more context
const
category = new Category('Reporting results'),
name = new Name('Reports scenario outlines'),
path = new Path(`reporting_results/reports_scenario_outlines.feature`),
template = new Description(`
When makes a contribution of:
| value |
| time |
| talent |
| great code |
Then they help bring serenity to fellow devs
`),
sequence = new ScenarioDetails(name, category, new FileSystemLocation(
path,
7,
)),
scenario1 = new ScenarioDetails(name, category, new FileSystemLocation(
path,
25,
)),
scenario2 = new ScenarioDetails(name, category, new FileSystemLocation(
path,
26,
))
;
/**
* @test {SerenityBDDReporter}
* @test {SceneSequenceDetected}
.reduce((previous, current) => previous.then(() => {
const scenario = sample(current);
const details = new ScenarioDetails(
new Name(scenario.name),
new Category(scenario.category),
new FileSystemLocation(new Path(scenario.path)),
);
this.serenityInstance.announce(new SceneStarts(
details,
this.serenityInstance.currentTime(),
));
// ... an actual test operunner would now execute the test and then announce the outcome
this.serenityInstance.announce(
new SceneFinished(details, scenario.outcome, this.serenityInstance.currentTime()),
);
it('correctly recognises undefined steps', () => {
emitAllFrom(require('./samples/scenario-with-undefined-steps.json'));
const expectedScenarioDetails = new ScenarioDetails(
new Name('Undefined steps'),
new Category('Event Protocol'),
new FileSystemLocation(
new Path('features/undefined-steps.feature'),
3,
3,
),
);
return serenity.waitForNextCue().then(() => {
PickEvent.from(recorder.events)
.next(SceneStarts, e => expect(e.value).to.equal(expectedScenarioDetails))
.next(TestRunnerDetected, e => expect(e.value).to.equal(new Name('Cucumber')))
.next(SceneTagged, e => expect(e.tag).to.equal(new FeatureTag('Event Protocol')))
.next(TaskStarts, e => expect(e.value.name).to.equal(new Name('Given I have an undefined step')))
describe('SerenityBDDReporter', () => {
const
startTime = Timestamp.fromJSON('2018-05-25T00:00:00.123Z'),
scenarioDuration = Duration.ofMilliseconds(142);
const defaultCardScenario = new ScenarioDetails(
new Name('Paying with a default card'),
new Category('Online Checkout'),
new FileSystemLocation(
new Path(`payments/checkout.feature`),
),
);
const voucherScenario = new ScenarioDetails(
new Name('Paying with a voucher'),
new Category('Online Checkout'),
new FileSystemLocation(
new Path(`payments/checkout.feature`),
),
);
let stage: Stage,
stageManager: sinon.SinonStubbedInstance,
reporter: SerenityBDDReporter;
beforeEach(() => {
const env = create();
stageManager = env.stageManager;
stage = env.stage;
When makes a contribution of:
| value |
| time |
| talent |
| great code |
Then they help bring serenity to fellow devs
`),
sequence = new ScenarioDetails(name, category, new FileSystemLocation(
path,
7,
)),
scenario1 = new ScenarioDetails(name, category, new FileSystemLocation(
path,
25,
)),
scenario2 = new ScenarioDetails(name, category, new FileSystemLocation(
path,
26,
))
;
/**
* @test {SerenityBDDReporter}
* @test {SceneSequenceDetected}
* @test {SceneTemplateDetected}
* @test {SceneParametersDetected}
* @test {ScenarioParameters}
* @test {SceneStarts}
* @test {SceneFinished}
* @test {ExecutionSuccessful}
* @test {TestRunFinished}
*/
private scenarioDetailsOf(spec: SpecResult): ScenarioDetails {
return new ScenarioDetails(
new Name(this.currentScenarioNameFor(spec.description)),
new Category(this.currentFeatureName()),
FileSystemLocation.fromJSON(spec.location as any),
);
}
import { FileSystemLocation, Path } from '@serenity-js/core/lib/io';
import { Category, Name, Photo, ScenarioDetails } from '@serenity-js/core/lib/model';
export const defaultCardScenario = new ScenarioDetails(
new Name('Paying with a default card'),
new Category('Online Checkout'),
new FileSystemLocation(
new Path(`payments/checkout.feature`),
),
);
export const voucherScenario = new ScenarioDetails(
new Name('Paying with a voucher'),
new Category('Online Checkout'),
new FileSystemLocation(
new Path(`payments/checkout.feature`),
),
);
export const photo = new Photo('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEW01FWbeM52AAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg==');
private detailsOf(scenario: FeatureFileNode, feature: Feature): ScenarioDetails {
return new ScenarioDetails(
scenario.name,
new Category(feature.name.value),
scenario.location,
);
}