How to use the @serenity-js/core/lib/events.TestRunFinished 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 / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter.spec.ts View on Github external
it('has been compromised', () => {

                // const assertionError = new AssertionError('expected true to equal false', false, true);
                const assertionError = new TestCompromisedError('expected true to equal false');

                given(reporter).isNotifiedOfFollowingEvents(
                    new SceneFinished(defaultCardScenario, new ExecutionCompromised(assertionError)),
                    new TestRunFinished(),
                );

                report = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

                expect(report.result).to.equal('COMPROMISED');
                expect(report.testFailureCause.errorType).to.equal('TestCompromisedError');
                expect(report.testFailureCause.message).to.equal('expected true to equal false');
                expect(report.testFailureCause.stackTrace).to.be.an('array');
            });
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / tagging_scenarios.spec.ts View on Github external
it('is marked map automated (non-manual) by default', () => {
                    given(reporter).isNotifiedOfFollowingEvents(
                        new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                        new TestRunFinished(),
                    );

                    report = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

                    expect(report.manual).to.equal(false);
                });
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / reporting_activities.spec.ts View on Github external
it('records the events in a correct order', () => {
            const pickACard = new ActivityDetails(new Name('Pick the default credit card'));

            given(reporter).isNotifiedOfFollowingEvents(
                new SceneStarts(defaultCardScenario),
                    new TaskStarts(pickACard),
                        new ActivityRelatedArtifactGenerated(pickACard, new Name('photo1'), photo),
                        new ActivityRelatedArtifactArchived(pickACard, new Name('photo1'), Photo, new Path('target/site/serenity/photo1.png')),
                    new TaskFinished(pickACard, new ExecutionSuccessful()),
                        new ActivityRelatedArtifactGenerated(pickACard, new Name('photo2'), photo),
                        new ActivityRelatedArtifactArchived(pickACard, new Name('photo2'), Photo, new Path('target/site/serenity/photo2.png')),
                new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                new TestRunFinished(),
            );

            const report: SerenityBDDReport = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

            expect(report.testSteps).to.have.lengthOf(1);
            expect(report.testSteps[0].screenshots).to.deep.equal([
                { screenshot: 'photo1.png'},
                { screenshot: 'photo2.png'},
            ]);
        });
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / tagging_scenarios.spec.ts View on Github external
it('belongs to a feature', () => {
                    given(reporter).isNotifiedOfFollowingEvents(
                        new SceneTagged(defaultCardScenario, new FeatureTag('Checkout')),
                        new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                        new TestRunFinished(),
                    );

                    report = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

                    expect(report.tags).to.deep.include.members([{
                        name: 'Checkout',
                        type: 'feature',
                    }]);

                    expect(report.featureTag).to.deep.equal({
                        name: 'Checkout',
                        type: 'feature',
                    });
                });
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter.spec.ts View on Github external
it('specifies the test runner', () => {
                given(reporter).isNotifiedOfFollowingEvents(
                    new TestRunnerDetected(new Name('Cucumber')),
                    new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                    new TestRunFinished(),
                );

                report = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

                expect(report.testSource).to.equal('Cucumber');
            });
