I am trying to do load testing for routes requiring login.
I previously used https://artillery.io/docs/index.html for worked out routes that worked fine. To enter the routes, I tried calling beforeRequest using the function to set the headers and request body.
config: target: "https://www.mywebsite.com/" phases: - duration: 60 arrivalRate: 50 processor: "test.js" scenarios: - flow: - post: url: "/login" beforeRequest: "setReqBody"
and my beforeRequest looked like this:
function setReqBody(requestParams, context, ee, next) { requestParams.body = {'email': ' user@mail.com ', 'password': 'password', '_csrf_token': window.csrfToken} return next(); }
I get a window undefined error message.
I looked around to see if there was anything else I could use to test the phoenix at boot, but didn't have much luck. Is there any other way to register and verify these routes? Or other dependencies / libraries that I can use for this?
source share