How to use the @serenity-js/core/lib/model.Category function in @serenity-js/core

To help you get started, we’ve selected a few @serenity-js/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jan-molak / serenity-js / packages / protractor / spec / adapter / reporter / ProtractorReporter.spec.ts View on Github external
let reporter:           ProtractorReporter,
        protractorRunner:   Runner,
        serenity:           Serenity;

    beforeEach(() => {
        protractorRunner    = sinon.createStubInstance(Runner);
        reporter            = new ProtractorReporter(protractorRunner);
        serenity            = new Serenity();

        serenity.setTheStage(reporter);
    });

    const details = new ScenarioDetails(
        new Name('scenario name'),
        new Category('scenario category'),
        new FileSystemLocation(new Path('./some/scenario.spec.ts')),
    );

    /** @test {ProtractorReporter} */
    it('ignores events outcomes Protractor doesn\'t care about', () => {

        expect(reporter.notifyOf(new SceneFinished(details, new ExecutionSkipped()))).to.be.undefined;  // tslint:disable-line:no-unused-expression

        expect(reporter.report()).to.deep.equal({
            failedCount: 0,
            specResults: [],
        });
    });

    /** @test {ProtractorReporter} */
    it('ignores domain events Protractor doesn\'t care about', () => {
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / reporting_scene_sequences.spec.ts View on Github external
describe('SerenityBDDReporter', () => {

    let stageManager: sinon.SinonStubbedInstance,
        reporter: SerenityBDDReporter;

    beforeEach(() => {
        const env = create();

        stageManager    = env.stageManager;
        reporter        = env.reporter;
    });

    // 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,
github jan-molak / serenity-js / packages / protractor / spec / stage / crew / photographer / Photographer.spec.ts View on Github external
describe('Photographer', () => {

    const
        defaultCardScenario = new ScenarioDetails(
            new Name('Paying with a default card'),
            new Category('Online Checkout'),
            new FileSystemLocation(
                new Path(`payments/checkout.feature`),
            ),
        ),
        pickACard = new ActivityDetails(new Name('Pick the default credit card'));

    it('complains when sent DomainEvents before getting assigned to a Stage', () => {
        const photographer = new Photographer(new TakePhotosOfFailures());
        expect(() => photographer.notifyOf(new SceneStarts(defaultCardScenario)))
            .to.throw(LogicError, `Photographer needs to be assigned to the Stage before it can be notified of any DomainEvents`);
    });

    describe(`when there's no actor in the spotlight`, () => {

        given(
            new ExecutionSkipped(),
github jan-molak / serenity-js / packages / cucumber / spec / listeners / CucumberEventProtocolAdapter.spec.ts View on Github external
it('correctly recognises ambiguous steps', () => {

        emitAllFrom(require('./samples/scenario-with-ambiguous-steps.json'));

        const expectedScenarioDetails = new ScenarioDetails(
            new Name('Ambiguous steps'),
            new Category('Event Protocol'),
            new FileSystemLocation(
                new Path('features/ambiguous-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 ambiguous step definition')))
                .next(TaskFinished, e => {
                    expect(e.value.name).to.equal(new Name('Given I have an ambiguous step definition'));
                    expect(e.outcome).to.be.instanceOf(ExecutionFailedWithError);
github jan-molak / serenity-js / packages / jasmine / src / SerenityReporterForJasmine.ts View on Github external
private scenarioDetailsOf(spec: SpecResult): ScenarioDetails {
        return new ScenarioDetails(
            new Name(this.currentScenarioNameFor(spec.description)),
            new Category(this.currentFeatureName()),
            FileSystemLocation.fromJSON(spec.location as any),
        );
    }
github jan-molak / serenity-js / integration / cucumber / spec / scenario_outlines.spec.ts View on Github external
then(res => {
            expect(res.exitCode).to.equal(1);

            const
                expectedScenarioName = new Name('Sample outline'),
                expectedScenarioCategory = new Category('Serenity/JS recognises scenario outlines'),
                outlineLine = 3,
                firstScenarioLine = 12,
                secondScenarioLine = 13,
                expectedExamplesName = new Name('Example results'),
                expectedExamplesDescription = new Description('Description of the examples');

            PickEvent.from(res.events)
                .next(SceneSequenceDetected, event => {
                    expect(event.value.name).to.equal(expectedScenarioName);
                    expect(event.value.category).to.equal(expectedScenarioCategory);
                    expect(event.value.location.line).to.equal(outlineLine);
                })
                .next(SceneParametersDetected, event => {
                    expect(event.scenario.name).to.equal(expectedScenarioName);
                    expect(event.scenario.category).to.equal(expectedScenarioCategory);
                    expect(event.value.name).to.equal(expectedExamplesName);
github jan-molak / serenity-js / packages / cucumber / src / notifier / Notifier.ts View on Github external
private detailsOf(scenario: FeatureFileNode, feature: Feature): ScenarioDetails {
        return new ScenarioDetails(
            scenario.name,
            new Category(feature.name.value),
            scenario.location,
        );
    }
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter.spec.ts View on Github external
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;