How to aggregate Playwright metrics by test.step instead of page #2164
Replies: 3 comments 11 replies
-
Hi @stefan123t, I believe the best way to do what you're describing would be to leverage Artillery's ability to emit custom metrics. You might be interested in using the pattern I described here #2147 (comment) to achieve this, which does the following:
const withTransactionTimer = async (transactionName, events, userActions) => {
const startedTime = Date.now();
await userActions();
const difference = Date.now() - startedTime;
events.emit('histogram', transactionName, difference)
}
Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
For anyone checking this thread, we've released in Artillery v2.0.0-38 a convenience helper similar to the one exemplified above, allowing you to wrap parts of your Playwright code with More information in: https://www.artillery.io/docs/reference/engines/playwright#teststep-argument |
Beta Was this translation helpful? Give feedback.
-
Hi, @bernardobridge ! So I need to capture metrics for each step and sub steps. To do this I have implemented the solution you suggested above and the built in test functionality, so my code looks like this:
Should it work properly ? May be there is another way to implement steps and sub-steps tracking ? |
Beta Was this translation helpful? Give feedback.
-
I do appreciate the artillery-engine-playwright integration to re-use DOM-model based playwright scripts for load-testing and I have been able to come up with a simple scenario, as below.
This works fine but as the app-context does not change all the events / interactive actions are aggregated with the same app-context.
Is there a way to allow aggregation based on playwright
test.step
's ?I tried to require / import test from @playwright/test but it still gives me as in #1325:
Is simply aggregating the metrics using playwright
test.step
's the right approach or would I rather need to create an artillery-plugin-metrics-by-test-step like in #1196 ?I read #1831 and #1754 discussion but I am still at loss being fairly new to Artillery.io
Details
search-person.js:
search-person.yml
Beta Was this translation helpful? Give feedback.
All reactions