Closed roydekleijn closed 1 year ago
hi @roydekleijn 👋 - I'd have to check but it may not be working because Artillery creates a separate browser for each virtual user, and each of those browsers is trying to write to the same file. Is there a particular reason you want to save requests from all VUs?
Hello, Thanks! If I'm right, it's more of an issue for the Playwright-team then?
Can we somehow manage that a separate file is created per Vuser?
I will describe my use case a bit more,
Thanks for the details @roydekleijn. If I understand correctly you need the HAR files to get performance metrics for the API routes that are triggered by actions performed by the Playwright script? That's possibly something we could implement natively in our integration and provide those metrics alongside other metrics reported by Artillery.
In the meantime, I think you can use the routeFromHAR
to record separate HAR file for each VU.
First make sure that your Playwright test function is passed the userContext
argument from Artillery, e.g.:
async function myPlaywrightTestFunction(page, userContext) {
}
And then add this as the first line of your Playwright test function:
await page.routeFromHAR(`/tmp/playwright-har-${userContext.vars.$uuid}.har`, {
update: true
});
This makes use of the unique $uuid
variable set for each VU by Artillery to name each HAR file.
This should produces a bunch of HAR files looking like this:
Awesome, this is what I was looking for.
I will create a small utility to process the files and report the timings, Thanks!
It would be awesome is this will become part of Artillery!
Great, glad that's what you were looking for! and thanks for the idea :)
Hello,
I'm running some Playwright flows with artillery. I try to save the output (requests made by the browser) into a HAR file. This is fine when running 1 session/arrival/vusers, but doesn't work when running multiple sessions/arrivals.
This is the Playwright config I'm using:
My question is, how can I combine all the output in a single HAR file, OR how can I create 1 HAR file per session/arrival/vusers ? Which then can be processed later on.
Happy to collaborate on this! Roy