-
Notifications
You must be signed in to change notification settings - Fork 26
Stub prediction service with Cypress
arjandata edited this page Jul 14, 2020
·
3 revisions
With Cypress it is possible to stub responses. If you pass a response to cy.route(), Cypress will stub the response in the request. In case of the prediction service it looks like this:
cy.route('POST', '**/signals/category/prediction', 'fixture:klok.json').as('prediction');
If there is a POST request with **/signals/category/prediction
, then the fixture klok.json will be the response:
{ "hoofdrubriek": [ [ "http://localhost:8000/signals/v1/public/terms/categories/wegen-verkeer-straatmeubilair" ], [ 0.9879789204464681 ] ], "subrubriek": [ [ "http://localhost:8000/signals/v1/public/terms/categories/wegen-verkeer-straatmeubilair/sub_categories/klok" ], [ 0.6535964388156356 ] ] }