How would you detect that an e2e test is running instead of a regular user?
Unanswered
lipe-dev posted this in #help-forum
lipe-devOP
Hey friends. Looking for some insights here if you have dealt with this kind of issue before.
We have a setup here that runs e2e tests with cypress on lots of ocasions (after merges, after deploys, some checkly periodic checks, etc).
However, those are inflating everything up on Mixpanel, Hotjar, DataDog RUM, etc with a lot of fake users.
On most of these services we can filter that data out after the user is identified, but I would like, if possible, to not enable these trackers at all for those cases.
I thought about using a special URL param that e2e tests will navigate to (instead of going to
What do you think? What would the earliest possible place to access that info be? Should I
I would love to have this in the server side of things on each request, but it is not an option as our app is statically built.
We have a setup here that runs e2e tests with cypress on lots of ocasions (after merges, after deploys, some checkly periodic checks, etc).
However, those are inflating everything up on Mixpanel, Hotjar, DataDog RUM, etc with a lot of fake users.
On most of these services we can filter that data out after the user is identified, but I would like, if possible, to not enable these trackers at all for those cases.
I thought about using a special URL param that e2e tests will navigate to (instead of going to
myapp.com they would myapp.com?e2e=true and based on that init the trackers or not.What do you think? What would the earliest possible place to access that info be? Should I
useRouter in _app.ts and check it from there? It would probably also be wise to save that "this is an e2e test from now on" flag somewhere so that everything else can see it and avoid initializing the trackers at a later point 🤔 I would love to have this in the server side of things on each request, but it is not an option as our app is statically built.
5 Replies
Hey!
add a header
(or set a cookie)
Also if you're using test users, then you know if a test is a test if the user id of the current session is a test user's id
lipe-devOP
I don't have a server where I can add a header and/or cookie.
I cannot wait until after users have IDed themselves for this
I cannot wait until after users have IDed themselves for this