RequestLogger Class

A request logger that stores the requests sent and responses received during test execution.

Use the RequestLogger constructor to create a logger.

Attach the logger to a test or fixture to enable logging.

You can access the log with the logger.requests property, or search for entries that satisfy a predicate with logger.contains and logger.count methods.

The logger.clear method removes all entries from the log.

import { RequestLogger } from 'testcafe';

const logger = RequestLogger();

fixture`RequestLogger`
    .page`https://devexpress.github.io/testcafe/example/`
    .requestHooks(logger);

test('Check request', async t => {
    await t.expect(logger.contains(record => record.response.statusCode === 200)).ok()
        .expect(logger.requests[0].request.method).eql('get');
});