Skip to navigation

mockRequest

Referenced In

Fields

FieldTypeDescriptionDefault
mockRequestobject(mockRequest)Required. Answer matching browser requests with a fixed response, a sequence of responses, or the responses recorded in a HAR file, from this step until the test ends. A later mockRequest for the same url and method replaces the earlier one. Runs only in Chrome. In other browsers, the step is skipped.—

Examples

{
"mockRequest": {
"url": "**/api/invoices*",
"response": {
"body": {
"next": "2026-12-03"
}
}
}
}
{
"mockRequest": {
"url": "https://api.example.com/user",
"method": "GET",
"response": {
"statusCode": 200,
"headers": {
"content-type": "application/json"
},
"bodyPath": "fixtures/user.json"
}
}
}
{
"mockRequest": {
"url": "**/api/jobs/1",
"responses": [
{
"body": {
"status": "running"
}
},
{
"body": {
"status": "done"
}
}
]
}
}
{
"mockRequest": {
"harPath": "fixtures/app.har",
"url": "**/api/**"
}
}