github jan-molak / serenity-js / packages / jasmine / src / SerenityReporterForJasmine.ts View on Github external
jasmineDone(suiteInfo: JasmineDoneInfo) {
        this.emit(new TestRunFinished(this.serenity.currentTime()));
    }
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / reporting_activities.spec.ts View on Github external
it('reports the outcome of a sequence of several activities', () => {
            const pickACard   = new ActivityDetails(new Name('Pick the default credit card'));
            const makePayment = new ActivityDetails(new Name('Make the payment'));

            given(reporter).isNotifiedOfFollowingEvents(
                new SceneStarts(defaultCardScenario),
                    new TaskStarts(pickACard),
                    new TaskFinished(pickACard, new ExecutionSuccessful()),
                    new TaskStarts(makePayment),
                    new TaskFinished(makePayment, new ExecutionSuccessful()),
                new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                new TestRunFinished(),
            );

            const report: SerenityBDDReport = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

            expect(report.testSteps).to.have.lengthOf(2);
            expect(report.testSteps[0].description).to.equal(pickACard.name.value);
            expect(report.testSteps[0].result).to.equal('SUCCESS');
            expect(report.testSteps[1].description).to.equal(makePayment.name.value);
            expect(report.testSteps[1].result).to.equal('SUCCESS');
        });
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / tagging_scenarios.spec.ts View on Github external
it('can be tagged with an issue number', () => {
                    given(reporter).isNotifiedOfFollowingEvents(
                        new SceneTagged(defaultCardScenario, new IssueTag('ABC-1234')),
                        new SceneTagged(defaultCardScenario, new IssueTag('DEF-5678')),
                        new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                        new TestRunFinished(),
                    );

                    report = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

                    expect(report.tags).to.deep.include.members([{
                        name: 'ABC-1234',
                        type: 'issue',
                    }, {
                        name: 'DEF-5678',
                        type: 'issue',
                    }]);

                    expect(report.issues).to.deep.equal([
                        'ABC-1234',
                        'DEF-5678',
                    ]);
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter.spec.ts View on Github external
it('is separate for each scenario', () => {
            given(reporter).isNotifiedOfFollowingEvents(
                new SceneStarts(defaultCardScenario),
                new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                new SceneStarts(voucherScenario),
                new SceneFinished(voucherScenario, new ExecutionIgnored()),
                new TestRunFinished(),
            );

            expect(stageManager.notifyOf.callCount).to.equal(2);

            const
                event1: ArtifactGenerated = stageManager.notifyOf.firstCall.lastArg,
                event2: ArtifactGenerated = stageManager.notifyOf.secondCall.lastArg;

            expect(event1.artifact.map(_ => _).name).to.equal(defaultCardScenario.name.value);

            expect(event2.artifact.map(_ => _).name).to.equal(voucherScenario.name.value);
        });
    });
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / reporting_activities.spec.ts View on Github external
pickACard   = new ActivityDetails(new Name('Pick a credit card')),
                makePayment = new ActivityDetails(new Name('Make a payment'));

            given(reporter).isNotifiedOfFollowingEvents(
                new SceneStarts(defaultCardScenario),
                    new TaskStarts(pickACard),
                        new ArtifactGenerated(new Name('pick a card message'), JSONData.fromJSON({ card: 'default' })),
                        new ArtifactArchived(new Name('pick a card message'), JSONData, new Path('target/site/serenity/pick-a-card-message-md5hash.json')),
                    new TaskFinished(pickACard, new ExecutionSuccessful()),
                    new TaskStarts(makePayment),
                        new ArtifactGenerated(new Name('make a payment message'), JSONData.fromJSON({ amount: '£42' })),
                        new ArtifactArchived(new Name('make a payment message'), JSONData, new Path('target/site/serenity/make-a-payment-message-md5hash.json')),
                        new ArtifactGenerated(new Name('server log'), TextData.fromJSON({ contentType: 'text/plain', data: 'received payment request' })),
                    new TaskFinished(makePayment, new ExecutionSuccessful()),
                new SceneFinished(defaultCardScenario, new ExecutionSuccessful()),
                new TestRunFinished(),
            );

            const report: SerenityBDDReport = stageManager.notifyOf.firstCall.lastArg.artifact.map(_ => _);

            expect(report.testSteps).to.have.lengthOf(2);
            expect(report.testSteps[0].number).to.equal(1);
            expect(report.testSteps[0].reportData[0].title).to.equal('pick a card message');
            expect(report.testSteps[0].reportData[0].contents).to.equal('{\n    "card": "default"\n}');

            expect(report.testSteps[1].number).to.equal(2);

            expect(report.testSteps[1].reportData[0].title).to.equal('make a payment message');
            expect(report.testSteps[1].reportData[0].contents).to.deep.equal('{\n    \"amount\": \"£42\"\n}');

            expect(report.testSteps[1].reportData[1].title).to.equal('server log');
            expect(report.testSteps[1].reportData[1].contents).to.deep.equal('received payment request');