How to use the @serenity-js/core/lib/io.FileSystemLocation 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 / protractor / spec / adapter / ProtractorFrameworkAdapter.spec.ts View on Github external
.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()),
                    );

                    return this.serenityInstance.waitForNextCue();

                }), Promise.resolve(void 0));
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
it('maps the scenario template', parse('scenario_outlines.feature', map => {
            const
                scenario = map.get(ScenarioOutline).onLine(3),
                path = fixtures.join(new Path('scenario_outlines.feature'));

            expect(scenario).to.equal(new ScenarioOutline(
                new FileSystemLocation(path, 3, 3),
                new Name('The one with examples'),
                new Description('Description of the scenario with examples'),
                [
                    new Step(
                        new FileSystemLocation(path, 7, 5),
                        new Name('Given step with a '),
                    ),
                ],
                {
                    14: new ScenarioParameters(
                        new Name('Name of the example set'),
                        new Description('Description of the example set'),
                        { parameter: 'value one' },
                    ),
                    15: new ScenarioParameters(
                        new Name('Name of the example set'),
                        new Description('Description of the example set'),
                        { parameter: 'value two' },
                    ),
                },
            ));
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
it('maps the interpolated scenario', parse('scenario_outlines.feature', map => {
            const path = fixtures.join(new Path('scenario_outlines.feature'));

            expect(map.get(Scenario).onLine(14)).to.equal(new Scenario(
                new FileSystemLocation(path, 14, 7),
                new Name('The one with examples'),
                new Description('Description of the scenario with examples'),
                [
                    new Step(
                        new FileSystemLocation(path, 7, 5),
                        new Name('Given step with a value one'),
                    ),
                ],
                [],
                new FileSystemLocation(path, 3, 3),
            ));

            expect(map.get(Scenario).onLine(15)).to.equal(new Scenario(
                new FileSystemLocation(path, 15, 7),
                new Name('The one with examples'),
                new Description('Description of the scenario with examples'),
                [
                    new Step(
                        new FileSystemLocation(path, 7, 5),
                        new Name('Given step with a value two'),
                    ),
                ],
                [],
                new FileSystemLocation(path, 3, 3),
            ));
        }));
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
it('associates the background steps with the scenarios', parse('backgrounds.feature', map => {
            const scenario = map.get(Scenario).onLine(9);

            expect(scenario.steps).to.deep.equal([
                new Step(
                    new FileSystemLocation(fixtures.join(new Path('backgrounds.feature')), 7, 5),
                    new Name('Given a prerequisite'),
                ),
                new Step(
                    new FileSystemLocation(fixtures.join(new Path('backgrounds.feature')), 11, 5),
                    new Name('Given some scenario step'),
                ),
            ]);
        }));
    });
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
it('maps the interpolated scenario', parse('scenario_outlines.feature', map => {
            const path = fixtures.join(new Path('scenario_outlines.feature'));

            expect(map.get(Scenario).onLine(14)).to.equal(new Scenario(
                new FileSystemLocation(path, 14, 7),
                new Name('The one with examples'),
                new Description('Description of the scenario with examples'),
                [
                    new Step(
                        new FileSystemLocation(path, 7, 5),
                        new Name('Given step with a value one'),
                    ),
                ],
                [],
                new FileSystemLocation(path, 3, 3),
            ));

            expect(map.get(Scenario).onLine(15)).to.equal(new Scenario(
                new FileSystemLocation(path, 15, 7),
                new Name('The one with examples'),
                new Description('Description of the scenario with examples'),
github jan-molak / serenity-js / packages / cucumber / src / listeners / CucumberEventProtocolAdapter.ts View on Github external
return stepsLocations.map(location =>
                    isAHook(location)
                        ?   new Hook(new FileSystemLocation(new Path(location.actionLocation.uri), location.actionLocation.line), new Name('Setup'))
                        :   steps.find(matching(location)),
                );
github jan-molak / serenity-js / packages / cucumber / src / gherkin / feature-files / FeatureFileMapper.ts View on Github external
document.feature.children.forEach(scenarioDefinition => {
            switch (scenarioDefinition.type) {

                case 'Background':

                    background = new Background(
                        new FileSystemLocation(
                            path,
                            scenarioDefinition.location.line,
                            scenarioDefinition.location.column,
                        ),
                        new Name(scenarioDefinition.name),
                        scenarioDefinition.description && new Description(scenarioDefinition.description),
                        scenarioDefinition.steps.map(step => this.asStep(path, step)),
                    );

                    map.set(background).onLine(scenarioDefinition.location.line);

                    break;

                case 'Scenario':

                    map.set(new Scenario(
github jan-molak / serenity-js / packages / cucumber / src / gherkin / feature-files / FeatureFileMapper.ts View on Github external
private asStep(path: Path, step: nodes.Step, variableCells: nodes.TableCell[] = [], valueCells: nodes.TableCell[] = []): Step {
        return new Step(
            new FileSystemLocation(
                path,
                step.location.line,
                step.location.column,
            ),
            new Name([
                step.keyword,
                step.text,
                this.interpolateStepArgument(step.argument, variableCells, valueCells),
            ].filter(_ => !!_).join('')),
        );
    }
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / serenity-bdd-reporter / SerenityBDDReporter / reporting_scene_sequences.spec.ts View on Github external
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}
     * @test {SceneTemplateDetected}
     * @test {SceneParametersDetected}
     * @test {ScenarioParameters}
     * @test {SceneStarts}