Skip to main content

externalRestQueryPanel <NET>

Interaction object representing a collapsible panel showing HTTP request/response details captured during test execution.

REST query panels appear inline within the activity tree of a scenario detail view, displaying the HTTP method, URL, and response status code of API interactions recorded by the @serenity-js/rest module.

Instantiation (within a parent interaction object)

import { RestQueryPanel } from '@serenity-js/html-reporter/serenity';
import { By } from '@serenity-js/web';

export class ActivityItem<NET> extends InteractionObject<NET> {
readonly restPanel = new RestQueryPanel(this.child(By.css('[data-testid="rest-panel"]')));
}

Usage in a test

await actor.attemptsTo(
Ensure.that(restPanel.method(), equals('POST')),
Ensure.that(restPanel.url(), includes('/api/checkout')),
Ensure.that(restPanel.statusCode(), equals('201')),
);

Hierarchy

Index

Constructors

externalconstructor

Methods

externalisPresent

  • Checks whether the interaction object's root element is present in the DOM.

    Since InteractionObject implements Optional, you can assert on presence directly:

    Ensure.that(view, isPresent())

    Returns Answerable<boolean>

externalmethod

  • The HTTP method of the captured request (e.g. 'GET', 'POST', 'PUT', 'DELETE').

    Example

    await actor.attemptsTo(
    Ensure.that(restPanel.method(), equals('POST')),
    );

    Returns QuestionAdapter<string>

externalurl

  • The request URL of the captured HTTP interaction.

    Example

    await actor.attemptsTo(
    Ensure.that(restPanel.url(), includes('/api/checkout')),
    );

    Returns QuestionAdapter<string>

externalstatusCode

  • The HTTP response status code (e.g. '200', '404', '500').

    Example

    await actor.attemptsTo(
    Ensure.that(restPanel.statusCode(), equals('201')),
    );

    Returns QuestionAdapter<string>