Skip to main content


Follow Serenity/JS on LinkedIn Watch Serenity/JS on YouTube Join Serenity/JS Community Chat Support Serenity/JS on GitHub

Serenity/JS is an innovative open-source framework designed to make acceptance and regression testing of complex software systems faster, more collaborative and easier to scale.

⭐️ Get started with Serenity/JS!

👋 Join the Serenity/JS Community!

Serenity/JS REST

@serenity-js/rest module lets your actors interact with and test HTTP REST APIs.


To install this module, as well as axios HTTP client, run the following command in your computer terminal:

npm install --save-dev @serenity-js/core @serenity-js/rest @serenity-js/assertions axios

To learn more about Serenity/JS and how to use it on your project, follow the Serenity/JS Getting Started guide.

Example test

import { actorCalled } from '@serenity-js/core'
import { CallAnApi, DeleteRequest, GetRequest, LastResponse, PostRequest, Send } from '@serenity-js/rest'
import { Ensure, equals, startsWith } from '@serenity-js/assertions'

const actor = actorCalled('Apisit').whoCan(''))

await actor.attemptsTo(
// no users present in the system
Ensure.that(LastResponse.status(), equals(200)),
Ensure.that(LastResponse.body(), equals([])),

// create a new test user account
login: 'tester',
password: 'P@ssword1',
Ensure.that(LastResponse.status(), equals(201)),
Ensure.that(LastResponse.header('Location'), startsWith('/users')),

// delete the test user account
Ensure.that(LastResponse.status(), equals(200)),

📣 Stay up to date

New features, tutorials, and demos are coming soon! Follow Serenity/JS on LinkedIn, subscribe to Serenity/JS channel on YouTube and join the Serenity/JS Community Chat to stay up to date! Please also make sure to star ⭐️ Serenity/JS on GitHub to help others discover the framework!

Follow Serenity/JS on LinkedIn Watch Serenity/JS on YouTube Join Serenity/JS Community Chat GitHub stars

💛 Support Serenity/JS

If you appreciate all the effort that goes into making sophisticated tools easy to work with, please support our work and become a Serenity/JS GitHub Sponsor today!

GitHub Sponsors


Type Aliases


AxiosRequestConfigProxyDefaults: { host: string; port?: number; auth?: { username: string; password: string }; protocol?: string }

Type declaration

  • host: string
  • optionalport?: number
  • optionalauth?: { username: string; password: string }
    • username: string
    • password: string
  • optionalprotocol?: string


AxiosRequestConfigDefaults<Data>: Omit<CreateAxiosDefaults<Data>, proxy> & { proxy?: AxiosRequestConfigProxyDefaults | false }

Type parameters

  • Data = any