How to use the @serenity-js/core/lib/model.Name 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 / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
it('associates the background with the feature', parse('backgrounds.feature', map => {
            const feature = map.get(Feature).onLine(1);

            expect(feature.background).to.equal(
                new Background(
                    new FileSystemLocation(fixtures.join(new Path('backgrounds.feature')), 3, 3),
                    new Name('The one that provides some context'),
                    new Description('Once upon a time, there was a test suite.'),
                    [
                        new Step(
                            new FileSystemLocation(fixtures.join(new Path('backgrounds.feature')), 7, 5),
                            new Name('Given a prerequisite'),
                        ),
                    ],
            ));
        }));
github jan-molak / serenity-js / packages / cucumber / spec / listeners / CucumberEventProtocolAdapter.spec.ts View on Github external
it('correctly recognises Cucumber Event Protocol events', () => {

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

        const expectedScenarioDetails = new ScenarioDetails(
            new Name('Hooks'),
            new Category('Event Protocol'),
            new FileSystemLocation(
                new Path('features/tasty-cucumber.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 a tasty cucumber in my belly')))
                .next(TaskFinished,         e => {
                    expect(e.value.name).to.equal(new Name('Given I have a tasty cucumber in my belly'));
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
it('maps the background with name and description', parse('backgrounds.feature', map => {
            const firstBackground = map.get(Background).onLine(3);

            expect(firstBackground.name).to.equal(new Name('The one that provides some context'));
            expect(firstBackground.description).to.equal(new Description('Once upon a time, there was a test suite.'));
            expect(firstBackground.steps).to.deep.equal([
                new Step(
                    new FileSystemLocation(fixtures.join(new Path('backgrounds.feature')),
                        7,
                        5,
                    ),
                    new Name('Given a prerequisite'),
                ),
            ]);
        }));
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
));
            expect(outline.parameters[60]).to.equal(new ScenarioParameters(
                new Name(''),
                undefined,
                { username: 'admin', password: 'P@ssw0rd1' },
            ));
            expect(outline.parameters[61]).to.equal(new ScenarioParameters(
                new Name(''),
                undefined,
                { username: 'editor', password: 'P@ssw0rd2' },
            ));

            expect(map.get(Scenario).onLine(60).steps[0])
                .to.equal(new Step(
                    new FileSystemLocation(path, 53, 5),
                    new Name('Given the user logs in as admin with the following credentials:\n| username | admin |\n| password | P@ssw0rd1 |'),
                ));

            expect(map.get(Scenario).onLine(61).steps[0])
                .to.equal(new Step(
                    new FileSystemLocation(path, 53, 5),
                    new Name('Given the user logs in as editor with the following credentials:\n| username | editor |\n| password | P@ssw0rd2 |'),
                ));
        }));
    });
github jan-molak / serenity-js / integration / cucumber / spec / passing_scenario.spec.ts View on Github external
                .next(TestRunnerDetected,  event => expect(event.value).to.equal(new Name('Cucumber')))
                .next(SceneTagged,         event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a passing scenario')))
github jan-molak / serenity-js / packages / serenity-bdd / spec / stage / crew / samples.ts View on Github external
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==');
github jan-molak / serenity-js / packages / cucumber / spec / listeners / CucumberEventProtocolAdapter.spec.ts View on Github external
.next(TaskFinished, e => {
                    expect(e.value.name).to.equal(new Name('Given I have a pending step'));
                    expect(e.outcome).to.be.instanceOf(ImplementationPending);
                })
                .next(TaskStarts, e => expect(e.value.name).to.equal(new Name(`Then I should implement it`)))
github jan-molak / serenity-js / integration / cucumber / spec / timed_out_scenario.spec.ts View on Github external
                .next(TestRunnerDetected,  event => expect(event.value).to.equal(new Name('Cucumber')))
                .next(SceneTagged,         event => expect(event.tag).to.equal(new FeatureTag('Serenity/JS recognises a timed out scenario')))
github jan-molak / serenity-js / integration / cucumber / spec / ambiguous_steps.spec.ts View on Github external
            .next(SceneStarts, event => expect(event.value.name).to.equal(new Name('A passing scenario')))
            .next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Cucumber')))
github jan-molak / serenity-js / packages / cucumber / spec / gherkin / feature-files / FeatureFileMapper.spec.ts View on Github external
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),
            ));
        }));
    });