How to use the @serenity-js/rest.Send.a function in @serenity-js/rest

To help you get started, we’ve selected a few @serenity-js/rest 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 / support / screenplay / tasks / RequestCalculationOf.ts View on Github external
export const RequestCalculationOf = (expression: string) =>
    Task.where(`#actor requests calculation of ${ expression }`,
        Send.a(
            PostRequest.to('/api/calculations').with(expression).using({ headers: { 'Content-Type': 'text/plain' }}),
        ),
        Ensure.that(LastResponse.status(), equals(201)),
        Ensure.that(LastResponse.header('location'), startsWith('/api/calculations/')),
    );
github jan-molak / serenity-js / packages / local-server / spec / servers.spec.ts View on Github external
describe('when working with HTTPS', () => {

        const testHttpsServer = [
            StartLocalServer.onOneOfThePreferredPorts([ 8443, 9443 ]),
            Ensure.that(LocalServer.url(), startsWith('https://127.0.0.1')),
            Send.a(GetRequest.to(LocalServer.url())),
            Ensure.that(LastResponse.status(), equals(200)),
            Ensure.that(LastResponse.body(), equals('Hello World!')),
        ];

        given(
            require('./servers/barebones'),
            require('./servers/express'),
            require('./servers/koa'),
        ).
        it('allows the Actor to start, stop and access the location of a HTTPS', function ({ handler, node }) {
            if (! satisfies(process.versions.node, node)) {
                return this.skip();
            }

            class Actors implements DressingRoom {
                prepare(actor: Actor): Actor {

@serenity-js/rest

Serenity/JS Screenplay Pattern library for interacting with REST and other HTTP-based services, supporting comprehensive API testing and blended testing scenarios

Apache-2.0
Latest version published 1 day ago

Package Health Score

81 / 100
Full package analysis