I mocking endpoint with query parameters in Cypress. But when give query field with array of field items.
cy.intercept(
{
method: 'POST',
pathname: '/api/initiate/manual',
hostname: Cypress.env('CY_API_URL'),
https: true,
query: {
orderId: '13535353453',
items: [
{
id: '3853438474',
name: 'Standard Wholesale HB Yellow Pencils',
},
{
id: '2424534353453',
name: 'natural wood dipped end 72 color',
},
],
},
},
{
statusCode: 200,
},
).as('mockManuelOrder');
it gives error :
CypressError
An invalid RouteMatcher was supplied to cy.intercept(). query.items must be a string or a regular expression.
how I can solve the problem ?, I need to send the query parameters as it is.
It should be working: