How to use the @serenity-js/core/lib/domain.Outcome 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-js / spec / api / serenity-protractor / stage / photographer.spec.ts View on Github external
it('is not interested in events other that the Start and Finish of an Activity', () => {

                const scene = new RecordedScene('A user adds a product to their basket', 'Checkout');

                thePhotographer.notifyOf(new SceneStarts(scene, now));
                thePhotographer.notifyOf(new SceneFinished(new Outcome(scene, Result.SUCCESS), now));

                expect(stageManager.readTheJournal()).to.be.empty;
            });
        });
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / framework / protractor_reporter.spec.ts View on Github external
given(...examplesOfFailure).it('failed', result => {
                                const report = RehearsalReport.from([
                                    new SceneStarts(scene_1, now),
                                    new ActivityStarts(logsIn, now),
                                    new ActivityFinished(new Outcome(logsIn, result, error), now + logsIn_duration),
                                    new SceneFinished(new Outcome(scene_1, result, error), now + scene_1_duration),
                                ]);

                                return expect(report.exportedUsing(new ProtractorReportExporter())).to.eventually.deep.equal({
                                    failedCount: 1,
                                    specResults: [
                                        {
                                            description: scene_1.name,
                                            assertions: [ {
                                                passed: false,
                                                errorMsg: error.message,
                                                stackTrace: error.stack,
                                            }],
                                            duration: scene_1_duration,
                                        },
                                    ],
                                });
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / stage / photographer.spec.ts View on Github external
it('finished with a Success', () => {

                        fileSystem.store.withArgs(photoName, imageBuffer).returns(photoPath);

                        thePhotographer.notifyOf(new ActivityFinished(new Outcome(activity, Result.SUCCESS), now));

                        const photoAttempted = stageManager.readTheJournal().pop();

                        expect(photoAttempted).to.be.instanceOf(PhotoAttempted);
                        expect(photoAttempted.timestamp).to.equal(now);

                        expect(photoAttempted.value).to.be.instanceOf(PhotoReceipt);
                        expect(photoAttempted.value.activity).to.deep.equal(activity);
                        return expect(photoAttempted.value.photo).to.eventually.deep.equal(new Photo(photoPath));
                    });
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / stage / photographer.spec.ts View on Github external
it('finished with an Error', () => {

                        const error = new Error('The element was not found');

                        fileSystem.store.withArgs(photoName, imageBuffer).returns(photoPath);

                        thePhotographer.notifyOf(new ActivityFinished(new Outcome(activity, Result.ERROR, error), now));

                        const photoAttempted = stageManager.readTheJournal().pop();

                        expect(photoAttempted).to.be.instanceOf(PhotoAttempted);
                        expect(photoAttempted.timestamp).to.equal(now);

                        expect(photoAttempted.value).to.be.instanceOf(PhotoReceipt);
                        expect(photoAttempted.value.activity).to.deep.equal(activity);
                        return expect(photoAttempted.value.photo).to.eventually.deep.equal(new Photo(photoPath));
                    });
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / framework / protractor_reporter.spec.ts View on Github external
given(...examplesOfFailure).it('failed', result => {
                                const report = RehearsalReport.from([
                                    new SceneStarts(scene_1, now),
                                    new ActivityStarts(logsIn, now),
                                    new ActivityFinished(new Outcome(logsIn, Result.SUCCESS), now + logsIn_duration),
                                    new ActivityStarts(selectsAProduct, now),
                                    new ActivityFinished(new Outcome(selectsAProduct, result, error), now + logsIn_duration),
                                    new SceneFinished(new Outcome(scene_1, result, error), now + scene_1_duration),
                                ]);

                                return expect(report.exportedUsing(new ProtractorReportExporter())).to.eventually.deep.equal({
                                    failedCount: 1,
                                    specResults: [
                                        {
                                            description: scene_1.name,
                                            assertions: [{
                                                passed: true,
                                                errorMsg: undefined,
                                                stackTrace: undefined,
                                            }, {
                                                passed: false,
                                                errorMsg: error.message,
                                                stackTrace: error.stack,
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / framework / protractor_reporter.spec.ts View on Github external
given(...examplesOfSuccess).it('passed', result => {
                                const report = RehearsalReport.from([
                                    new SceneStarts(scene_1, now),
                                        new ActivityStarts(logsIn, now),
                                        new ActivityFinished(new Outcome(logsIn, result), now + logsIn_duration),
                                    new SceneFinished(new Outcome(scene_1, result), now + scene_1_duration),
                                ]);

                                return expect(report.exportedUsing(new ProtractorReportExporter())).to.eventually.deep.equal({
                                    failedCount: 0,
                                    specResults: [
                                        {
                                            description: scene_1.name,
                                            assertions: [ {
                                                passed: true,
                                                errorMsg: undefined,
                                                stackTrace: undefined,
                                            }],
                                            duration: scene_1_duration,
                                        },
                                    ],
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / framework / protractor_reporter.spec.ts View on Github external
it('only specifies the results for top-level activities', () => {
                            const events: Array> = [
                                new SceneStarts(scene_1, now),
                                    new ActivityStarts(logsIn, now),
                                        new ActivityStarts(entersUsername,
                                            now),
                                        new ActivityFinished(new Outcome(entersUsername, Result.SUCCESS),
                                            now + entersUsername_duration),
                                        new ActivityStarts(entersPassword,
                                            now + entersUsername_duration),
                                        new ActivityFinished(new Outcome(entersPassword, Result.SUCCESS),
                                            now + entersUsername_duration + entersPassword_duration),
                                    new ActivityFinished(new Outcome(logsIn, Result.SUCCESS),
                                        now + entersUsername_duration + entersPassword_duration),
                                new SceneFinished(new Outcome(scene_1, Result.SUCCESS),
                                    now + scene_1_duration),
                            ];

                            const screenplay = RehearsalReport.from(events);

                            return expect(screenplay.exportedUsing(new ProtractorReportExporter())).to.eventually.deep.equal({
                                failedCount: 0,
                                specResults: [
                                    {
                                        description: scene_1.name,
                                        assertions: [ {
                                            passed: true,
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / stage / photographer.spec.ts View on Github external
it('was Skipped', () => {

                        thePhotographer.notifyOf(new ActivityFinished(new Outcome(activity, Result.SKIPPED), now));

                        expect(stageManager.readTheJournal()).to.be.empty;
                    });
github jan-molak / serenity-js / packages / serenity-js / spec / api / serenity-protractor / stage / photographer.spec.ts View on Github external
it('is Pending', () => {

                        thePhotographer.notifyOf(new ActivityFinished(new Outcome(activity, Result.PENDING), now));

                        expect(stageManager.readTheJournal()).to.be.empty;
                    });
                });