How to use @serenity-js/local-server - 10 common examples

To help you get started, we’ve selected a few @serenity-js/local-server 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 / examples / cucumber-rest-api-level-testing / features / step_definitions / api-level.steps.ts View on Github external
Before(function () {
    return this.stage.theActorCalled('Apisitt').attemptsTo(                     // todo: change to Maggie
        StartLocalServer.onRandomPort(),
        ChangeApiUrl.to(LocalServer.url()),
        // TakeNote.of(LocalServer.url())               // Question or Question; Pass between actors
    );
});
github jan-molak / serenity-js / examples / cucumber-rest-api-level-testing / features / step_definitions / api-level.steps.ts View on Github external
Before(function () {
    return this.stage.theActorCalled('Apisitt').attemptsTo(                     // todo: change to Maggie
        StartLocalServer.onRandomPort(),
        ChangeApiUrl.to(LocalServer.url()),
        // TakeNote.of(LocalServer.url())               // Question or Question; Pass between actors
    );
});
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Cookie.spec.ts View on Github external
describe('over HTTP', () => {

        // Fun fact: Before Cookie Monster ate his first cookie, he believed his name was Sid. You're welcome.
        const Sid = Actor.named('Sid').whoCan(
            BrowseTheWeb.using(protractor.browser),
            ManageALocalServer.runningAHttpListener(cookieCutterApp),
        );

        beforeEach(() => Sid.attemptsTo(StartLocalServer.onRandomPort()));
        afterEach(() => Sid.attemptsTo(StopLocalServer.ifRunning()));
        afterEach(() => Sid.attemptsTo(DeleteCookies.all()));

        describe('when working with the value', () => {

            /** @test {Cookie} */
            /** @test {Cookie#valueOf} */
            it('allows the actor to retrieve it', () => Sid.attemptsTo(
                Navigate.to(cookieCutterURLFor('/cookie?name=favourite&value=chocolate-chip')),
                Ensure.that(Cookie.valueOf('favourite'), equals('chocolate-chip')),
            ));

            /** @test {Cookie} */
github jan-molak / serenity-js / examples / cucumber-rest-api-level-testing / features / step_definitions / api-level.steps.ts View on Github external
After(function () {
    return this.stage.theActorCalled('Apisitt').attemptsTo(
        StopLocalServer.ifRunning(),
    );
});
github jan-molak / serenity-js / examples / cucumber-rest-api-level-testing / features / support / screenplay / Actors.ts View on Github external
prepare(actor: Actor): Actor {
        return actor.whoCan(
            ManageALocalServer.runningAHttpListener(requestHandler),
            CallAnApi.at('http://localhost'),
        );
    }
}
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Cookie.spec.ts View on Github external
describe('when working with secure cookies', () => {

        const Sid = Actor.named('Secure Sid').whoCan(
            BrowseTheWeb.using(protractor.browser),
            ManageALocalServer.runningAHttpsListener(cookieCutterApp, {
                cert:               certificates.cert,
                key:                certificates.key,
                requestCert:        true,
                rejectUnauthorized: false,
            }),
        );

        beforeEach(() => Sid.attemptsTo(StartLocalServer.onRandomPort()));
        afterEach(() => Sid.attemptsTo(StopLocalServer.ifRunning()));
        afterEach(() => Sid.attemptsTo(DeleteCookies.all()));

        /** @test {Cookie} */
        /** @test {Cookie#isSecure} */
        it('allows the actor to confirm that a cookie is not secure', () => Sid.attemptsTo(
            Navigate.to(cookieCutterURLFor('/cookie?name=favourite&value=chocolate-chip')),
            Ensure.that(Cookie.isSecure('favourite'), equals(false)),
github jan-molak / serenity-js / examples / protractor-cucumber / features / step_definitions / ui.steps.ts View on Github external
When(/^(.*) navigates to the test website$/, function(this: WithStage, actorName: string) {
    return this.stage.actor(actorName).attemptsTo(
        StartLocalServer.onRandomPort(),
        UseAngular.disableSynchronisation(),
        Navigate.to(LocalServer.url()),
    );
});
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Cookie.spec.ts View on Github external
function cookieCutterURLFor(path: string): Question> {
        return Transform.the(LocalServer.url(), url => `${ url }${ path }`);
    }
github jan-molak / serenity-js / packages / protractor / spec / screenplay / questions / Cookie.spec.ts View on Github external
        beforeEach(() => Sid.attemptsTo(StartLocalServer.onRandomPort()));
        afterEach(() => Sid.attemptsTo(StopLocalServer.ifRunning()));
github jan-molak / serenity-js / examples / protractor-cucumber / features / step_definitions / ui.steps.ts View on Github external
When(/^(.*) navigates to the test website$/, function(this: WithStage, actorName: string) {
    return this.stage.actor(actorName).attemptsTo(
        StartLocalServer.onRandomPort(),
        UseAngular.disableSynchronisation(),
        Navigate.to(LocalServer.url()),
    );
});

@serenity-js/local-server

Enables Serenity/JS Actors to manage local Node.js test servers, such as Express, Koa or Restify

Apache-2.0
Latest version published 3 days ago

Package Health Score

78 / 100
Full package analysis