I'm trying to do load testing for routes that require logging in.
I was previously using https://artillery.io/docs/index.html for logged out routes which worked fine. For logged in routes, I tried calling beforeRequest
with a function to set the request headers & 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': '[email protected]', 'password': 'password', '_csrf_token': window.csrfToken}
return next();
}
I am getting an error that window
is undefined.
I had a look around to see if there was anything else I could use for load testing phoenix, but didn't have much luck. Is there any other way I can log in & test those routes? Or other dependencies/libraries I can use in order to do this?