I am trying to mock a response for a request that uses query params. I've already used onrequestto in other tests, and it works seamlessly. There is already a similar question to what I am asking, but the answer does not work for me whatever I do :(
The request that my frontend makes to get data from backend is something like
https://fake.com/search?Status=authorised&SortBy=Order
what I do in my tests is:
import {RequestMock} from "testcafe";
const mock = RequestMock()
.onRequestTo('\/search\?Status=authorised')
.respond({data:ok}, 200, {'content-type': 'application/json charset=utf-8'})
fixture('Test suite')
.page('fake.com')
.requestHooks(mock);
and proceed with my .test. Neither OPTIONS nor GET requests return the data that I am expecting. what am I doing wrong?